1 <script type=
"text/javascript"><![CDATA[
3 var update_status = function() {
4 stxhr.get('<%=luci.dispatcher.build_url(
"admin",
"network",
"dhcplease_status")%
>', null,
7 var tb = document.getElementById('lease_status_table');
11 while( tb.rows.length
> 1 )
12 tb.rows[
1].parentNode.removeChild(tb.rows[
1]);
14 for( var i =
0; i < st.length; i++ )
18 if (st[i].expires <=
0)
20 timestr = '
<em><%:expired%
></em>';
27 var s = st[i].expires;
30 m = Math.floor(s /
60);
35 h = Math.floor(m /
60);
40 d = Math.floor(h /
24);
45 ? String.format('%dd %dh %dm %ds', d, h, m, s)
46 : String.format('%dh %dm %ds', h, m, s);
49 var tr = document.createElement('tr');
50 tr.className = 'cbi-section-table-row cbi-rowstyle-' + ((i %
2) +
1);
52 tr.innerHTML = String.format(
53 '
<td class=
"cbi-section-table-cell">%s
</td>' +
54 '
<td class=
"cbi-section-table-cell">%s
</td>' +
55 '
<td class=
"cbi-section-table-cell">%s
</td>' +
56 '
<td class=
"cbi-section-table-cell">%s
</td>',
57 st[i].hostname ? st[i].hostname : '?',
63 tb.rows[
0].parentNode.appendChild(tr);
66 if( tb.rows.length ==
1 )
68 var tr = document.createElement('tr');
69 tr.className = 'cbi-section-table-row';
70 tr.innerHTML = '
<td colspan=
"4"><em><br /><%:There are no active leases.%
></em></td>';
72 tb.rows[
0].parentNode.appendChild(tr);
76 window.setTimeout(update_status,
5000);
84 <fieldset class=
"cbi-section">
85 <legend><%:Active Leases%
></legend>
86 <table class=
"cbi-section-table" id=
"lease_status_table">
87 <tr class=
"cbi-section-table-titles">
88 <th class=
"cbi-section-table-cell"><%:Hostname%
></th>
89 <th class=
"cbi-section-table-cell"><%:IPv4-Address%
></th>
90 <th class=
"cbi-section-table-cell"><%:MAC-Address%
></th>
91 <th class=
"cbi-section-table-cell"><%:Leasetime remaining%
></th>
93 <tr class=
"cbi-section-table-row">
94 <td colspan=
"4"><em><br /><%:Collecting data...%
></em></td>