summaryrefslogtreecommitdiffhomepage
path: root/modules/admin-full
diff options
context:
space:
mode:
Diffstat (limited to 'modules/admin-full')
-rw-r--r--modules/admin-full/luasrc/controller/admin/network.lua6
-rw-r--r--modules/admin-full/luasrc/view/admin_network/wifi_overview.htm57
2 files changed, 43 insertions, 20 deletions
diff --git a/modules/admin-full/luasrc/controller/admin/network.lua b/modules/admin-full/luasrc/controller/admin/network.lua
index b9d9d845ef..b271e20d24 100644
--- a/modules/admin-full/luasrc/controller/admin/network.lua
+++ b/modules/admin-full/luasrc/controller/admin/network.lua
@@ -224,14 +224,15 @@ end
function wifi_status()
local path = luci.dispatcher.context.requestpath
+ local arp = luci.sys.net.arptable()
local rv = { }
local dev
for dev in path[#path]:gmatch("[%w%.%-]+") do
+ local j = { id = dev }
local iw = luci.sys.wifi.getiwinfo(dev)
if iw then
local f
- local j = { id = dev }
for _, f in ipairs({
"channel", "frequency", "txpower", "bitrate", "signal", "noise",
"quality", "quality_max", "mode", "ssid", "bssid", "country",
@@ -239,9 +240,8 @@ function wifi_status()
}) do
j[f] = iw[f]
end
-
- rv[#rv+1] = j
end
+ rv[#rv+1] = j
end
if #rv > 0 then
diff --git a/modules/admin-full/luasrc/view/admin_network/wifi_overview.htm b/modules/admin-full/luasrc/view/admin_network/wifi_overview.htm
index 20f0e8d6ec..218e47bb2c 100644
--- a/modules/admin-full/luasrc/view/admin_network/wifi_overview.htm
+++ b/modules/admin-full/luasrc/view/admin_network/wifi_overview.htm
@@ -109,11 +109,14 @@ $Id$
while (assoctable.rows.length > 1)
assoctable.rows[1].parentNode.removeChild(assoctable.rows[1]);
+ var devup = { };
+
for( var i = 0; i < st.length; i++ )
{
var iw = st[i];
+ var is_assoc = (iw.bssid && iw.channel);
var p = (100 / iw.quality_max * iw.quality);
- var q = (iw.bssid && iw.channel) ? p : -1;
+ var q = is_assoc ? p : -1;
var icon;
if (q < 0)
@@ -129,6 +132,9 @@ $Id$
else
icon = "<%=resource%>/icons/signal-75-100.png";
+ if (!devup[wifidevs[iw.id]])
+ devup[wifidevs[iw.id]] = is_assoc;
+
var sig = document.getElementById(iw.id + '-iw-signal');
if (sig)
sig.innerHTML = String.format(
@@ -138,24 +144,34 @@ $Id$
var info = document.getElementById(iw.id + '-iw-status');
if (info)
- info.innerHTML = String.format(
- '<strong><%:SSID%>:</strong> %s | ' +
- '<strong><%:Mode%>:</strong> %s<br />' +
- '<strong><%:BSSID%>:</strong> %s | ' +
- '<strong><%:Encryption%>:</strong> %s',
- iw.ssid, iw.mode, iw.bssid,
- iw.encryption ? iw.encryption.description : '<%:None%>'
- );
+ {
+ if (is_assoc)
+ info.innerHTML = String.format(
+ '<strong><%:SSID%>:</strong> %s | ' +
+ '<strong><%:Mode%>:</strong> %s<br />' +
+ '<strong><%:BSSID%>:</strong> %s | ' +
+ '<strong><%:Encryption%>:</strong> %s',
+ iw.ssid, iw.mode, iw.bssid,
+ iw.encryption ? iw.encryption.description : '<%:None%>'
+ );
+ else
+ info.innerHTML = '<em><%:Wireless is disabled or not associated%></em>';
+ }
var dev = document.getElementById(wifidevs[iw.id] + '-iw-devinfo');
if (dev)
- dev.innerHTML = String.format(
- '<strong><%:Channel%>:</strong> %s (%s GHz) | ' +
- '<strong><%:Bitrate%>:</strong> %s Mb/s',
- iw.channel ? iw.channel : '?',
- iw.frequency ? iw.frequency / 1000 : '?',
- iw.bitrate ? iw.bitrate / 1000 : '?'
- );
+ {
+ if (is_assoc)
+ dev.innerHTML = String.format(
+ '<strong><%:Channel%>:</strong> %s (%s GHz) | ' +
+ '<strong><%:Bitrate%>:</strong> %s Mb/s',
+ iw.channel ? iw.channel : '?',
+ iw.frequency ? iw.frequency / 1000 : '?',
+ iw.bitrate ? iw.bitrate / 1000 : '?'
+ );
+ else
+ dev.innerHTML = '';
+ }
if (assoctable)
{
@@ -218,6 +234,13 @@ $Id$
assoctable.rows[0].parentNode.appendChild(tr);
}
+
+ for (var dev in devup)
+ {
+ var img = document.getElementById(dev + '-iw-upstate');
+ if (img)
+ img.src = '<%=resource%>/icons/wifi' + (devup[dev] ? '' : '_disabled') + '.png';
+ }
}
}
)
@@ -236,7 +259,7 @@ $Id$
<table class="cbi-section-table" style="margin:10px; empty-cells:hide">
<!-- physical device -->
<tr>
- <td style="width:34px"><img src="<%=resource%>/icons/wifi<%=dev:is_up() and "" or "_disabled"%>.png" style="float:left; margin-right:10px" /></td>
+ <td style="width:34px"><img src="<%=resource%>/icons/wifi_disabled.png" style="float:left; margin-right:10px" id="<%=dev:name()%>-iw-upstate" /></td>
<td colspan="2" style="text-align:left">
<big><strong><%=guess_wifi_hw(dev:name())%> (<%=dev:name()%>)</strong></big><br />
<span id="<%=dev:name()%>-iw-devinfo"></span>