diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2010-11-08 22:40:04 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2010-11-08 22:40:04 +0000 |
commit | 97e27a0bcf5eb9c388a05f73dc13867ef8703e4c (patch) | |
tree | 5742a692a60cce317bb30bcb1f807fad663127df /modules/admin-full/luasrc/view | |
parent | b9c9b7ffeb5e9670590e9dfc1a5a35caf6e11212 (diff) |
modules/admin-full: properly handle disabled radios in live overview
Diffstat (limited to 'modules/admin-full/luasrc/view')
-rw-r--r-- | modules/admin-full/luasrc/view/admin_network/wifi_overview.htm | 57 |
1 files changed, 40 insertions, 17 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 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> |