98b6592e1cff67cad22da07875ac5d73449fe25d
[project/luci.git] / modules / admin-full / luasrc / view / admin_status / index.htm
1 <%#
2 LuCI - Lua Configuration Interface
3 Copyright 2008 Steven Barth <steven@midlink.org>
4 Copyright 2008-2011 Jo-Philipp Wich <xm@subsignal.org>
5
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
9
10         http://www.apache.org/licenses/LICENSE-2.0
11
12 -%>
13
14 <%
15         require "luci.fs"
16         require "luci.tools.status"
17
18         local has_ipv6 = luci.fs.access("/proc/net/ipv6_route")
19         local has_dhcp = luci.fs.access("/etc/config/dhcp")
20         local has_wifi = luci.fs.stat("/etc/config/wireless")
21               has_wifi = has_wifi and has_wifi.size > 0
22         local _, _, memtotal, memcached, membuffers, memfree, _, swaptotal, swapcached, swapfree = luci.sys.sysinfo()
23         local has_swap
24         if swaptotal > 0 then
25                 has_swap = 1
26         end
27
28         if luci.http.formvalue("status") == "1" then
29                 local ntm = require "luci.model.network".init()
30                 local wan = ntm:get_wannet()
31                 local wan6 = ntm:get_wan6net()
32
33                 local conn_count = tonumber((
34                         luci.sys.exec("wc -l /proc/net/nf_conntrack") or
35                         luci.sys.exec("wc -l /proc/net/ip_conntrack") or
36                         ""):match("%d+")) or 0
37
38                 local conn_max = tonumber((
39                         luci.sys.exec("sysctl net.nf_conntrack_max") or
40                         luci.sys.exec("sysctl net.ipv4.netfilter.ip_conntrack_max") or
41                         ""):match("%d+")) or 4096
42
43                 local rv = {
44                         uptime     = luci.sys.uptime(),
45                         localtime  = os.date(),
46                         loadavg    = { luci.sys.loadavg() },
47                         memtotal   = memtotal,
48                         memcached  = memcached,
49                         membuffers = membuffers,
50                         memfree    = memfree,
51                         swaptotal  = swaptotal,
52                         swapcached = swapcached,
53                         swapfree   = swapfree,
54                         connmax    = conn_max,
55                         conncount  = conn_count,
56                         leases     = luci.tools.status.dhcp_leases(),
57                         leases6    = luci.tools.status.dhcp6_leases(),
58                         wifinets   = luci.tools.status.wifi_networks()
59                 }
60
61                 if wan then
62                         rv.wan = {
63                                 ipaddr  = wan:ipaddr(),
64                                 gwaddr  = wan:gwaddr(),
65                                 netmask = wan:netmask(),
66                                 dns     = wan:dnsaddrs(),
67                                 expires = wan:expires(),
68                                 uptime  = wan:uptime(),
69                                 proto   = wan:proto(),
70                                 ifname  = wan:ifname(),
71                                 link    = wan:adminlink()
72                         }
73                 end
74
75                 if wan6 then
76                         rv.wan6 = {
77                                 ip6addr = wan6:ip6addr(),
78                                 gw6addr = wan6:gw6addr(),
79                                 dns     = wan6:dns6addrs(),
80                                 uptime  = wan6:uptime(),
81                                 ifname  = wan6:ifname(),
82                                 link    = wan6:adminlink()
83                         }
84                 end
85
86                 luci.http.prepare_content("application/json")
87                 luci.http.write_json(rv)
88
89                 return
90         end
91
92         local system, model = luci.sys.sysinfo()
93 -%>
94
95 <%+header%>
96
97 <script type="text/javascript" src="<%=resource%>/cbi.js"></script>
98 <script type="text/javascript">//<![CDATA[
99         function progressbar(v, m)
100         {
101                 var vn = parseInt(v) || 0;
102                 var mn = parseInt(m) || 100;
103                 var pc = Math.floor((100 / mn) * vn);
104
105                 return String.format(
106                         '<div style="width:200px; position:relative; border:1px solid #999999">' +
107                                 '<div style="background-color:#CCCCCC; width:%d%%; height:15px">' +
108                                         '<div style="position:absolute; left:0; top:0; text-align:center; width:100%%; color:#000000">' +
109                                                 '<small>%s / %s (%d%%)</small>' +
110                                         '</div>' +
111                                 '</div>' +
112                         '</div>', pc, v, m, pc
113                 );
114         }
115
116         var wifidevs = <%=luci.http.write_json(netdevs)%>;
117         var arptable = <%=luci.http.write_json(arpcache)%>;
118
119         XHR.poll(5, '<%=REQUEST_URI%>', { status: 1 },
120                 function(x, info)
121                 {
122                         var si = document.getElementById('wan4_i');
123                         var ss = document.getElementById('wan4_s');
124                         var ifc = info.wan;
125
126                         if (ifc && ifc.ifname && ifc.proto != 'none')
127                         {
128                                 var s = String.format(
129                                         '<strong><%:Type%>: </strong>%s<br />' +
130                                         '<strong><%:Address%>: </strong>%s<br />' +
131                                         '<strong><%:Netmask%>: </strong>%s<br />' +
132                                         '<strong><%:Gateway%>: </strong>%s<br />',
133                                                 ifc.proto,
134                                                 (ifc.ipaddr) ? ifc.ipaddr : '0.0.0.0',
135                                                 (ifc.netmask && ifc.netmask != ifc.ipaddr) ? ifc.netmask : '255.255.255.255',
136                                                 (ifc.gwaddr) ? ifc.gwaddr : '0.0.0.0'
137                                 );
138
139                                 for (var i = 0; i < ifc.dns.length; i++)
140                                 {
141                                         s += String.format(
142                                                 '<strong><%:DNS%> %d: </strong>%s<br />',
143                                                 i + 1, ifc.dns[i]
144                                         );
145                                 }
146
147                                 if (ifc.expires > -1)
148                                 {
149                                         s += String.format(
150                                                 '<strong><%:Expires%>: </strong>%t<br />',
151                                                 ifc.expires
152                                         );
153                                 }
154
155                                 if (ifc.uptime > 0)
156                                 {
157                                         s += String.format(
158                                                 '<strong><%:Connected%>: </strong>%t<br />',
159                                                 ifc.uptime
160                                         );
161                                 }
162
163                                 ss.innerHTML = String.format('<small>%s</small>', s);
164                                 si.innerHTML = String.format(
165                                         '<img src="<%=resource%>/icons/ethernet.png" />' +
166                                         '<br /><small><a href="%s">%s</a></small>',
167                                                 ifc.link, ifc.ifname
168                                 );
169                         }
170                         else
171                         {
172                                 si.innerHTML = '<img src="<%=resource%>/icons/ethernet_disabled.png" /><br /><small>?</small>';
173                                 ss.innerHTML = '<em><%:Not connected%></em>';
174                         }
175
176                         <% if has_ipv6 then %>
177                         var si6 = document.getElementById('wan6_i');
178                         var ss6 = document.getElementById('wan6_s');
179                         var ifc6 = info.wan6;
180
181                         if (ifc6 && ifc6.ifname && ifc6.proto != 'none')
182                         {
183                                 var s = String.format(
184                                         '<strong><%:Address%>: </strong>%s<br />' +
185                                         '<strong><%:Gateway%>: </strong>%s<br />',
186                                                 (ifc6.ip6addr) ? ifc6.ip6addr : '::',
187                                                 (ifc6.gw6addr) ? ifc6.gw6addr : '::'
188                                 );
189
190                                 for (var i = 0; i < ifc6.dns.length; i++)
191                                 {
192                                         s += String.format(
193                                                 '<strong><%:DNS%> %d: </strong>%s<br />',
194                                                 i + 1, ifc6.dns[i]
195                                         );
196                                 }
197
198                                 if (ifc6.uptime > 0)
199                                 {
200                                         s += String.format(
201                                                 '<strong><%:Connected%>: </strong>%t<br />',
202                                                 ifc6.uptime
203                                         );
204                                 }
205
206                                 ss6.innerHTML = String.format('<small>%s</small>', s);
207                                 si6.innerHTML = String.format(
208                                         '<img src="<%=resource%>/icons/ethernet.png" />' +
209                                         '<br /><small><a href="%s">%s</a></small>',
210                                                 ifc6.link, ifc6.ifname
211                                 );
212                         }
213                         else
214                         {
215                                 si6.innerHTML = '<img src="<%=resource%>/icons/ethernet_disabled.png" /><br /><small>?</small>';
216                                 ss6.innerHTML = '<em><%:Not connected%></em>';
217                         }
218                         <% end %>
219
220                         <% if has_dhcp then %>
221                         var ls = document.getElementById('lease_status_table');
222                         if (ls)
223                         {
224                                 /* clear all rows */
225                                 while( ls.rows.length > 1 )
226                                         ls.rows[0].parentNode.deleteRow(1);
227
228                                 for( var i = 0; i < info.leases.length; i++ )
229                                 {
230                                         var timestr;
231
232                                         if (info.leases[i].expires <= 0)
233                                                 timestr = '<em><%:expired%></em>';
234                                         else
235                                                 timestr = String.format('%t', info.leases[i].expires);
236
237                                         var tr = ls.rows[0].parentNode.insertRow(-1);
238                                                 tr.className = 'cbi-section-table-row cbi-rowstyle-' + ((i % 2) + 1);
239
240                                         tr.insertCell(-1).innerHTML = info.leases[i].hostname ? info.leases[i].hostname : '?';
241                                         tr.insertCell(-1).innerHTML = info.leases[i].ipaddr;
242                                         tr.insertCell(-1).innerHTML = info.leases[i].macaddr;
243                                         tr.insertCell(-1).innerHTML = timestr;
244                                 }
245
246                                 if( ls.rows.length == 1 )
247                                 {
248                                         var tr = ls.rows[0].parentNode.insertRow(-1);
249                                                 tr.className = 'cbi-section-table-row';
250
251                                         var td = tr.insertCell(-1);
252                                                 td.colSpan = 4;
253                                                 td.innerHTML = '<em><br /><%:There are no active leases.%></em>';
254                                 }
255                         }
256
257                         var ls6 = document.getElementById('lease6_status_table');
258                         if (ls6 && info.leases6)
259                         {
260                                 ls6.parentNode.style.display = 'block';
261
262                                 /* clear all rows */
263                                 while( ls6.rows.length > 1 )
264                                         ls6.rows[0].parentNode.deleteRow(1);
265
266                                 for( var i = 0; i < info.leases6.length; i++ )
267                                 {
268                                         var timestr;
269
270                                         if (info.leases6[i].expires <= 0)
271                                                 timestr = '<em><%:expired%></em>';
272                                         else
273                                                 timestr = String.format('%t', info.leases6[i].expires);
274
275                                         var tr = ls6.rows[0].parentNode.insertRow(-1);
276                                                 tr.className = 'cbi-section-table-row cbi-rowstyle-' + ((i % 2) + 1);
277
278                                         tr.insertCell(-1).innerHTML = info.leases6[i].hostname ? info.leases6[i].hostname : '?';
279                                         tr.insertCell(-1).innerHTML = info.leases6[i].ip6addr;
280                                         tr.insertCell(-1).innerHTML = info.leases6[i].duid;
281                                         tr.insertCell(-1).innerHTML = timestr;
282                                 }
283
284                                 if( ls6.rows.length == 1 )
285                                 {
286                                         var tr = ls6.rows[0].parentNode.insertRow(-1);
287                                                 tr.className = 'cbi-section-table-row';
288
289                                         var td = tr.insertCell(-1);
290                                                 td.colSpan = 4;
291                                                 td.innerHTML = '<em><br /><%:There are no active leases.%></em>';
292                                 }
293                         }
294                         <% end %>
295
296                         <% if has_wifi then %>
297                         var assoclist = [ ];
298
299                         var ws = document.getElementById('wifi_status_table');
300                         if (ws)
301                         {
302                                 var wsbody = ws.rows[0].parentNode;
303                                 while (ws.rows.length > 0)
304                                         wsbody.deleteRow(0);
305
306                                 for (var didx = 0; didx < info.wifinets.length; didx++)
307                                 {
308                                         var dev = info.wifinets[didx];
309
310                                         var tr = wsbody.insertRow(-1);
311                                         var td;
312
313                                         td = tr.insertCell(-1);
314                                         td.width     = "33%";
315                                         td.innerHTML = dev.name;
316                                         td.style.verticalAlign = "top";
317
318                                         td = tr.insertCell(-1);
319
320                                         var s = '';
321
322                                         for (var nidx = 0; nidx < dev.networks.length; nidx++)
323                                         {
324                                                 var net = dev.networks[nidx];
325                                                 var is_assoc = (net.bssid != '00:00:00:00:00:00' && net.channel);
326
327                                                 var icon;
328                                                 if (!is_assoc)
329                                                         icon = "<%=resource%>/icons/signal-none.png";
330                                                 else if (net.quality == 0)
331                                                         icon = "<%=resource%>/icons/signal-0.png";
332                                                 else if (net.quality < 25)
333                                                         icon = "<%=resource%>/icons/signal-0-25.png";
334                                                 else if (net.quality < 50)
335                                                         icon = "<%=resource%>/icons/signal-25-50.png";
336                                                 else if (net.quality < 75)
337                                                         icon = "<%=resource%>/icons/signal-50-75.png";
338                                                 else
339                                                         icon = "<%=resource%>/icons/signal-75-100.png";
340
341                                                 s += String.format(
342                                                         '<table><tr><td style="text-align:center; width:32px; padding:3px">' +
343                                                                 '<img src="%s" title="<%:Signal%>: %d dBm / <%:Noise%>: %d dBm" />' +
344                                                                 '<br /><small>%d%%</small>' +
345                                                         '</td><td style="text-align:left; padding:3px"><small>' +
346                                                                 '<strong><%:SSID%>:</strong> <a href="%s">%h</a><br />' +
347                                                                 '<strong><%:Mode%>:</strong> %s<br />' +
348                                                                 '<strong><%:Channel%>:</strong> %d (%.3f <%:GHz%>)<br />' +
349                                                                 '<strong><%:Bitrate%>:</strong> %s <%:Mbit/s%><br />',
350                                                                 icon, net.signal, net.noise,
351                                                                 net.quality,
352                                                                 net.link, net.ssid,
353                                                                 net.mode,
354                                                                 net.channel, net.frequency,
355                                                                 net.bitrate || '?'
356                                                 );
357
358                                                 if (is_assoc)
359                                                 {
360                                                         s += String.format(
361                                                                 '<strong><%:BSSID%>:</strong> %s<br />' +
362                                                                 '<strong><%:Encryption%>:</strong> %s',
363                                                                         net.bssid,
364                                                                         net.encryption
365                                                         );
366                                                 }
367                                                 else
368                                                 {
369                                                         s += '<em><%:Wireless is disabled or not associated%></em>';
370                                                 }
371
372                                                 s += '</small></td></tr></table>';
373
374                                                 for (var bssid in net.assoclist)
375                                                 {
376                                                         assoclist.push({
377                                                                 bssid:    bssid,
378                                                                 signal:   net.assoclist[bssid].signal,
379                                                                 noise:    net.assoclist[bssid].noise,
380                                                                 rx_rate:  net.assoclist[bssid].rx_rate,
381                                                                 rx_mcs:   net.assoclist[bssid].rx_mcs,
382                                                                 rx_40mhz: net.assoclist[bssid].rx_40mhz,
383                                                                 tx_rate:  net.assoclist[bssid].tx_rate,
384                                                                 tx_mcs:   net.assoclist[bssid].tx_mcs,
385                                                                 tx_40mhz: net.assoclist[bssid].tx_40mhz,
386                                                                 link:     net.link,
387                                                                 name:     net.name
388                                                         });
389                                                 }
390                                         }
391
392                                         if (!s)
393                                                 s = '<em><%:No information available%></em>';
394
395                                         td.innerHTML = s;
396                                 }
397                         }
398
399                         var ac = document.getElementById('wifi_assoc_table');
400                         if (ac)
401                         {
402                                 /* clear all rows */
403                                 while( ac.rows.length > 1 )
404                                         ac.rows[0].parentNode.deleteRow(1);
405
406                                 assoclist.sort(function(a, b) {
407                                         return (a.name == b.name)
408                                                 ? (a.bssid < b.bssid)
409                                                 : (a.name  > b.name )
410                                         ;
411                                 });
412
413                                 for( var i = 0; i < assoclist.length; i++ )
414                                 {
415                                         var tr = ac.rows[0].parentNode.insertRow(-1);
416                                                 tr.className = 'cbi-section-table-row cbi-rowstyle-' + (1 + (i % 2));
417
418                                         var icon;
419                                         var q = (-1 * (assoclist[i].noise - assoclist[i].signal)) / 5;
420                                         if (q < 1)
421                                                 icon = "<%=resource%>/icons/signal-0.png";
422                                         else if (q < 2)
423                                                 icon = "<%=resource%>/icons/signal-0-25.png";
424                                         else if (q < 3)
425                                                 icon = "<%=resource%>/icons/signal-25-50.png";
426                                         else if (q < 4)
427                                                 icon = "<%=resource%>/icons/signal-50-75.png";
428                                         else
429                                                 icon = "<%=resource%>/icons/signal-75-100.png";
430
431                                         tr.insertCell(-1).innerHTML = String.format(
432                                                 '<img src="%s" title="<%:Signal%>: %d <%:dBm%> / <%:Noise%>: %d <%:dBm%>" />',
433                                                 icon, assoclist[i].signal, assoclist[i].noise
434                                         );
435
436                                         tr.insertCell(-1).innerHTML = assoclist[i].bssid;
437
438                                         tr.insertCell(-1).innerHTML = String.format(
439                                                 '<a href="%s">%s</a>',
440                                                         assoclist[i].link,
441                                                         '%h'.format(assoclist[i].name).nobr()
442                                         );
443
444                                         tr.insertCell(-1).innerHTML = String.format('%d <%:dBm%>', assoclist[i].signal).nobr();
445                                         tr.insertCell(-1).innerHTML = String.format('%d <%:dBm%>', assoclist[i].noise).nobr();
446
447                                         tr.insertCell(-1).innerHTML = (assoclist[i].rx_mcs > -1)
448                                                 ? String.format('%.1f <%:Mbit/s%>, MCS %d, %d<%:MHz%>', assoclist[i].rx_rate / 1000, assoclist[i].rx_mcs, assoclist[i].rx_40mhz ? 40 : 20).nobr()
449                                                 : String.format('%.1f <%:Mbit/s%>', assoclist[i].rx_rate / 1000).nobr()
450                                         ;
451
452                                         tr.insertCell(-1).innerHTML = (assoclist[i].tx_mcs > -1)
453                                                 ? String.format('%.1f <%:Mbit/s%>, MCS %d, %d<%:MHz%>', assoclist[i].tx_rate / 1000, assoclist[i].tx_mcs, assoclist[i].tx_40mhz ? 40 : 20).nobr()
454                                                 : String.format('%.1f <%:Mbit/s%>', assoclist[i].tx_rate / 1000).nobr()
455                                         ;
456                                 }
457
458                                 if (ac.rows.length == 1)
459                                 {
460                                         var tr = ac.rows[0].parentNode.insertRow(-1);
461                                                 tr.className = 'cbi-section-table-row';
462
463                                         var td = tr.insertCell(-1);
464                                                 td.colSpan = 7;
465                                                 td.innerHTML = '<br /><em><%:No information available%></em>';
466                                 }
467                         }
468                         <% end %>
469
470                         var e;
471
472                         if (e = document.getElementById('localtime'))
473                                 e.innerHTML = info.localtime;
474
475                         if (e = document.getElementById('uptime'))
476                                 e.innerHTML = String.format('%t', info.uptime);
477
478                         if (e = document.getElementById('loadavg'))
479                                 e.innerHTML = String.format('%.02f, %.02f, %.02f',
480                                         info.loadavg[0], info.loadavg[1], info.loadavg[2]);
481
482                         if (e = document.getElementById('memtotal'))
483                                 e.innerHTML = progressbar(
484                                         (info.memfree + info.membuffers + info.memcached) + " <%:kB%>",
485                                         info.memtotal + " <%:kB%>"
486                                 );
487
488                         if (e = document.getElementById('memfree'))
489                                 e.innerHTML = progressbar(
490                                         info.memfree + " <%:kB%>", info.memtotal + " <%:kB%>"
491                                 );
492
493                         if (e = document.getElementById('memcache'))
494                                 e.innerHTML = progressbar(
495                                         info.memcached + " <%:kB%>", info.memtotal + " <%:kB%>"
496                                 );
497
498                         if (e = document.getElementById('membuff'))
499                                 e.innerHTML = progressbar(
500                                         info.membuffers + " <%:kB%>", info.memtotal + " <%:kB%>"
501                                 );
502
503                         if (e = document.getElementById('swapcache'))
504                                 e.innerHTML = progressbar(
505                                         info.swapcached + " <%:kB%>", info.swaptotal + " <%:kB%>"
506                                 );
507
508                         if (e = document.getElementById('swaptotal'))
509                                 e.innerHTML = progressbar(
510                                         (info.swapfree + info.swapcached) + " <%:kB%>",
511                                         info.swaptotal + " <%:kB%>"
512                                 );
513
514                         if (e = document.getElementById('swapfree'))
515                                 e.innerHTML = progressbar(
516                                         info.swapfree + " <%:kB%>", info.swaptotal + " <%:kB%>"
517                                 );
518
519                         if (e = document.getElementById('conns'))
520                                 e.innerHTML = progressbar(info.conncount, info.connmax);
521
522                 }
523         );
524 //]]></script>
525
526 <h2><a id="content" name="content"><%:Status%></a></h2>
527
528 <fieldset class="cbi-section">
529         <legend><%:System%></legend>
530
531         <table width="100%" cellspacing="10">
532                 <tr><td width="33%"><%:Hostname%></td><td><%=luci.sys.hostname() or "?"%></td></tr>
533                 <tr><td width="33%"><%:Model%></td><td><%=pcdata(model or "?")%></td></tr>
534                 <tr><td width="33%"><%:Firmware Version%></td><td>
535                         <%=pcdata(luci.version.distname)%> <%=pcdata(luci.version.distversion)%> /
536                         <%=pcdata(luci.version.luciname)%> (<%=pcdata(luci.version.luciversion)%>)
537                 </td></tr>
538                 <tr><td width="33%"><%:Kernel Version%></td><td><%=luci.sys.exec("uname -r")%></td></tr>
539                 <tr><td width="33%"><%:Local Time%></td><td id="localtime">-</td></tr>
540                 <tr><td width="33%"><%:Uptime%></td><td id="uptime">-</td></tr>
541                 <tr><td width="33%"><%:Load Average%></td><td id="loadavg">-</td></tr>
542         </table>
543 </fieldset>
544
545 <fieldset class="cbi-section">
546         <legend><%:Memory%></legend>
547
548         <table width="100%" cellspacing="10">
549                 <tr><td width="33%"><%:Total Available%></td><td id="memtotal">-</td></tr>
550                 <tr><td width="33%"><%:Free%></td><td id="memfree">-</td></tr>
551                 <tr><td width="33%"><%:Cached%></td><td id="memcache">-</td></tr>
552                 <tr><td width="33%"><%:Buffered%></td><td id="membuff">-</td></tr>
553         </table>
554 </fieldset>
555
556 <% if has_swap then %>
557 <fieldset class="cbi-section">
558         <legend><%:Swap%></legend>
559
560         <table width="100%" cellspacing="10">
561                 <tr><td width="33%"><%:Total Available%></td><td id="swaptotal">-</td></tr>
562                 <tr><td width="33%"><%:Free%></td><td id="swapfree">-</td></tr>
563                 <tr><td width="33%"><%:Cached%></td><td id="swapcache">-</td></tr>
564         </table>
565 </fieldset>
566 <% end %>
567
568 <fieldset class="cbi-section">
569         <legend><%:Network%></legend>
570
571         <table width="100%" cellspacing="10">
572                 <tr><td width="33%" style="vertical-align:top"><%:IPv4 WAN Status%></td><td>
573                         <table><tr>
574                                 <td id="wan4_i" style="width:16px; text-align:center; padding:3px"><img src="<%=resource%>/icons/ethernet_disabled.png" /><br /><small>?</small></td>
575                                 <td id="wan4_s" style="vertical-align:middle; padding: 3px"><em><%:Collecting data...%></em></td>
576                         </tr></table>
577                 </td></tr>
578                 <% if has_ipv6 then %>
579                 <tr><td width="33%" style="vertical-align:top"><%:IPv6 WAN Status%></td><td>
580                         <table><tr>
581                                 <td id="wan6_i" style="width:16px; text-align:center; padding:3px"><img src="<%=resource%>/icons/ethernet_disabled.png" /><br /><small>?</small></td>
582                                 <td id="wan6_s" style="vertical-align:middle; padding: 3px"><em><%:Collecting data...%></em></td>
583                         </tr></table>
584                 </td></tr>
585                 <% end %>
586                 <tr><td width="33%"><%:Active Connections%></td><td id="conns">-</td></tr>
587         </table>
588 </fieldset>
589
590 <% if has_dhcp then %>
591 <fieldset class="cbi-section">
592         <legend><%:DHCP Leases%></legend>
593
594         <table class="cbi-section-table" id="lease_status_table">
595                 <tr class="cbi-section-table-titles">
596                         <th class="cbi-section-table-cell"><%:Hostname%></th>
597                         <th class="cbi-section-table-cell"><%:IPv4-Address%></th>
598                         <th class="cbi-section-table-cell"><%:MAC-Address%></th>
599                         <th class="cbi-section-table-cell"><%:Leasetime remaining%></th>
600                 </tr>
601                 <tr class="cbi-section-table-row">
602                         <td colspan="4"><em><br /><%:Collecting data...%></em></td>
603                 </tr>
604         </table>
605 </fieldset>
606
607 <fieldset class="cbi-section" style="display:none">
608         <legend><%:DHCPv6 Leases%></legend>
609
610         <table class="cbi-section-table" id="lease6_status_table">
611                 <tr class="cbi-section-table-titles">
612                         <th class="cbi-section-table-cell"><%:Hostname%></th>
613                         <th class="cbi-section-table-cell"><%:IPv6-Address%></th>
614                         <th class="cbi-section-table-cell"><%:DUID%></th>
615                         <th class="cbi-section-table-cell"><%:Leasetime remaining%></th>
616                 </tr>
617                 <tr class="cbi-section-table-row">
618                         <td colspan="4"><em><br /><%:Collecting data...%></em></td>
619                 </tr>
620         </table>
621 </fieldset>
622 <% end %>
623
624 <% if has_wifi then %>
625 <fieldset class="cbi-section">
626         <legend><%:Wireless%></legend>
627
628         <table id="wifi_status_table" width="100%" cellspacing="10">
629                 <tr><td><em><%:Collecting data...%></em></td></tr>
630         </table>
631 </fieldset>
632
633 <fieldset class="cbi-section">
634         <legend><%:Associated Stations%></legend>
635
636         <table class="cbi-section-table" id="wifi_assoc_table">
637                 <tr class="cbi-section-table-titles">
638                         <th class="cbi-section-table-cell">&#160;</th>
639                         <th class="cbi-section-table-cell"><%:MAC-Address%></th>
640                         <th class="cbi-section-table-cell"><%:Network%></th>
641                         <th class="cbi-section-table-cell"><%:Signal%></th>
642                         <th class="cbi-section-table-cell"><%:Noise%></th>
643                         <th class="cbi-section-table-cell"><%:RX Rate%></th>
644                         <th class="cbi-section-table-cell"><%:TX Rate%></th>
645                 </tr>
646                 <tr class="cbi-section-table-row">
647                         <td colspan="7"><em><br /><%:Collecting data...%></em></td>
648                 </tr>
649         </table>
650 </fieldset>
651 <% end %>
652
653 <%-
654         require "luci.util"
655         require "nixio.fs"
656
657         local plugins = nixio.fs.dir(luci.util.libpath() .. "/view/admin_status/index")
658         if plugins then
659                 local inc
660                 for inc in plugins do
661                         if inc:match("%.htm$") then
662                                 include("admin_status/index/" .. inc:gsub("%.htm$", ""))
663                         end
664                 end
665         end
666 -%>
667
668 <%+footer%>