diff options
author | Jo-Philipp Wich <jo@mein.io> | 2019-10-31 16:43:48 +0100 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2019-11-01 12:03:33 +0100 |
commit | 650d7f64d5b1b76d58b6c719e9efe15270468cc8 (patch) | |
tree | 9a2fb7b5148227e0c9d62ba20616852c91900799 /modules/luci-base/luasrc/view | |
parent | c85af3d7618b55c499ce4bf58e3896068bd413ae (diff) |
luci-base: remove unused Lua code
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'modules/luci-base/luasrc/view')
-rw-r--r-- | modules/luci-base/luasrc/view/lease_status.htm | 102 | ||||
-rw-r--r-- | modules/luci-base/luasrc/view/wifi_assoclist.htm | 120 |
2 files changed, 0 insertions, 222 deletions
diff --git a/modules/luci-base/luasrc/view/lease_status.htm b/modules/luci-base/luasrc/view/lease_status.htm deleted file mode 100644 index bbaf5986b..000000000 --- a/modules/luci-base/luasrc/view/lease_status.htm +++ /dev/null @@ -1,102 +0,0 @@ -<script type="text/javascript">//<![CDATA[ - XHR.poll(-1, '<%=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> - -<% - 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> - </div> - </div> -<% end -%> diff --git a/modules/luci-base/luasrc/view/wifi_assoclist.htm b/modules/luci-base/luasrc/view/wifi_assoclist.htm deleted file mode 100644 index f6f66fbbc..000000000 --- a/modules/luci-base/luasrc/view/wifi_assoclist.htm +++ /dev/null @@ -1,120 +0,0 @@ -<% - local supports_deauth = {} - - local _, v - for _, v in ipairs(luci.util.ubus()) do - local iface = v:match("^hostapd%.(.+)$") - if iface then - local funcs = luci.util.ubus(v) - if type(funcs) == "table" and funcs.del_client then - supports_deauth[iface] = true - end - end - end -%> - -<script type="text/javascript">//<![CDATA[ - var supports_deauth = <%= luci.http.write_json(supports_deauth) %>; - - function wifirate(bss, rx) { - var p = rx ? 'rx_' : 'tx_', - s = '%.1f <%:Mbit/s%>, %d<%:MHz%>' - .format(bss[p+'rate'] / 1000, bss[p+'mhz']), - ht = bss[p+'ht'], vht = bss[p+'vht'], - mhz = bss[p+'mhz'], nss = bss[p+'nss'], - mcs = bss[p+'mcs'], sgi = bss[p+'short_gi']; - - if (ht || vht) { - if (vht) s += ', VHT-MCS %d'.format(mcs); - if (nss) s += ', VHT-NSS %d'.format(nss); - if (ht) s += ', MCS %s'.format(mcs); - if (sgi) s += ', <%:Short GI%>'; - } - - return s; - } - - function handleDeauth(ev) { - (new XHR()).post('<%=url('admin/wireless_deauth')%>', { - token: '<%=token%>', - iface: ev.target.getAttribute('data-iface'), - bssid: ev.target.getAttribute('data-bssid') - }, function() { - ev.target.disabled = true; - }); - } - - XHR.poll(-1, '<%=url('admin/wireless_assoclist')%>', null, - function(x, st) - { - var tb = document.getElementById('wifi_assoclist_table'); - if (st && tb) - { - var rows = []; - - st.forEach(function(bss) { - var icon; - var q = (-1 * (bss.noise - bss.signal)) / 5; - if (q < 1) - icon = "<%=resource%>/icons/signal-0.png"; - else if (q < 2) - icon = "<%=resource%>/icons/signal-0-25.png"; - else if (q < 3) - icon = "<%=resource%>/icons/signal-25-50.png"; - else if (q < 4) - icon = "<%=resource%>/icons/signal-50-75.png"; - else - icon = "<%=resource%>/icons/signal-75-100.png"; - - rows.push([ - '<span class="ifacebadge" title="%q"><img src="<%=resource%>/icons/wifi.png" /> <a href="%s">%h</a><small> (%h)</small></span>'.format( - bss.radio, - bss.link, - bss.name, - bss.ifname), - bss.bssid, - bss.host_hint ? '%h (%h)'.format(bss.host_name || '?', bss.host_hint) : (bss.host_name || '?'), - '<span class="ifacebadge" title="<%:Signal%>: %d <%:dBm%> / <%:Noise%>: %d <%:dBm%> / <%:SNR%>: %d"><img src="%s" /> %d / %d <%:dBm%></span>'.format( - bss.signal, - bss.noise, - bss.signal - bss.noise, - icon, - bss.signal, - bss.noise), - E('span', {}, [ - E('span', wifirate(bss, true)), - E('br'), - E('span', wifirate(bss, false)) - ]), - supports_deauth[bss.ifname] ? E('input', { - type: 'button', - class: 'cbi-button cbi-button-remove', - value: '<%:Disconnect%>', - 'data-bssid': bss.bssid, - 'data-iface': bss.ifname, - click: handleDeauth - }) : '-' - ]); - }); - - cbi_update_table(tb, rows, '<em><%:No information available%></em>'); - } - } - ); -//]]></script> - -<div class="table" id="wifi_assoclist_table"> - <div class="tr table-titles"> - <div class="th nowrap"><%:Network%></div> - <div class="th hide-xs"><%:MAC-Address%></div> - <div class="th nowrap"><%:Host%></div> - <div class="th nowrap"><%:Signal%> / <%:Noise%></div> - <div class="th nowrap"><%:RX Rate%> / <%:TX Rate%></div> - <% if next(supports_deauth) then %> - <div class="th right"><%:Disconnect%></div> - <% end %> - </div> - <div class="tr placeholder"> - <div class="td"><em><%:Collecting data...%></em></div> - </div> -</div> |