luci-mod-network: drop support for *adding* legacy bridges
authorRafał Miłecki <rafal@milecki.pl>
Sun, 16 May 2021 15:33:39 +0000 (17:33 +0200)
committerRafał Miłecki <rafal@milecki.pl>
Tue, 18 May 2021 10:38:26 +0000 (12:38 +0200)
The old way of defining bridge (L2) as part of interface (L3) is
deprecated. Don't support *adding* interfaces like that.

Support for *editing* legacy bridges is kept for now for compatibility
with existing legacy setups.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
modules/luci-mod-network/htdocs/luci-static/resources/view/network/interfaces.js

index 580f2885dd8d88ecbe5e6a35212f09848384b6a7..5cc85eadb300494817501b7886b7bed0e2e34fee 100644 (file)
@@ -831,7 +831,7 @@ return view.extend({
                        var m2 = new form.Map('network'),
                            s2 = m2.section(form.NamedSection, '_new_'),
                            protocols = network.getProtocols(),
-                           proto, name, bridge, ifname_single, ifname_multi;
+                           proto, name, ifname;
 
                        protocols.sort(function(a, b) {
                                return a.getProtocol() > b.getProtocol();
@@ -861,33 +861,15 @@ return view.extend({
                                return true;
                        };
 
+                       ifname = s2.option(widgets.DeviceSelect, 'ifname', _('Device'));
+                       ifname.noaliases = false;
+                       ifname.optional = false;
+
                        proto = s2.option(form.ListValue, 'proto', _('Protocol'));
                        proto.validate = name.validate;
 
-                       bridge = s2.option(form.Flag, 'type', _('Bridge interfaces'), _('Creates a bridge over specified interface(s)'));
-                       bridge.modalonly = true;
-                       bridge.disabled = '';
-                       bridge.enabled = 'bridge';
-
-                       ifname_single = s2.option(widgets.DeviceSelect, 'ifname_single', _('Interface'));
-                       ifname_single.noaliases = false;
-                       ifname_single.optional = false;
-
-                       ifname_multi = s2.option(widgets.DeviceSelect, 'ifname_multi', _('Interface'));
-                       ifname_multi.nobridges = true;
-                       ifname_multi.noaliases = true;
-                       ifname_multi.multiple = true;
-                       ifname_multi.optional = true;
-                       ifname_multi.display_size = 6;
-
                        for (var i = 0; i < protocols.length; i++) {
                                proto.value(protocols[i].getProtocol(), protocols[i].getI18n());
-
-                               if (!protocols[i].isVirtual()) {
-                                       bridge.depends({ proto: protocols[i].getProtocol() });
-                                       ifname_single.depends({ type: '', proto: protocols[i].getProtocol() });
-                                       ifname_multi.depends({ type: 'bridge', proto: protocols[i].getProtocol() });
-                               }
                        }
 
                        m2.render().then(L.bind(function(nodes) {
@@ -920,16 +902,7 @@ return view.extend({
                                                                                var section_id = uci.add('network', 'interface', nameval);
 
                                                                                protoclass.set('proto', protoval);
-
-                                                                               if (ifname_single.isActive('_new_')) {
-                                                                                       protoclass.addDevice(ifname_single.formvalue('_new_'));
-                                                                               }
-                                                                               else if (ifname_multi.isActive('_new_')) {
-                                                                                       protoclass.set('type', 'bridge');
-                                                                                       L.toArray(ifname_multi.formvalue('_new_')).map(function(dev) {
-                                                                                               protoclass.addDevice(dev);
-                                                                                       });
-                                                                               }
+                                                                               protoclass.addDevice(ifname.formvalue('_new_'));
 
                                                                                m.children[0].addedSection = section_id;
                                                                        }).then(L.bind(m.children[0].renderMoreOptionsModal, m.children[0], nameval));