', hint ? '
%h (%h)
'
- .format(name || '?', hint) : (name || '?')),
- E('
%d / %d <%:dBm%>'
- .format(assoclist[j].signal, assoclist[j].noise, assoclist[j].signal - assoclist[j].noise, icon, assoclist[j].signal, assoclist[j].noise)),
- E('
', [
- E('
', wifirate(assoclist[j], true)),
- E('
'),
- E('', wifirate(assoclist[j], false))
- ])
- ]));
-
- rowstyle = (rowstyle == 1) ? 2 : 1;
- }
- }
}
- if (assoctable && assoctable.firstElementChild === assoctable.lastElementChild)
- assoctable.appendChild(E('
<%:No information available%>
'));
-
- for (var dev in devup)
+ for (var dev in radiostate)
{
var img = document.getElementById(dev + '-iw-upstate');
if (img)
- img.src = '<%=resource%>/icons/wifi' + (devup[dev] ? '' : '_disabled') + '.png';
+ img.src = '<%=resource%>/icons/wifi' + (radiostate[dev].up ? '' : '_disabled') + '.png';
+
+ var stat = document.getElementById(dev + '-iw-devinfo');
+ if (stat)
+ stat.innerHTML = String.format(
+ '<%:Channel%>: %s (%s <%:GHz%>) | ' +
+ '<%:Bitrate%>: %s <%:Mbit/s%>',
+ radiostate[dev].channel ? radiostate[dev].channel : '?',
+ radiostate[dev].frequency ? radiostate[dev].frequency : '?',
+ radiostate[dev].bitrate ? radiostate[dev].bitrate : '?'
+ );
}
}
}
@@ -428,23 +348,7 @@
<%:Associated Stations%>
-
-
-
-
<%:Interface%>
-
<%:SSID%>
-
<%:MAC-Address%>
-
<%:Host%>
-
<%:Signal%> / <%:Noise%>
-
<%:RX Rate%> / <%:TX Rate%>
-
-
-
- <%:Collecting data...%>
-
-
-
-
+ <%+admin_network/wifi_assoclist%>
<%+footer%>
diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_status/index.htm b/modules/luci-mod-admin-full/luasrc/view/admin_status/index.htm
index 7c4a5bfc98..6083a8a2c5 100644
--- a/modules/luci-mod-admin-full/luasrc/view/admin_status/index.htm
+++ b/modules/luci-mod-admin-full/luasrc/view/admin_status/index.htm
@@ -140,24 +140,6 @@
);
}
- function wifirate(bss, rx) {
- var p = rx ? 'rx_' : 'tx_',
- s = '%.1f <%:Mbit/s%>, %d<%:MHz%>'
- .format(bss[p+'rate'] / 1000, bss[p+'mhz']),
- ht = bss[p+'ht'], vht = bss[p+'vht'],
- mhz = bss[p+'mhz'], nss = bss[p+'nss'],
- mcs = bss[p+'mcs'], sgi = bss[p+'short_gi'];
-
- if (ht || vht) {
- if (vht) s += ', VHT-MCS %d'.format(mcs);
- if (nss) s += ', VHT-NSS %d'.format(nss);
- if (ht) s += ', MCS %s'.format(mcs);
- if (sgi) s += ', <%:Short GI%>';
- }
-
- return s;
- }
-
function duid2mac(duid) {
// DUID-LLT / Ethernet
if (duid.length === 28 && duid.substr(0, 8) === '00010001')
@@ -402,8 +384,6 @@
<% end %>
<% if has_wifi then %>
- var assoclist = [ ];
-
var ws = document.getElementById('wifi_status_table');
if (ws)
{
@@ -420,21 +400,6 @@
{
var net = dev.networks[nidx];
var is_assoc = (net.bssid != '00:00:00:00:00:00' && net.channel && !net.disabled);
- var num_assoc = 0;
-
- for (var bssid in net.assoclist)
- {
- var bss = net.assoclist[bssid];
-
- bss.bssid = bssid;
- bss.link = net.link;
- bss.name = net.name;
- bss.ifname = net.ifname;
- bss.radio = dev.name;
-
- assoclist.push(bss);
- num_assoc++;
- }
var icon;
if (!is_assoc)
@@ -457,7 +422,7 @@
'<%:Mode%>', net.mode,
'<%:BSSID%>', is_assoc ? (net.bssid || '-') : null,
'<%:Encryption%>', is_assoc ? net.encryption : null,
- '<%:Associations%>', is_assoc ? (num_assoc || '-') : null,
+ '<%:Associations%>', is_assoc ? (net.num_assoc || '-') : null,
null, is_assoc ? null : E('em', '<%:Wireless is disabled or not associated%>')));
}
@@ -472,63 +437,6 @@
if (!ws.lastElementChild)
ws.appendChild(E('
<%:No information available%>'));
}
-
- var ac = document.getElementById('wifi_assoc_table');
- if (ac)
- {
- var rows = [];
-
- assoclist.sort(function(a, b) {
- return (a.name == b.name)
- ? (a.bssid < b.bssid)
- : (a.name > b.name )
- ;
- });
-
- for (var i = 0; i < assoclist.length; i++)
- {
- var icon;
- var q = (-1 * (assoclist[i].noise - assoclist[i].signal)) / 5;
- if (q < 1)
- icon = "<%=resource%>/icons/signal-0.png";
- else if (q < 2)
- icon = "<%=resource%>/icons/signal-0-25.png";
- else if (q < 3)
- icon = "<%=resource%>/icons/signal-25-50.png";
- else if (q < 4)
- icon = "<%=resource%>/icons/signal-50-75.png";
- else
- icon = "<%=resource%>/icons/signal-75-100.png";
-
- var host = hosts[assoclist[i].bssid],
- name = host ? (host.name || host.ipv4 || host.ipv6) : null,
- hint = (host && host.name && (host.ipv4 || host.ipv6)) ? (host.ipv4 || host.ipv6) : null;
-
- rows.push([
- '
%h (%h)'.format(
- assoclist[i].radio,
- assoclist[i].link,
- assoclist[i].name,
- assoclist[i].ifname),
- assoclist[i].bssid,
- hint ? '%h (%h)'.format(name || '?', hint) : (name || '?'),
- '
%d / %d <%:dBm%>'.format(
- assoclist[i].signal,
- assoclist[i].noise,
- assoclist[i].signal - assoclist[i].noise,
- icon,
- assoclist[i].signal,
- assoclist[i].noise),
- E('span', {}, [
- E('span', wifirate(assoclist[i], true)),
- E('br'),
- E('span', wifirate(assoclist[i], false))
- ])
- ]);
- }
-
- cbi_update_table(ac, rows, '
<%:No information available%>');
- }
<% end %>
var e;
@@ -709,20 +617,7 @@
<%:Associated Stations%>
-
-
-
-
<%:Network%>
-
<%:MAC-Address%>
-
<%:Host%>
-
<%:Signal%> / <%:Noise%>
-
<%:RX Rate%> / <%:TX Rate%>
-
-
-
<%:Collecting data...%>
-
-
-
+ <%+admin_network/wifi_assoclist%>
<% end %>