1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-02-15 03:51:51 +00:00
openmptcprouter-feeds/luci-base/luasrc/view/lease_status.htm

103 lines
2.5 KiB
HTML
Raw Normal View History

2018-01-23 14:36:03 +00:00
<script type="text/javascript">//<![CDATA[
2019-05-28 19:51:29 +00:00
XHR.poll(-1, '<%=url('admin/dhcplease_status')%>', null,
2018-01-23 14:36:03 +00:00
function(x, st)
{
var tb = document.getElementById('lease_status_table');
if (st && st[0] && tb)
{
var rows = [];
2018-01-23 14:36:03 +00:00
2018-05-31 13:44:12 +00:00
for (var i = 0; i < st[0].length; i++)
2018-01-23 14:36:03 +00:00
{
var timestr;
if (st[0][i].expires === false)
timestr = '<em><%:unlimited%></em>';
else if (st[0][i].expires <= 0)
timestr = '<em><%:expired%></em>';
else
timestr = String.format('%t', st[0][i].expires);
rows.push([
st[0][i].hostname || '?',
st[0][i].ipaddr,
st[0][i].macaddr,
timestr
]);
2018-01-23 14:36:03 +00:00
}
cbi_update_table(tb, rows, '<em><%:There are no active leases.%></em>');
2018-01-23 14:36:03 +00:00
}
var tb6 = document.getElementById('lease6_status_table');
if (st && st[1] && tb6)
{
tb6.parentNode.style.display = 'block';
var rows = [];
2018-01-23 14:36:03 +00:00
2018-05-31 13:44:12 +00:00
for (var i = 0; i < st[1].length; i++)
2018-01-23 14:36:03 +00:00
{
var timestr;
if (st[1][i].expires === false)
timestr = '<em><%:unlimited%></em>';
else if (st[1][i].expires <= 0)
timestr = '<em><%:expired%></em>';
else
timestr = String.format('%t', st[1][i].expires);
var name = st[1][i].hostname,
hint = st[1][i].host_hint;
2018-05-31 13:44:12 +00:00
rows.push([
hint ? '%h (%h)'.format(name || '?', hint) : (name || '?'),
st[1][i].ip6addr,
st[1][i].duid,
timestr
]);
2018-01-23 14:36:03 +00:00
}
cbi_update_table(tb6, rows, '<em><%:There are no active leases.%></em>');
2018-01-23 14:36:03 +00:00
}
}
);
//]]></script>
<div class="cbi-section">
<h3><%:Active DHCP Leases%></h3>
<div class="table" id="lease_status_table">
<div class="tr table-titles">
<div class="th"><%:Hostname%></div>
<div class="th"><%:IPv4-Address%></div>
<div class="th"><%:MAC-Address%></div>
<div class="th"><%:Leasetime remaining%></div>
2018-05-31 13:44:12 +00:00
</div>
<div class="tr placeholder">
<div class="td"><em><%:Collecting data...%></em></div>
2018-05-31 13:44:12 +00:00
</div>
</div>
</div>
2019-07-12 16:27:38 +00:00
<%
local fs = require "nixio.fs"
local has_ipv6 = fs.access("/proc/net/ipv6_route")
if has_ipv6 then
-%>
<div class="cbi-section" style="display:none">
<h3><%:Active DHCPv6 Leases%></h3>
<div class="table" id="lease6_status_table">
<div class="tr table-titles">
<div class="th"><%:Host%></div>
<div class="th"><%:IPv6-Address%></div>
<div class="th"><%:DUID%></div>
<div class="th"><%:Leasetime remaining%></div>
</div>
<div class="tr placeholder">
<div class="td"><em><%:Collecting data...%></em></div>
</div>
2018-05-31 13:44:12 +00:00
</div>
</div>
2019-07-12 16:27:38 +00:00
<% end -%>