Globally replace luci.dispatcher.build_url(...) with url(...) invocations
[project/luci.git] / modules / luci-mod-admin-full / luasrc / view / admin_network / lease_status.htm
1 <script type="text/javascript">//<![CDATA[
2         XHR.poll(5, '<%=url('admin/network/dhcplease_status')%>', null,
3                 function(x, st)
4                 {
5                         var tb = document.getElementById('lease_status_table');
6                         if (st && st[0] && tb)
7                         {
8                                 /* clear all rows */
9                                 while( tb.rows.length > 1 )
10                                         tb.deleteRow(1);
11
12                                 for( var i = 0; i < st[0].length; i++ )
13                                 {
14                                         var timestr;
15
16                                         if (st[0][i].expires <= 0)
17                                         {
18                                                 timestr = '<em><%:expired%></em>';
19                                         }
20                                         else
21                                         {
22                                                 timestr = String.format('%t', st[0][i].expires);
23                                         }
24
25                                         var tr = tb.insertRow(-1);
26                                                 tr.className = 'cbi-section-table-row cbi-rowstyle-' + ((i % 2) + 1);
27
28                                         tr.insertCell(-1).innerHTML = st[0][i].hostname ? st[0][i].hostname : '?';
29                                         tr.insertCell(-1).innerHTML = st[0][i].ipaddr;
30                                         tr.insertCell(-1).innerHTML = st[0][i].macaddr;
31                                         tr.insertCell(-1).innerHTML = timestr;
32                                 }
33
34                                 if( tb.rows.length == 1 )
35                                 {
36                                         var tr = tb.insertRow(-1);
37                                                 tr.className = 'cbi-section-table-row';
38
39                                         var td = tr.insertCell(-1);
40                                                 td.colSpan = 4;
41                                                 td.innerHTML = '<em><br /><%:There are no active leases.%></em>';
42                                 }
43                         }
44
45                         var tb6 = document.getElementById('lease6_status_table');
46                         if (st && st[1] && tb6)
47                         {
48                                 tb6.parentNode.style.display = 'block';
49
50                                 /* clear all rows */
51                                 while( tb6.rows.length > 1 )
52                                         tb6.deleteRow(1);
53
54                                 for( var i = 0; i < st[1].length; i++ )
55                                 {
56                                         var timestr;
57
58                                         if (st[1][i].expires <= 0)
59                                         {
60                                                 timestr = '<em><%:expired%></em>';
61                                         }
62                                         else
63                                         {
64                                                 timestr = String.format('%t', st[1][i].expires);
65                                         }
66
67                                         var tr = tb6.insertRow(-1);
68                                                 tr.className = 'cbi-section-table-row cbi-rowstyle-' + ((i % 2) + 1);
69
70                                         tr.insertCell(-1).innerHTML = st[1][i].hostname ? st[1][i].hostname : '?';
71                                         tr.insertCell(-1).innerHTML = st[1][i].ip6addr;
72                                         tr.insertCell(-1).innerHTML = st[1][i].duid;
73                                         tr.insertCell(-1).innerHTML = timestr;
74                                 }
75
76                                 if( tb6.rows.length == 1 )
77                                 {
78                                         var tr = tb6.insertRow(-1);
79                                                 tr.className = 'cbi-section-table-row';
80
81                                         var td = tr.insertCell(-1);
82                                                 td.colSpan = 4;
83                                                 td.innerHTML = '<em><br /><%:There are no active leases.%></em>';
84                                 }
85                         }
86                 }
87         );
88 //]]></script>
89
90 <fieldset class="cbi-section">
91         <legend><%:Active DHCP Leases%></legend>
92         <table class="cbi-section-table" id="lease_status_table">
93                 <tr class="cbi-section-table-titles">
94                         <th class="cbi-section-table-cell"><%:Hostname%></th>
95                         <th class="cbi-section-table-cell"><%:IPv4-Address%></th>
96                         <th class="cbi-section-table-cell"><%:MAC-Address%></th>
97                         <th class="cbi-section-table-cell"><%:Leasetime remaining%></th>
98                 </tr>
99                 <tr class="cbi-section-table-row">
100                         <td colspan="4"><em><br /><%:Collecting data...%></em></td>
101                 </tr>
102         </table>
103 </fieldset>
104
105 <fieldset class="cbi-section" style="display:none">
106         <legend><%:Active DHCPv6 Leases%></legend>
107         <table class="cbi-section-table" id="lease6_status_table">
108                 <tr class="cbi-section-table-titles">
109                         <th class="cbi-section-table-cell"><%:Hostname%></th>
110                         <th class="cbi-section-table-cell"><%:IPv6-Address%></th>
111                         <th class="cbi-section-table-cell"><%:DUID%></th>
112                         <th class="cbi-section-table-cell"><%:Leasetime remaining%></th>
113                 </tr>
114                 <tr class="cbi-section-table-row">
115                         <td colspan="4"><em><br /><%:Collecting data...%></em></td>
116                 </tr>
117         </table>
118 </fieldset>