diff options
author | Jo-Philipp Wich <jo@mein.io> | 2019-11-01 12:32:17 +0100 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2019-11-01 12:32:17 +0100 |
commit | b4861da8860576f2ceda20384b896288b989b52a (patch) | |
tree | 97a2228ae754d0ebe009808ca0525564800c7525 /modules/luci-mod-network/htdocs/luci-static/resources | |
parent | c360cdd1f0b03ec208eaf1f8f85893aec50c7555 (diff) |
luci-mod-network: fix disabled state in wifi settings modal
Also auto-enable the radio upon network join.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'modules/luci-mod-network/htdocs/luci-static/resources')
-rw-r--r-- | modules/luci-mod-network/htdocs/luci-static/resources/view/network/wireless.js | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/wireless.js b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/wireless.js index 847a712c30..1909f3c243 100644 --- a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/wireless.js +++ b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/wireless.js @@ -743,7 +743,8 @@ return L.view.extend({ ss.tab('general', _('General Setup')); ss.tab('advanced', _('Advanced Settings')); - var isDisabled = (radioNet.get('disabled') == '1'); + var isDisabled = (radioNet.get('disabled') == '1' || + uci.get('wireless', radioNet.getWifiDeviceName(), 'disabled') == 1); o = ss.taboption('general', form.DummyValue, '_wifistat_modal', _('Status')); o.cfgvalue = L.bind(function(radioNet) { @@ -1734,15 +1735,23 @@ return L.view.extend({ var section_id = null; return this.map.save(function() { + var wifi_sections = uci.sections('wireless', 'wifi-iface'); + if (replopt.formvalue('_new_') == '1') { - var sections = uci.sections('wireless', 'wifi-iface'); + for (var i = 0; i < wifi_sections.length; i++) + if (wifi_sections[i].device == radioDev.getName()) + uci.remove('wireless', wifi_sections[i]['.name']); + } + + if (uci.get('wireless', radioDev.getName(), 'disabled') == '1') { + for (var i = 0; i < wifi_sections.length; i++) + if (wifi_sections[i].device == radioDev.getName()) + uci.set('wireless', wifi_sections[i]['.name'], 'disabled', '1'); - for (var i = 0; i < sections.length; i++) - if (sections[i].device == radioDev.getName()) - uci.remove('wireless', sections[i]['.name']); + uci.unset('wireless', radioDev.getName(), 'disabled'); } - section_id = next_free_sid(uci.sections('wifi-iface').length); + section_id = next_free_sid(wifi_sections.length); uci.add('wireless', 'wifi-iface', section_id); uci.set('wireless', section_id, 'device', radioDev.getName()); |