luci-mod-network: make device selector dependent on protocol (again)
authorJo-Philipp Wich <jo@mein.io>
Mon, 31 May 2021 12:00:51 +0000 (14:00 +0200)
committerJo-Philipp Wich <jo@mein.io>
Mon, 31 May 2021 12:04:50 +0000 (14:04 +0200)
This commit effectively reverts the change made with
907b4222f7 ("luci-mod-network: don't hide "Device" on protocol change").

Floating tunnel protocols such as 6in4, plain PPP over modem device,
VPNC etc. do not have any layer 2 device at all, for such protocols the
device selector should be hidden.

Also swap back the incorrect option order introduced with commit
b7f3cf66ca ("luci-mod-network: drop support for *adding* legacy bridges").

Since device depends on proto, it should come after the protocol selection,
not before.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
modules/luci-mod-network/htdocs/luci-static/resources/view/network/interfaces.js

index 08b1a218555df60beebf7787e15e288febde4b47..0a1834062e280529151fc0953a376856cb6447e1 100644 (file)
@@ -503,10 +503,6 @@ return view.extend({
                                }, this);
                                o.write = function() {};
 
-                               o = s.taboption('general', widgets.DeviceSelect, 'device', _('Device'));
-                               o.nobridges = false;
-                               o.optional = false;
-                               o.network = ifc.getName();
 
                                proto_select = s.taboption('general', form.ListValue, 'proto', _('Protocol'));
                                proto_select.modalonly = true;
@@ -523,6 +519,11 @@ return view.extend({
                                                .then(L.bind(this.renderMoreOptionsModal, this, s.section));
                                }, this);
 
+                               o = s.taboption('general', widgets.DeviceSelect, 'device', _('Device'));
+                               o.nobridges = false;
+                               o.optional = false;
+                               o.network = ifc.getName();
+
                                o = s.taboption('general', form.Flag, 'auto', _('Bring up on boot'));
                                o.modalonly = true;
                                o.default = o.enabled;
@@ -878,7 +879,6 @@ return view.extend({
                                        o = s.children[i];
 
                                        switch (o.option) {
-                                       case 'device':
                                        case 'proto':
                                        case 'auto':
                                        case '_dhcp':
@@ -890,6 +890,7 @@ return view.extend({
                                        case 'igmp_snooping':
                                        case 'stp':
                                        case 'type':
+                                       case 'device':
                                                var deps = [];
                                                for (var j = 0; j < protocols.length; j++) {
                                                        if (!protocols[j].isVirtual()) {