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