Rework LuCI build system
[project/luci.git] / modules / luci-mod-admin-full / luasrc / view / admin_network / wifi_status.htm
1 <%+cbi/valueheader%>
2
3 <script type="text/javascript">//<![CDATA[
4 XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "network", "wireless_status", self.ifname)%>', null,
5 function(x, iw)
6 {
7 if (iw && (iw = iw[0]))
8 {
9 var is_assoc = (iw.bssid && iw.bssid != '00:00:00:00:00:00' && iw.channel);
10 var p = iw.quality;
11 var q = is_assoc ? p : -1;
12
13 var icon;
14 if (q < 0)
15 icon = "<%=resource%>/icons/signal-none.png";
16 else if (q == 0)
17 icon = "<%=resource%>/icons/signal-0.png";
18 else if (q < 25)
19 icon = "<%=resource%>/icons/signal-0-25.png";
20 else if (q < 50)
21 icon = "<%=resource%>/icons/signal-25-50.png";
22 else if (q < 75)
23 icon = "<%=resource%>/icons/signal-50-75.png";
24 else
25 icon = "<%=resource%>/icons/signal-75-100.png";
26
27 var s = document.getElementById('<%=self.option%>-iw-signal');
28 if (s)
29 s.innerHTML = String.format(
30 '<img src="%s" title="<%:Signal%>: %d <%:dBm%> / <%:Noise%>: %d <%:dBm%>" /><br />' +
31 '<small>%d%%</small>', icon, iw.signal, iw.noise, p
32 );
33
34 var d = document.getElementById('<%=self.option%>-iw-description');
35 if (d && is_assoc)
36 d.innerHTML = String.format(
37 '<strong><%:Mode%>:</strong> %s | ' +
38 '<strong><%:SSID%>:</strong> %h<br />' +
39 '<strong><%:BSSID%>:</strong> %s | ' +
40 '<strong><%:Encryption%>:</strong> %s<br />' +
41 '<strong><%:Channel%>:</strong> %d (%.3f <%:GHz%>) | ' +
42 '<strong><%:Tx-Power%>:</strong> %d <%:dBm%><br />' +
43 '<strong><%:Signal%>:</strong> %d <%:dBm%> | ' +
44 '<strong><%:Noise%>:</strong> %d <%:dBm%><br />' +
45 '<strong><%:Bitrate%>:</strong> %.1f <%:Mbit/s%> | ' +
46 '<strong><%:Country%>:</strong> %s',
47 iw.mode, iw.ssid, iw.bssid,
48 iw.encryption ? iw.encryption : '<%:None%>',
49 iw.channel, iw.frequency ? iw.frequency : 0,
50 iw.txpower, iw.signal, iw.noise,
51 iw.bitrate ? iw.bitrate : 0, iw.country
52 );
53 else if (d)
54 d.innerHTML = String.format(
55 '<strong><%:SSID%>:</strong> %h | ' +
56 '<strong><%:Mode%>:</strong> %s<br />' +
57 '<em><%:Wireless is disabled or not associated%></em>',
58 iw.ssid || '?', iw.mode
59 );
60 }
61 }
62 );
63 //]]></script>
64
65 <table>
66 <tr class="cbi-section-table">
67 <td></td>
68 <td class="cbi-value-field" style="width:16px; padding:3px" id="<%=self.option%>-iw-signal">
69 <img src="<%=resource%>/icons/signal-none.png" title="<%:Not associated%>" /><br />
70 <small>0%</small>
71 </td>
72 <td class="cbi-value-field" style="vertical-align:middle; text-align:left; padding:3px" id="<%=self.option%>-iw-description">
73 <em><%:Collecting data...%></em>
74 </td>
75 </tr>
76 </table>
77
78 <%+cbi/valuefooter%>