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