modules/admin-full: Detect hostap Prism2/2.5/3 hardware
[project/luci.git] / modules / admin-full / luasrc / view / admin_network / lease_status.htm
1 <script type="text/javascript">//<![CDATA[
2         var stxhr = new XHR();
3         var update_status = function() {
4                 stxhr.get('<%=luci.dispatcher.build_url("admin", "network", "dhcplease_status")%>', null,
5                         function(x, st)
6                         {
7                                 var tb = document.getElementById('lease_status_table');
8                                 if (st && tb)
9                                 {
10                                         /* clear all rows */
11                                         while( tb.rows.length > 1 )
12                                                 tb.deleteRow(1);
13
14                                         for( var i = 0; i < st.length; i++ )
15                                         {
16                                                 var timestr;
17
18                                                 if (st[i].expires <= 0)
19                                                 {
20                                                         timestr = '<em><%:expired%></em>';
21                                                 }
22                                                 else
23                                                 {
24                                                         timestr = String.format('%t', st[i].expires);
25                                                 }
26
27                                                 var tr = tb.insertRow(-1);
28                                                         tr.className = 'cbi-section-table-row cbi-rowstyle-' + ((i % 2) + 1);
29
30                                                 tr.insertCell(-1).innerHTML = st[i].hostname ? st[i].hostname : '?';
31                                                 tr.insertCell(-1).innerHTML = st[i].ipaddr;
32                                                 tr.insertCell(-1).innerHTML = st[i].macaddr;
33                                                 tr.insertCell(-1).innerHTML = timestr;
34                                         }
35
36                                         if( tb.rows.length == 1 )
37                                         {
38                                                 var tr = tb.insertRow(-1);
39                                                         tr.className = 'cbi-section-table-row';
40
41                                                 var td = tr.insertCell(-1);
42                                                         td.colSpan = 4;
43                                                         td.innerHTML = '<em><br /><%:There are no active leases.%></em>';
44                                         }
45                                 }
46
47                                 window.setTimeout(update_status, 5000);
48                         }
49                 )
50         };
51
52         update_status();
53 //]]></script>
54
55 <fieldset class="cbi-section">
56         <legend><%:Active Leases%></legend>
57         <table class="cbi-section-table" id="lease_status_table">
58                 <tr class="cbi-section-table-titles">
59                         <th class="cbi-section-table-cell"><%:Hostname%></th>
60                         <th class="cbi-section-table-cell"><%:IPv4-Address%></th>
61                         <th class="cbi-section-table-cell"><%:MAC-Address%></th>
62                         <th class="cbi-section-table-cell"><%:Leasetime remaining%></th>
63                 </tr>
64                 <tr class="cbi-section-table-row">
65                         <td colspan="4"><em><br /><%:Collecting data...%></em></td>
66                 </tr>
67         </table>
68 </fieldset>