luci-proto-external: migrate from support to cni-protocol to external-protocol
authorOskari Rauta <oskari.rauta@gmail.com>
Thu, 30 Nov 2023 05:35:48 +0000 (07:35 +0200)
committerPaul Donald <newtwen@gmail.com>
Mon, 4 Dec 2023 22:11:24 +0000 (23:11 +0100)
As previously introduced cni protocol support (for netifd) has evolved more
to a multipurpose protocol useful for cni/netavark/some vpn/etc connections
I have decided to rename it from cni-protocol to external-protocol.

That's why also it's luci companion, luci-proto-cni, should be renamed
to luci-proto-external and migrated to support external-protocol.

This patch also adds support for new option in external-protocol, delay.

This closes promise made in #22702 on openwrt packages repository.

Signed-off-by: Oskari Rauta <oskari.rauta@gmail.com>
(cherry picked from commit 0dd348c87f590861c252194b1720921d8779b4a1)

protocols/luci-proto-cni/Makefile [deleted file]
protocols/luci-proto-cni/htdocs/luci-static/resources/protocol/cni.js [deleted file]
protocols/luci-proto-external/Makefile [new file with mode: 0644]
protocols/luci-proto-external/htdocs/luci-static/resources/protocol/external.js [new file with mode: 0644]

diff --git a/protocols/luci-proto-cni/Makefile b/protocols/luci-proto-cni/Makefile
deleted file mode 100644 (file)
index 6405fca..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-include $(TOPDIR)/rules.mk
-
-LUCI_TITLE:=Support for CNI protocol
-LUCI_DEPENDS:=+cni-protocol
-
-include ../../luci.mk
-
-# call BuildPackage - OpenWrt buildroot signature
diff --git a/protocols/luci-proto-cni/htdocs/luci-static/resources/protocol/cni.js b/protocols/luci-proto-cni/htdocs/luci-static/resources/protocol/cni.js
deleted file mode 100644 (file)
index 273067f..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-'use strict';
-'require form';
-'require network';
-
-return network.registerProtocol('cni', {
-       getI18n: function () {
-               return _('CNI (Externally managed interface)');
-       },
-
-       getOpkgPackage: function() {
-               return "cni-protocol";
-       },
-
-       isFloating: function() {
-               return true;
-       },
-
-       isVirtual: function() {
-               return true;
-       },
-
-       getDevices: function() {
-               return null;
-       },
-
-       renderFormOptions: function(s) {
-               var o;
-
-               o = s.taboption('general', form.Value, '_device', _('Device'));
-               o.ucioption = 'device';
-               o.optional = false;
-               o.rmempty = false;
-
-               o = s.taboption('general', form.Value, '_delay', _('Delay'), _('Afer making changes to network using CNI protocol, network must be manually restarted.'));
-               o.ucioption = 'delay';
-               o.placeholder = '10';
-               o.datatype = 'min(1)';
-               o.optional = true;
-               o.rmempty = true;
-       }
-
-});
diff --git a/protocols/luci-proto-external/Makefile b/protocols/luci-proto-external/Makefile
new file mode 100644 (file)
index 0000000..b9b146d
--- /dev/null
@@ -0,0 +1,8 @@
+include $(TOPDIR)/rules.mk
+
+LUCI_TITLE:=Support for externally managed protocol
+LUCI_DEPENDS:=+external-protocol
+
+include ../../luci.mk
+
+# call BuildPackage - OpenWrt buildroot signature
diff --git a/protocols/luci-proto-external/htdocs/luci-static/resources/protocol/external.js b/protocols/luci-proto-external/htdocs/luci-static/resources/protocol/external.js
new file mode 100644 (file)
index 0000000..06bd5f3
--- /dev/null
@@ -0,0 +1,47 @@
+'use strict';
+'require form';
+'require network';
+
+return network.registerProtocol('external', {
+       getI18n: function () {
+               return _('Externally managed interface');
+       },
+
+       getOpkgPackage: function() {
+               return "external-protocol";
+       },
+
+       isFloating: function() {
+               return true;
+       },
+
+       isVirtual: function() {
+               return true;
+       },
+
+       getDevices: function() {
+               return null;
+       },
+
+       renderFormOptions: function(s) {
+               var o;
+
+               o = s.taboption('general', form.Value, '_device', _('Device'));
+               o.ucioption = 'device';
+               o.optional = false;
+               o.rmempty = false;
+
+               o = s.taboption('general', form.Value, '_delay', _('Delay'), _('Afer making changes to network using external protocol, network must be manually restarted.'));
+               o.ucioption = 'delay';
+               o.placeholder = '10';
+               o.datatype = 'min(1)';
+               o.optional = true;
+               o.rmempty = true;
+
+               o = s.taboption('general', form.Value, '_searchdomain', _('Search domain'));
+               o.ucioption = 'searchdomain'
+               o.optional = true;
+               o.rmempty = true;
+       }
+
+});