diff options
author | Jo-Philipp Wich <jo@mein.io> | 2021-09-22 13:00:00 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-22 13:00:00 +0200 |
commit | b5464a3e6018dc38f87ba3ba52d5285f368f28c4 (patch) | |
tree | 268f2871c664580ddda853f8da7ec21c9f22a2f4 | |
parent | af4352c07ef33ebb06a0c7f684f3f753b9c23f4f (diff) | |
parent | 085c4a08f5bf50919731304a962cfcd2b592d523 (diff) |
Merge pull request #5374 from Ansuel/fix-wifi
luci-mod-status: some improvement to wifi status
-rw-r--r-- | modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/60_wifi.js | 33 |
1 files changed, 14 insertions, 19 deletions
diff --git a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/60_wifi.js b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/60_wifi.js index 7cb3e78e7a..333884449f 100644 --- a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/60_wifi.js +++ b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/60_wifi.js @@ -48,21 +48,18 @@ return baseclass.extend({ ev.currentTarget.disabled = true; ev.currentTarget.blur(); - if (exec == 'addlist') { - var macs = [ mac ] + /* Disconnect client before adding to maclist */ + wifinet.disconnectClient(mac, true, 5, 60000); - for (var mac in this.iface_maclist) { - macs.push(mac) - } + if (exec == 'addlist') { + wifinet.maclist.push(mac); - uci.set('wireless', wifinet.sid, 'maclist', macs); + uci.set('wireless', wifinet.sid, 'maclist', wifinet.maclist); return uci.save() .then(L.bind(L.ui.changes.init, L.ui.changes)) .then(L.bind(L.ui.changes.displayChanges, L.ui.changes)); } - - wifinet.disconnectClient(mac, true, 5, 60000); }, handleGetWPSStatus: function(wifinet) { @@ -121,7 +118,7 @@ return baseclass.extend({ var WPS_button = null; - if (this.isWPSEnabled[net.sid]) { + if (net.isWPSEnabled) { if (net.wps_status == 'Active') { WPS_button = E('button', { 'class' : 'cbi-button cbi-button-remove', @@ -190,7 +187,7 @@ return baseclass.extend({ }, this, radios_networks_hints[i]))); if (hasWPS && uci.get('wireless', radios_networks_hints[i].sid, 'wps_pushbutton') == '1') { - this.isWPSEnabled[radios_networks_hints[i].sid] = true; + radios_networks_hints[i].isWPSEnabled = true; tasks.push(L.resolveDefault(this.handleGetWPSStatus(radios_networks_hints[i].getIfname()), null) .then(L.bind(function(net, data) { net.wps_status = data ? data.pbc_status : _('No Data'); @@ -204,8 +201,6 @@ return baseclass.extend({ }, this)); }, - isDeviceAdded: {}, - render: function(data) { var seen = {}, radios = data[0], @@ -236,14 +231,14 @@ return baseclass.extend({ var rows = []; for (var i = 0; i < networks.length; i++) { - var macfilter = uci.get('wireless', networks[i].sid, 'macfilter'); + var macfilter = uci.get('wireless', networks[i].sid, 'macfilter'), + maclist = {}; if (macfilter != null && macfilter != 'disable') { - this.isDeviceAdded = {}; - var macs = L.toArray(uci.get('wireless', networks[i].sid, 'maclist')); - for (var j = 0; j < macs.length; j++) { - var mac = macs[j].toUpperCase(); - this.isDeviceAdded[mac] = true; + networks[i].maclist = L.toArray(uci.get('wireless', networks[i].sid, 'maclist')); + for (var j = 0; j < networks[i].maclist.length; j++) { + var mac = networks[i].maclist[j].toUpperCase(); + maclist[mac] = true; } } @@ -326,7 +321,7 @@ return baseclass.extend({ if (assoclist.firstElementChild.childNodes.length < 6) assoclist.firstElementChild.appendChild(E('th', { 'class': 'th cbi-section-actions' })); - if (macfilter != null && macfilter != 'disable' && !this.isDeviceAdded[bss.mac]) { + if (macfilter != null && macfilter != 'disable' && !maclist[bss.mac]) { row.push(new L.ui.ComboButton('button', { 'addlist': macfilter == 'allow' ? _('Add to Whitelist') : _('Add to Blacklist'), 'disconnect': _('Disconnect') |