summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-base/luasrc/view/lease_status.htm
diff options
context:
space:
mode:
authorDaniel F. Dickinson <cshored@thecshore.com>2018-08-03 12:36:51 -0400
committerJo-Philipp Wich <jo@mein.io>2018-09-19 20:08:19 +0200
commit58d97b5e271bc0d7507eab5b9bd2902181864e02 (patch)
tree80e250346ad33c79b3f821daf7b7d9be90d99240 /modules/luci-base/luasrc/view/lease_status.htm
parent6ec0353201435e0d0d7d32820d8ba600b4ca7b5b (diff)
modules: Split luci-mod-full
Move some common elements to luci-base, and otherwise make three packages out of status, system, and network. They were mostly separated already, but there were some shared elements between status and network that are now in luci-base. Signed-off-by: Daniel F. Dickinson <cshored@thecshore.com>
Diffstat (limited to 'modules/luci-base/luasrc/view/lease_status.htm')
-rw-r--r--modules/luci-base/luasrc/view/lease_status.htm95
1 files changed, 95 insertions, 0 deletions
diff --git a/modules/luci-base/luasrc/view/lease_status.htm b/modules/luci-base/luasrc/view/lease_status.htm
new file mode 100644
index 0000000000..15b6b6908e
--- /dev/null
+++ b/modules/luci-base/luasrc/view/lease_status.htm
@@ -0,0 +1,95 @@
+<script type="text/javascript">//<![CDATA[
+ XHR.poll(5, '<%=url('admin/dhcplease_status')%>', null,
+ function(x, st)
+ {
+ var tb = document.getElementById('lease_status_table');
+ if (st && st[0] && tb)
+ {
+ var rows = [];
+
+ for (var i = 0; i < st[0].length; i++)
+ {
+ 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
+ ]);
+ }
+
+ cbi_update_table(tb, rows, '<em><%:There are no active leases.%></em>');
+ }
+
+ var tb6 = document.getElementById('lease6_status_table');
+ if (st && st[1] && tb6)
+ {
+ tb6.parentNode.style.display = 'block';
+
+ var rows = [];
+
+ for (var i = 0; i < st[1].length; i++)
+ {
+ 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;
+
+ rows.push([
+ hint ? '%h (%h)'.format(name || '?', hint) : (name || '?'),
+ st[1][i].ip6addr,
+ st[1][i].duid,
+ timestr
+ ]);
+ }
+
+ cbi_update_table(tb6, rows, '<em><%:There are no active leases.%></em>');
+ }
+ }
+ );
+//]]></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>
+ </div>
+ <div class="tr placeholder">
+ <div class="td"><em><%:Collecting data...%></em></div>
+ </div>
+ </div>
+</div>
+
+<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>
+ </div>
+</div>