From e75c0911a3596be125c9eed1b53271e86546f6d1 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Mon, 8 Nov 2010 21:51:24 +0000 Subject: [PATCH] modules/admin-full: live status for wifi overview page --- .../luasrc/view/admin_network/wifi_overview.htm | 221 +++++++++++++++------ .../luasrc/view/admin_network/wifi_status.htm | 2 +- 2 files changed, 162 insertions(+), 61 deletions(-) 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 9f0354cb8..20f0e8d6e 100644 --- a/modules/admin-full/luasrc/view/admin_network/wifi_overview.htm +++ b/modules/admin-full/luasrc/view/admin_network/wifi_overview.htm @@ -72,33 +72,160 @@ $Id$ end end - function guess_wifi_signal(scale) - local icon - - if scale < 0 then - icon = resource .. "/icons/signal-none.png" - elseif scale < 1 then - icon = resource .. "/icons/signal-0.png" - elseif scale < 2 then - icon = resource .. "/icons/signal-0-25.png" - elseif scale < 3 then - icon = resource .. "/icons/signal-25-50.png" - elseif scale < 4 then - icon = resource .. "/icons/signal-50-75.png" - else - icon = resource .. "/icons/signal-75-100.png" - end - - return icon - end - local devices = ntm:get_wifidevs() local arpcache = { } - sys.net.arptable(function(e) arpcache[e["HW address"]] = e["IP address"] end) + sys.net.arptable(function(e) arpcache[e["HW address"]:upper()] = e["IP address"] end) + + local netlist = { } + local netdevs = { } + + local dev + for _, dev in ipairs(devices) do + local net + for _, net in ipairs(dev:get_wifinets()) do + netlist[#netlist+1] = net:ifname() + netdevs[net:ifname()] = dev:name() + end + end -%> <%+header%> + + +

<%:Wireless Overview%>

@@ -112,10 +239,7 @@ $Id$ .png" style="float:left; margin-right:10px" /> <%=guess_wifi_hw(dev:name())%> (<%=dev:name()%>)
- <% if nets[1] then %> - Channel: <%=nets[1]:channel() or "?"%> (<%=nets[1]:frequency() or "?"%> GHz) | - Bitrate: <%=nets[1]:bitrate() or "?"%> Mb/s - <% end %> + Find and join network @@ -129,15 +253,12 @@ $Id$ <% for i, net in ipairs(nets) do %> - -
- <%=net:signal_percent()%>% + +
+ 0% - - SSID: <%=utl.pcdata(net:active_ssid())%> | - Mode: <%=net:active_mode_i18n()%>
- BSSID: <%=net:active_bssid()%> | - Encryption: <%=net:active_encryption()%> + + <%:Collecting data...%> Edit this network @@ -160,43 +281,23 @@ $Id$ <% end %> - -

<%:Associated Stations%>

- +
- - - - - + + + + + - - <% local count = -1 %> - <% for _, dev in ipairs(devices) do local nets = dev:get_wifinets() %> - <% for _, net in ipairs(nets) do %> - <% for mac, info in utl.kspairs(net:assoclist()) do count = count + 1 %> - - - - - - - - - <% end %> - <% end %> - <% end %> - <% if count < 0 then %> - <% end %>
SSIDMACAddressSignalNoise<%:SSID%><%:MAC%><%:Address%><%:Signal%><%:Noise%>
<%=net:active_ssid()%><%=mac%><%=arpcache[mac:lower()] or "n/a"%><%=info.signal%> dBm<%=info.noise%> dBm
- No information available + <%:Collecting data...%>
diff --git a/modules/admin-full/luasrc/view/admin_network/wifi_status.htm b/modules/admin-full/luasrc/view/admin_network/wifi_status.htm index 63bd26147..8c50843ad 100644 --- a/modules/admin-full/luasrc/view/admin_network/wifi_status.htm +++ b/modules/admin-full/luasrc/view/admin_network/wifi_status.htm @@ -30,7 +30,7 @@ var s = document.getElementById('<%=self.option%>-iw-signal'); if (s) s.innerHTML = String.format( - '
' + + '
' + '%d%%', icon, iw.signal, iw.noise, p ); -- 2.11.0