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