modules/admin-full: properly handle disabled radios in live overview
[project/luci.git] / modules / admin-full / luasrc / view / admin_network / wifi_status.htm
index 044549d..8c50843 100644 (file)
@@ -2,12 +2,12 @@
 
 <script type="text/javascript"><![CDATA[
        var iwxhr = new XHR();
-       window.setInterval(function() {
+       (function() {
                iwxhr.get('<%=luci.dispatcher.build_url("admin", "network", "wireless_status", self.ifname)%>', null,
                        function(x)
                        {
                                var iw = x.responseText ? eval('(' + x.responseText + ')') : null;
-                               if (iw)
+                               if (iw && (iw = iw[0]))
                                {
                                        var is_assoc = (iw.bssid && iw.channel);
                                        var p = (100 / iw.quality_max * iw.quality);
                                        var s = document.getElementById('<%=self.option%>-iw-signal');
                                        if (s)
                                                s.innerHTML = String.format(
-                                                       '<img src="%s" title="Signal: %d dBm / Noise: %d dBm" /><br />' +
+                                                       '<img src="%s" title="<%:Signal%>: %d dBm / <%Noise%>: %d dBm" /><br />' +
                                                        '<small>%d%%</small>', icon, iw.signal, iw.noise, p
                                                );
 
                                        var d = document.getElementById('<%=self.option%>-iw-description');
                                        if (d && is_assoc)
                                                d.innerHTML = String.format(
-                                                       '<strong><%:Mode%>:</strong> %s |' +
+                                                       '<strong><%:Mode%>:</strong> %s | ' +
                                                        '<strong><%:SSID%>:</strong> %s<br />' +
-                                                       '<strong><%:BSSID%>:</strong> %s |' +
+                                                       '<strong><%:BSSID%>:</strong> %s | ' +
                                                        '<strong><%:Encryption%>:</strong> %s<br />' +
-                                                       '<strong><%:Channel%>:</strong> %d (%.3f GHz) |' +
+                                                       '<strong><%:Channel%>:</strong> %d (%.3f GHz) | ' +
                                                        '<strong><%:Tx-Power%>:</strong> %d dBm<br />' +
-                                                       '<strong><%:Signal%>:</strong> %d dBm |' +
+                                                       '<strong><%:Signal%>:</strong> %d dBm | ' +
                                                        '<strong><%:Noise%>:</strong> %d dBm<br />' +
-                                                       '<strong><%:Bit Rate%>:</strong> %.1f MBit/s |' +
+                                                       '<strong><%:Bit Rate%>:</strong> %.1f MBit/s | ' +
                                                        '<strong><%:Country%>:</strong> %s',
                                                                iw.mode, iw.ssid, iw.bssid,
                                                                iw.encryption ? iw.encryption.description : '<%:None%>',
@@ -58,7 +58,9 @@
                                }
                        }
                )
-       }, 5000);
+
+               window.setTimeout(arguments.callee, 5000);
+       })();
 ]]></script>
 
 <table>