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