diff options
author | Jo-Philipp Wich <jo@mein.io> | 2019-07-09 17:48:46 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2019-07-09 17:50:21 +0200 |
commit | ffdafd48009ae66c2bc97cabf4f038c120737e02 (patch) | |
tree | ecb899a6d46e91ada2801415cd2f2f7f6206dd77 /modules/luci-base/htdocs/luci-static | |
parent | e5b233f325d4e310aa67415a2557f94380a36706 (diff) |
luci-base: properly handle getWifiNetidBySid() return value
The getWifiNetidBySid() helper returns an array containing the network id
and the corresponding radio name, not just the id.
Fixes: #2846.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'modules/luci-base/htdocs/luci-static')
-rw-r--r-- | modules/luci-base/htdocs/luci-static/resources/network.js | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/modules/luci-base/htdocs/luci-static/resources/network.js b/modules/luci-base/htdocs/luci-static/resources/network.js index 19640604e4..d3d9a1cf57 100644 --- a/modules/luci-base/htdocs/luci-static/resources/network.js +++ b/modules/luci-base/htdocs/luci-static/resources/network.js @@ -966,7 +966,7 @@ Network = L.Class.extend({ radiostate = res[1]; netstate = res[2]; sid = netstate.section; - netid = getWifiNetidBySid(sid); + netid = L.toArray(getWifiNetidBySid(sid))[0]; } else { res = getWifiStateBySid(netname); @@ -976,7 +976,7 @@ Network = L.Class.extend({ radiostate = res[1]; netstate = res[2]; sid = netname; - netid = getWifiNetidBySid(sid); + netid = L.toArray(getWifiNetidBySid(sid))[0]; } else { res = getWifiNetidBySid(netname); @@ -1015,9 +1015,9 @@ Network = L.Class.extend({ uci.set('wireless', sid, key, options[key]); var radioname = existingDevice['.name'], - netid = getWifiNetidBySid(sid); + netid = getWifiNetidBySid(sid) || []; - return this.instantiateWifiNetwork(sid, radioname, _cache.wifi[radioname], netid, null, { ifname: netid }); + return this.instantiateWifiNetwork(sid, radioname, _cache.wifi[radioname], netid[0], null, { ifname: netid }); }, this)); }, @@ -1469,7 +1469,7 @@ Protocol = L.Class.extend({ ifname = getWifiNetidByNetname(this.sid); - return (ifname != null ? L.network.instantiateDevice(ifname, this) : null); + return (ifname != null ? L.network.instantiateDevice(ifname[0], this) : null); } }, @@ -1552,9 +1552,9 @@ Device = L.Class.extend({ if (wif != null) { var res = getWifiStateBySid(wif) || [], - netid = getWifiNetidBySid(wif); + netid = getWifiNetidBySid(wif) || []; - this.wif = new WifiNetwork(wif, res[0], res[1], netid, res[2], { ifname: ifname }); + this.wif = new WifiNetwork(wif, res[0], res[1], netid[0], res[2], { ifname: ifname }); this.ifname = this.wif.getIfname(); } @@ -1588,7 +1588,7 @@ Device = L.Class.extend({ }, getType: function() { - if (this.ifname.charAt(0) == '@') + if (this.ifname != null && this.ifname.charAt(0) == '@') return 'alias'; else if (this.wif != null || isWifiIfname(this.ifname)) return 'wifi'; |