From: Erik Karlsson Date: Wed, 8 Jan 2025 12:00:57 +0000 (+0100) Subject: luci-mod-network: handle default protocol for UCI interfaces X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=070b2e57c6a54c698143012b3caaeb2210b10286;p=project%2Fluci.git luci-mod-network: handle default protocol for UCI interfaces The protocol defaults to 'none' in netifd if unspecified. Some previously unused and some now redundant code is also removed. Signed-off-by: Erik Karlsson --- diff --git a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/interfaces.js b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/interfaces.js index 8652e44c58..c7493fadb6 100644 --- a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/interfaces.js +++ b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/interfaces.js @@ -515,13 +515,9 @@ return view.extend({ }; s.addModalOptions = function(s) { - var protoval = uci.get('network', s.section, 'proto'), - protoclass = protoval ? network.getProtocol(protoval) : null, + var protoval = uci.get('network', s.section, 'proto') || 'none', o, proto_select, proto_switch, type, stp, igmp, ss, so; - if (!protoval) - return; - return network.getNetwork(s.section).then(L.bind(function(ifc) { var protocols = network.getProtocols(); @@ -544,6 +540,7 @@ return view.extend({ proto_select = s.taboption('general', form.ListValue, 'proto', _('Protocol')); proto_select.modalonly = true; + proto_select.default = 'none'; proto_switch = s.taboption('general', form.Button, '_switch_proto'); proto_switch.modalonly = true; @@ -612,7 +609,7 @@ return view.extend({ for (var i = 0; i < protocols.length; i++) { proto_select.value(protocols[i].getProtocol(), protocols[i].getI18n()); - if (protocols[i].getProtocol() != uci.get('network', s.section, 'proto')) + if (protocols[i].getProtocol() != protoval) proto_switch.depends('proto', protocols[i].getProtocol()); }