luci-app-*: use default poll interval
[project/luci.git] / applications / luci-app-ahcp / luasrc / view / ahcp_status.htm
1 <script type="text/javascript">//<![CDATA[
2 XHR.poll(-1, '<%=url('admin/network/ahcpd/status')%>', null,
3 function(x, st)
4 {
5 var tb = document.getElementById('ahcpd_status_table');
6 var tx = document.getElementById('ahcpd_status_text');
7 if (st && tb && tx)
8 {
9 /* clear all rows */
10 while (tb.firstElementChild !== tb.lastElementChild)
11 tb.removeChild(tb.lastElementChild);
12
13 for (var i = 0; i < st.leases.length; i++)
14 {
15 tb.appendChild(E('<div class="tr cbi-section-table-row cbi-rowstyle-%d">'.format((i % 2) + 1), [
16 E('<div class="td">', st.leases[i].addr),
17 E('<div class="td">', '%t'.format(st.leases[i].age))
18 ]));
19 }
20
21 if (tb.firstElementChild === tb.lastElementChild)
22 tb.appendChild(E('<div class="tr cbi-section-table-row"><div class="td"><em><br /><%:There are no active leases.%></em></div></div>'));
23
24 if (st.uid == '00:00:00:00:00:00:00:00')
25 tx.innerHTML = '<%:The AHCP Service is not running.%>';
26 else
27 tx.innerHTML = String.format('<%:The AHCP Service is running with ID %s.%>', st.uid);
28 }
29 }
30 );
31 //]]></script>
32
33 <fieldset class="cbi-section">
34 <legend><%:Active AHCP Leases%></legend>
35 <p id="ahcpd_status_text"></p>
36 <div class="table cbi-section-table" id="ahcpd_status_table">
37 <div class="tr cbi-section-table-titles">
38 <div class="th cbi-section-table-cell"><%:Address%></div>
39 <div class="th cbi-section-table-cell"><%:Age%></div>
40 </div>
41 <div class="tr cbi-section-table-row">
42 <div class="td" colspan="5"><em><br /><%:Collecting data...%></em></div>
43 </div>
44 </div>
45 </fieldset>