luci/applications/luci-app-ahcp/luasrc/view/ahcp_status.htm
Florian Eckert 121e7fea66 luci-app-*: use default poll interval
Replace all XHR poll time number with -1 so they will use the default
poll interval time value from "/etc/config/luci". If this is not set then
5 seconds as default is used.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2018-12-20 10:20:23 +01:00

45 lines
1.6 KiB
HTML

<script type="text/javascript">//<![CDATA[
XHR.poll(-1, '<%=url('admin/network/ahcpd/status')%>', null,
function(x, st)
{
var tb = document.getElementById('ahcpd_status_table');
var tx = document.getElementById('ahcpd_status_text');
if (st && tb && tx)
{
/* clear all rows */
while (tb.firstElementChild !== tb.lastElementChild)
tb.removeChild(tb.lastElementChild);
for (var i = 0; i < st.leases.length; i++)
{
tb.appendChild(E('<div class="tr cbi-section-table-row cbi-rowstyle-%d">'.format((i % 2) + 1), [
E('<div class="td">', st.leases[i].addr),
E('<div class="td">', '%t'.format(st.leases[i].age))
]));
}
if (tb.firstElementChild === tb.lastElementChild)
tb.appendChild(E('<div class="tr cbi-section-table-row"><div class="td"><em><br /><%:There are no active leases.%></em></div></div>'));
if (st.uid == '00:00:00:00:00:00:00:00')
tx.innerHTML = '<%:The AHCP Service is not running.%>';
else
tx.innerHTML = String.format('<%:The AHCP Service is running with ID %s.%>', st.uid);
}
}
);
//]]></script>
<fieldset class="cbi-section">
<legend><%:Active AHCP Leases%></legend>
<p id="ahcpd_status_text"></p>
<div class="table cbi-section-table" id="ahcpd_status_table">
<div class="tr cbi-section-table-titles">
<div class="th cbi-section-table-cell"><%:Address%></div>
<div class="th cbi-section-table-cell"><%:Age%></div>
</div>
<div class="tr cbi-section-table-row">
<div class="td" colspan="5"><em><br /><%:Collecting data...%></em></div>
</div>
</div>
</fieldset>