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