diff options
author | Daniel F. Dickinson <cshored@thecshore.com> | 2018-08-03 12:36:51 -0400 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2018-09-19 20:08:19 +0200 |
commit | 58d97b5e271bc0d7507eab5b9bd2902181864e02 (patch) | |
tree | 80e250346ad33c79b3f821daf7b7d9be90d99240 /modules/luci-mod-admin-full/luasrc/view | |
parent | 6ec0353201435e0d0d7d32820d8ba600b4ca7b5b (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-mod-admin-full/luasrc/view')
27 files changed, 0 insertions, 3946 deletions
diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_network/diagnostics.htm b/modules/luci-mod-admin-full/luasrc/view/admin_network/diagnostics.htm deleted file mode 100644 index 03dd5aab29..0000000000 --- a/modules/luci-mod-admin-full/luasrc/view/admin_network/diagnostics.htm +++ /dev/null @@ -1,117 +0,0 @@ -<%# - Copyright 2010 Jo-Philipp Wich <jow@openwrt.org> - Licensed to the public under the Apache License 2.0. --%> - -<%+header%> - -<% -local fs = require "nixio.fs" -local has_ping6 = fs.access("/bin/ping6") or fs.access("/usr/bin/ping6") -local has_traceroute6 = fs.access("/bin/traceroute6") or fs.access("/usr/bin/traceroute6") - -local dns_host = luci.config.diag and luci.config.diag.dns or "dev.openwrt.org" -local ping_host = luci.config.diag and luci.config.diag.ping or "dev.openwrt.org" -local route_host = luci.config.diag and luci.config.diag.route or "dev.openwrt.org" -%> - -<script type="text/javascript">//<![CDATA[ - var stxhr = new XHR(); - - function update_status(field, proto) - { - var tool = field.name; - var addr = field.value; - var protocol = proto ? "6" : ""; - - var legend = document.getElementById('diag-rc-legend'); - var output = document.getElementById('diag-rc-output'); - - if (legend && output) - { - output.innerHTML = - '<img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle" /> ' + - '<%:Waiting for command to complete...%>' - ; - - legend.parentNode.style.display = 'block'; - legend.style.display = 'inline'; - - stxhr.post('<%=url('admin/network')%>/diag_' + tool + protocol + '/' + addr, { token: '<%=token%>' }, - function(x) - { - if (x.responseText) - { - legend.style.display = 'none'; - output.innerHTML = String.format('<pre>%h</pre>', x.responseText); - } - else - { - legend.style.display = 'none'; - output.innerHTML = '<span class="error"><%:Bad address specified!%></span>'; - } - } - ); - } - } -//]]></script> - -<form method="post" action="<%=url('admin/network/diagnostics')%>"> - <div class="cbi-map"> - <h2 name="content"><%:Diagnostics%></h2> - - <div class="cbi-section"> - <legend><%:Network Utilities%></legend> - - <div class="table"> - <div class="tr"> - <div class="td left"> - <input style="margin: 5px 0" type="text" value="<%=ping_host%>" name="ping" /><br /> - <% if has_ping6 then %> - <span> - <select name="ping_proto" style="width:auto"> - <option value="" selected="selected"><%:IPv4%></option> - <option value="6"><%:IPv6%></option> - </select> - </span> - <input type="button" value="<%:Ping%>" class="cbi-button cbi-button-apply" onclick="update_status(this.form.ping, this.form.ping_proto.selectedIndex)" /> - <% else %> - <input type="button" value="<%:Ping%>" class="cbi-button cbi-button-apply" onclick="update_status(this.form.ping)" /> - <% end %> - </div> - - <div class="td left"> - <input style="margin: 5px 0" type="text" value="<%=route_host%>" name="traceroute" /><br /> - <% if has_traceroute6 then %> - <span> - <select name="traceroute_proto" style="width:auto"> - <option value="" selected="selected"><%:IPv4%></option> - <option value="6"><%:IPv6%></option> - </select> - </span> - <input type="button" value="<%:Traceroute%>" class="cbi-button cbi-button-apply" onclick="update_status(this.form.traceroute, this.form.traceroute_proto.selectedIndex)" /> - <% else %> - <input type="button" value="<%:Traceroute%>" class="cbi-button cbi-button-apply" onclick="update_status(this.form.traceroute)" /> - <% end %> - <% if not has_traceroute6 then %> - <p> </p> - <p><%:Install iputils-traceroute6 for IPv6 traceroute%></p> - <% end %> - </div> - - <div class="td left"> - <input style="margin: 5px 0" type="text" value="<%=dns_host%>" name="nslookup" /><br /> - <input type="button" value="<%:Nslookup%>" class="cbi-button cbi-button-apply" onclick="update_status(this.form.nslookup)" /> - </div> - </div> - </div> - </div> - </div> - - <div class="cbi-section" style="display:none"> - <strong id="diag-rc-legend"></strong> - <span id="diag-rc-output"></span> - </div> -</form> - -<%+footer%> diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_network/iface_overview_status.htm b/modules/luci-mod-admin-full/luasrc/view/admin_network/iface_overview_status.htm deleted file mode 100644 index 7427154a04..0000000000 --- a/modules/luci-mod-admin-full/luasrc/view/admin_network/iface_overview_status.htm +++ /dev/null @@ -1,183 +0,0 @@ -<%# - Copyright 2010-2018 Jo-Philipp Wich <jo@mein.io> - Licensed to the public under the Apache License 2.0. --%> - -<script type="text/javascript">//<![CDATA[ - function iface_reconnect(id) { - XHR.halt(); - - var d = document.getElementById(id + '-ifc-description'); - if (d) d.innerHTML = '<em><%:Interface is reconnecting...%></em>'; - - (new XHR()).post('<%=url('admin/network/iface_reconnect')%>/' + id, - { token: '<%=token%>' }, XHR.run); - } - - function iface_delete(ev) { - if (!confirm(<%=luci.http.write_json(translate('Really delete this interface? The deletion cannot be undone! You might lose access to this device if you are connected via this interface'))%>)) { - ev.preventDefault(); - return false; - } - - ev.target.previousElementSibling.value = '1'; - return true; - } - - var networks = []; - - document.querySelectorAll('[data-network]').forEach(function(n) { - networks.push(n.getAttribute('data-network')); - }); - - function render_iface(ifc) { - return E('span', { class: 'cbi-tooltip-container' }, [ - E('img', { 'class' : 'middle', 'src': '<%=resource%>/icons/%s%s.png'.format( - ifc.is_alias ? 'alias' : ifc.type, - ifc.is_up ? '' : '_disabled') }), - E('span', { 'class': 'cbi-tooltip ifacebadge large' }, [ - E('img', { 'src': '<%=resource%>/icons/%s%s.png'.format( - ifc.type, ifc.is_up ? '' : '_disabled') }), - E('span', { 'class': 'left' }, [ - E('strong', '<%:Type%>: '), ifc.typename, E('br'), - E('strong', '<%:Device%>: '), ifc.ifname, E('br'), - E('strong', '<%:Connected%>: '), ifc.is_up ? '<%:yes%>' : '<%:no%>', E('br'), - ifc.macaddr ? E('strong', '<%:MAC%>: ') : '', - ifc.macaddr ? ifc.macaddr : '', - ifc.macaddr ? E('br') : '', - E('strong', '<%:RX%>: '), '%.2mB (%d <%:Pkts.%>)'.format(ifc.rx_bytes, ifc.rx_packets), E('br'), - E('strong', '<%:TX%>: '), '%.2mB (%d <%:Pkts.%>)'.format(ifc.tx_bytes, ifc.tx_packets) - ]) - ]) - ]); - } - - XHR.poll(5, '<%=url('admin/network/iface_status')%>/' + networks.join(','), null, - function(x, ifcs) - { - if (ifcs) - { - for (var idx = 0; idx < ifcs.length; idx++) - { - var ifc = ifcs[idx]; - var html = ''; - - var s = document.getElementById(ifc.id + '-ifc-devices'); - if (s) - { - while (s.firstChild) - s.removeChild(s.firstChild); - - s.appendChild(render_iface(ifc)); - - if (ifc.subdevices && ifc.subdevices.length) - { - var sifs = [ ' (' ]; - - for (var j = 0; j < ifc.subdevices.length; j++) - sifs.push(render_iface(ifc.subdevices[j])); - - sifs.push(')'); - - s.appendChild(E('span', {}, sifs)); - } - - s.appendChild(E('br')); - s.appendChild(E('small', {}, ifc.is_alias ? '<%:Alias of "%s"%>'.format(ifc.is_alias) : ifc.name)); - } - - var d = document.getElementById(ifc.id + '-ifc-description'); - if (d && ifc.proto && ifc.ifname) - { - var desc = null; - - if (ifc.is_dynamic) - desc = '<%:Virtual dynamic interface%>'; - else if (ifc.is_alias) - desc = '<%:Alias Interface%>'; - - if (ifc.desc) - desc = desc ? '%s (%s)'.format(desc, ifc.desc) : ifc.desc; - - html += String.format('<strong><%:Protocol%>:</strong> %h<br />', desc || '?'); - - if (ifc.is_up) - { - html += String.format('<strong><%:Uptime%>:</strong> %t<br />', ifc.uptime); - } - - - if (!ifc.is_dynamic && !ifc.is_alias) - { - if (ifc.macaddr) - html += String.format('<strong><%:MAC%>:</strong> %s<br />', ifc.macaddr); - - html += String.format( - '<strong><%:RX%>:</strong> %.2mB (%d <%:Pkts.%>)<br />' + - '<strong><%:TX%>:</strong> %.2mB (%d <%:Pkts.%>)<br />', - ifc.rx_bytes, ifc.rx_packets, - ifc.tx_bytes, ifc.tx_packets - ); - } - - if (ifc.ipaddrs && ifc.ipaddrs.length) - { - for (var i = 0; i < ifc.ipaddrs.length; i++) - html += String.format( - '<strong><%:IPv4%>:</strong> %s<br />', - ifc.ipaddrs[i] - ); - } - - if (ifc.ip6addrs && ifc.ip6addrs.length) - { - for (var i = 0; i < ifc.ip6addrs.length; i++) - html += String.format( - '<strong><%:IPv6%>:</strong> %s<br />', - ifc.ip6addrs[i] - ); - } - - if (ifc.ip6prefix) - html += String.format('<strong><%:IPv6-PD%>:</strong> %s<br />', ifc.ip6prefix); - - if (ifc.errors) - { - for (var i = 0; i < ifc.errors.length; i++) - html += String.format( - '<em class="error"><strong><%:Error%>:</strong> %h</em><br />', - ifc.errors[i] - ); - } - - d.innerHTML = html; - } - else if (d && !ifc.proto) - { - var e = document.getElementById(ifc.id + '-ifc-edit'); - if (e) - e.disabled = true; - - d.innerHTML = String.format( - '<em><%:Unsupported protocol type.%></em><br />' + - '<a href="%h"><%:Install protocol extensions...%></a>', - '<%=url("admin/system/packages")%>?query=luci-proto&display=available' - ); - } - else if (d && !ifc.ifname) - { - d.innerHTML = String.format( - '<em><%:Network without interfaces.%></em><br />' + - '<a href="<%=url("admin/network/network/%s")%>?tab.network.%s=physical"><%:Assign interfaces...%></a>', - ifc.name, ifc.name - ); - } - else if (d) - { - d.innerHTML = '<em><%:Interface not present or not connected yet.%></em>'; - } - } - } - } - ); -//]]></script> diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_network/iface_status.htm b/modules/luci-mod-admin-full/luasrc/view/admin_network/iface_status.htm deleted file mode 100644 index 34be35dd20..0000000000 --- a/modules/luci-mod-admin-full/luasrc/view/admin_network/iface_status.htm +++ /dev/null @@ -1,66 +0,0 @@ -<%+cbi/valueheader%> - -<script type="text/javascript">//<![CDATA[ - XHR.poll(5, '<%=url('admin/network/iface_status', self.network)%>', null, - function(x, ifc) - { - if (ifc && (ifc = ifc[0])) - { - var s = document.getElementById('<%=self.option%>-ifc-status'), - img = s.querySelector('img'), - info = s.querySelector('span'), - html = '<strong><%:Device%>:</strong> %h<br />'.format(ifc.ifname); - - if (ifc.ifname) - { - if (ifc.is_up) - html += String.format('<strong><%:Uptime%>:</strong> %t<br />', ifc.uptime); - - if (ifc.macaddr) - html += String.format('<strong><%:MAC%>:</strong> %s<br />', ifc.macaddr); - - html += String.format( - '<strong><%:RX%></strong>: %.2mB (%d <%:Pkts.%>)<br />' + - '<strong><%:TX%></strong>: %.2mB (%d <%:Pkts.%>)<br />', - ifc.rx_bytes, ifc.rx_packets, - ifc.tx_bytes, ifc.tx_packets - ); - - if (ifc.ipaddrs && ifc.ipaddrs.length) - for (var i = 0; i < ifc.ipaddrs.length; i++) - html += String.format( - '<strong><%:IPv4%>:</strong> %s<br />', - ifc.ipaddrs[i] - ); - - if (ifc.ip6addrs && ifc.ip6addrs.length) - for (var i = 0; i < ifc.ip6addrs.length; i++) - html += String.format( - '<strong><%:IPv6%>:</strong> %s<br />', - ifc.ip6addrs[i] - ); - - if (ifc.ip6prefix) - html += String.format('<strong><%:IPv6-PD%>:</strong> %s<br />', ifc.ip6prefix); - - info.innerHTML = html; - } - else - { - info.innerHTML = '<em><%:Interface not present or not connected yet.%></em>'; - } - - img.src = '<%=resource%>/icons/%s%s.png'.format(ifc.type, ifc.is_up ? '' : '_disabled'); - } - } - ); -//]]></script> - -<span class="ifacebadge large" id="<%=self.option%>-ifc-status"> - <img src="<%=resource%>/icons/ethernet_disabled.png" /> - <span> - <em><%:Collecting data...%></em> - </span> -</span> - -<%+cbi/valuefooter%> diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_network/lease_status.htm b/modules/luci-mod-admin-full/luasrc/view/admin_network/lease_status.htm deleted file mode 100644 index 8fbbdc9477..0000000000 --- a/modules/luci-mod-admin-full/luasrc/view/admin_network/lease_status.htm +++ /dev/null @@ -1,95 +0,0 @@ -<script type="text/javascript">//<![CDATA[ - XHR.poll(5, '<%=url('admin/network/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> diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_network/switch_status.htm b/modules/luci-mod-admin-full/luasrc/view/admin_network/switch_status.htm deleted file mode 100644 index 68f0bbc9d4..0000000000 --- a/modules/luci-mod-admin-full/luasrc/view/admin_network/switch_status.htm +++ /dev/null @@ -1,62 +0,0 @@ -<script type="text/javascript">//<![CDATA[ - var switches = [ '<%=table.concat(self.switches, "', '")%>' ], - tables = document.querySelectorAll('.cbi-section-table'); - - function add_status_row(table) { - var first_row = table.querySelector('.cbi-section-table-row'); - if (first_row.classList.contains('port-status')) - return first_row; - - var status_row = first_row.parentNode.insertBefore( - E('div', { 'class': first_row.className }), first_row); - - first_row.querySelectorAll('.td').forEach(function(td) { - status_row.appendChild(td.cloneNode(false)); - status_row.lastElementChild.removeAttribute('data-title'); - }); - - status_row.firstElementChild.innerHTML = '<%:Port status:%>'; - status_row.classList.add('port-status') ; - - return status_row; - } - - XHR.poll(5, '<%=url('admin/network/switch_status')%>/' + switches.join(','), null, - function(x, st) - { - for (var i = 0; i < switches.length; i++) - { - var ports = st[switches[i]]; - var tr = add_status_row(tables[i]); - - if (tr && ports && ports.length) - { - for (var j = 0; j < ports.length; j++) - { - var th = tr.querySelector('[data-name="%d"]'.format(j)); - - if (!th) - continue; - - if (ports[j].link) - { - th.innerHTML = String.format( - '<small><img src="<%=resource%>/icons/port_up.png" />' + - '<br />%d<%:baseT%><br />%s</small>', - ports[j].speed, ports[j].duplex - ? '<%:full-duplex%>' : '<%:half-duplex%>' - ); - } - else - { - th.innerHTML = String.format( - '<small><img src="<%=resource%>/icons/port_down.png" />' + - '<br /><%:no link%></small>' - ); - } - } - } - } - } - ); -//]]></script> diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_network/wifi_assoclist.htm b/modules/luci-mod-admin-full/luasrc/view/admin_network/wifi_assoclist.htm deleted file mode 100644 index b6f84c0607..0000000000 --- a/modules/luci-mod-admin-full/luasrc/view/admin_network/wifi_assoclist.htm +++ /dev/null @@ -1,82 +0,0 @@ -<script type="text/javascript">//<![CDATA[ - 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; - } - - XHR.poll(5, '<%=url('admin/network/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)) - ]) - ]); - }); - - 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> - </div> - <div class="tr placeholder"> - <div class="td"><em><%:Collecting data...%></em></div> - </div> -</div> diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_network/wifi_join.htm b/modules/luci-mod-admin-full/luasrc/view/admin_network/wifi_join.htm deleted file mode 100644 index 987123642f..0000000000 --- a/modules/luci-mod-admin-full/luasrc/view/admin_network/wifi_join.htm +++ /dev/null @@ -1,224 +0,0 @@ -<%# - Copyright 2009-2015 Jo-Philipp Wich <jow@openwrt.org> - Licensed to the public under the Apache License 2.0. --%> - -<%- - - local sys = require "luci.sys" - local utl = require "luci.util" - - local dev = luci.http.formvalue("device") - local iw = luci.sys.wifi.getiwinfo(dev) - - if not iw then - luci.http.redirect(luci.dispatcher.build_url("admin/network/wireless")) - return - end --%> - -<%+header%> - -<script type="text/javascript">//<![CDATA[ - var xhr = new XHR(), - poll = null; - - function format_signal(bss) { - var qval = bss.quality || 0, - qmax = bss.quality_max || 100, - scale = 100 / qmax * qval, - range = 'none'; - - if (!bss.bssid || bss.bssid == '00:00:00:00:00:00') - range = 'none'; - else if (scale < 15) - range = '0'; - else if (scale < 35) - range = '0-25'; - else if (scale < 55) - range = '25-50'; - else if (scale < 75) - range = '50-75'; - else - range = '75-100'; - - return E('span', { - class: 'ifacebadge', - title: '<%:Signal%>: %d<%:dB%> / <%:Quality%>: %d/%d'.format(bss.signal, qval, qmax) - }, [ - E('img', { src: '<%=resource%>/icons/signal-%s.png'.format(range) }), - ' %d%%'.format(scale) - ]); - } - - function format_encryption(bss) { - var enc = bss.encryption || { } - - if (enc.wep === true) - return 'WEP'; - else if (enc.wpa > 0) - return E('abbr', { - title: 'Pairwise: %h / Group: %h'.format( - enc.pair_ciphers.join(', '), - enc.group_ciphers.join(', ')) - }, - '%h - %h'.format( - (enc.wpa === 3) ? '<%:mixed WPA/WPA2%>' : (enc.wpa === 2 ? 'WPA2' : 'WPA'), - enc.auth_suites.join(', '))); - else if (enc.enabled) - return '<em><%:unknown%></em>'; - else - return '<em><%:open%></em>'; - } - - function format_actions(bss) { - var enc = bss.encryption || { }, - input = [ - E('input', { type: 'submit', class: 'cbi-button cbi-button-action important', value: '<%:Join Network%>' }), - E('input', { type: 'hidden', name: 'token', value: '<%=token%>' }), - E('input', { type: 'hidden', name: 'device', value: '<%=dev%>' }), - E('input', { type: 'hidden', name: 'join', value: bss.ssid }), - E('input', { type: 'hidden', name: 'mode', value: bss.mode }), - E('input', { type: 'hidden', name: 'bssid', value: bss.bssid }), - E('input', { type: 'hidden', name: 'channel', value: bss.channel }), - E('input', { type: 'hidden', name: 'clbridge', value: <%=iw.type == "wl" and 1 or 0%> }), - E('input', { type: 'hidden', name: 'wep', value: enc.wep ? 1 : 0 }) - ]; - - if (enc.wpa) { - input.push(E('input', { type: 'hidden', name: 'wpa_version', value: enc.wpa })); - - enc.auth_suites.forEach(function(s) { - input.push(E('input', { type: 'hidden', name: 'wpa_suites', value: s })); - }); - - enc.group_ciphers.forEach(function(s) { - input.push(E('input', { type: 'hidden', name: 'wpa_group', value: s })); - }); - - enc.pair_ciphers.forEach(function(s) { - input.push(E('input', { type: 'hidden', name: 'wpa_pairwise', value: s })); - }); - } - - return E('form', { - class: 'inline', - method: 'post', - action: '<%=url("admin/network/wireless_join")%>' - }, input); - } - - function fade(bss, content) { - if (bss.stale) - return E('span', { style: 'opacity:0.5' }, content); - else - return content; - } - - function flush() { - XHR.stop(poll); - XHR.halt(); - - scan(); - } - - function scan() { - var tbl = document.getElementById('scan_results'); - - cbi_update_table(tbl, [], '<em><img src="<%=resource%>/icons/loading.gif" class="middle" /> <%:Starting wireless scan...%></em>'); - - xhr.post('<%=url("admin/network/wireless_scan_trigger", dev)%>', { token: '<%=token%>' }, - function(s) { - if (s.status !== 200) { - cbi_update_table(tbl, [], '<em><%:Scan request failed%></em>'); - return; - } - - var count = 0; - - poll = XHR.poll(3, '<%=url("admin/network/wireless_scan_results", dev)%>', null, - function(s, results) { - if (Array.isArray(results)) { - var bss = []; - - results.sort(function(a, b) { - var diff = (b.quality - a.quality) || (a.channel - b.channel); - - if (diff) - return diff; - - if (a.ssid < b.ssid) - return -1; - else if (a.ssid > b.ssid) - return 1; - - if (a.bssid < b.bssid) - return -1; - else if (a.bssid > b.bssid) - return 1; - }).forEach(function(res) { - bss.push([ - fade(res, format_signal(res)), - fade(res, res.ssid ? '%h'.format(res.ssid) : E('em', {}, '<%:hidden%>')), - fade(res, res.channel), - fade(res, res.mode), - fade(res, res.bssid), - fade(res, format_encryption(res)), - format_actions(res) - ]); - }); - - cbi_update_table(tbl, bss, '<em><img src="<%=resource%>/icons/loading.gif" class="middle" /> <%:No scan results available yet...%>'); - } - - if (count++ >= 3) { - count = 0; - xhr.post('<%=url("admin/network/wireless_scan_trigger", dev, "1")%>', - { token: '<%=token%>' }, function() { }); - } - }); - - XHR.run(); - }); - } - - document.addEventListener('DOMContentLoaded', scan); - -//]]></script> - -<h2 name="content"><%:Join Network: Wireless Scan%></h2> - -<div class="cbi-map"> - <div class="cbi-section"> - <div class="table" id="scan_results"> - <div class="tr table-titles"> - <div class="th col-1 middle center"><%:Signal%></div> - <div class="th col-5 middle left"><%:SSID%></div> - <div class="th col-2 middle center"><%:Channel%></div> - <div class="th col-2 middle left"><%:Mode%></div> - <div class="th col-3 middle left"><%:BSSID%></div> - <div class="th col-2 middle left"><%:Encryption%></div> - <div class="th cbi-section-actions"> </div> - </div> - - <div class="tr placeholder"> - <div class="td"> - <img src="<%=resource%>/icons/loading.gif" class="middle" /> - <em><%:Collecting data...%></em> - </div> - </div> - </div> - </div> -</div> -<div class="cbi-page-actions right"> - <form class="inline" action="<%=url("admin/network/wireless")%>" method="get"> - <input class="cbi-button cbi-button-neutral" type="submit" value="<%:Back to overview%>" /> - </form> - <form class="inline" action="<%=url('admin/network/wireless_join')%>" method="post"> - <input type="hidden" name="token" value="<%=token%>" /> - <input type="hidden" name="device" value="<%=utl.pcdata(dev)%>" /> - <input type="button" class="cbi-button cbi-button-action" value="<%:Repeat scan%>" onclick="flush()" /> - </form> -</div> - -<%+footer%> diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_network/wifi_overview_status.htm b/modules/luci-mod-admin-full/luasrc/view/admin_network/wifi_overview_status.htm deleted file mode 100644 index 9730bc2c92..0000000000 --- a/modules/luci-mod-admin-full/luasrc/view/admin_network/wifi_overview_status.htm +++ /dev/null @@ -1,127 +0,0 @@ -<%# - Copyright 2008-2009 Steven Barth <steven@midlink.org> - Copyright 2008-2018 Jo-Philipp Wich <jo@mein.io> - Licensed to the public under the Apache License 2.0. --%> - -<script type="text/javascript">//<![CDATA[ - function wifi_delete(ev) { - if (!confirm(<%=luci.http.write_json(translate('Really delete this wireless network? The deletion cannot be undone! You might lose access to this device if you are connected via this network.'))%>)) { - ev.preventDefault(); - return false; - } - - ev.target.previousElementSibling.value = '1'; - return true; - } - - function wifi_restart(ev) { - XHR.halt(); - - findParent(ev.target, '.table').querySelectorAll('[data-disabled="false"]').forEach(function(s) { - s.innerHTML = '<em><%:Wireless is restarting...%></em>'; - }); - - (new XHR()).post('<%=url('admin/network/wireless_reconnect')%>/' + ev.target.getAttribute('data-radio'), - { token: '<%=token%>' }, XHR.run); - } - - var networks = [ ]; - - document.querySelectorAll('[data-network]').forEach(function(n) { - networks.push(n.getAttribute('data-network')); - }); - - XHR.poll(5, '<%=url('admin/network/wireless_status')%>/' + networks.join(','), null, - function(x, st) - { - if (st) - { - var rowstyle = 1; - var radiostate = { }; - - st.forEach(function(s) { - var r = radiostate[s.device.device] || (radiostate[s.device.device] = {}); - - s.is_assoc = (s.bssid && s.bssid != '00:00:00:00:00:00' && s.channel && s.mode != 'Unknown' && !s.disabled); - - r.up = r.up || s.is_assoc; - r.channel = r.channel || s.channel; - r.bitrate = r.bitrate || s.bitrate; - r.frequency = r.frequency || s.frequency; - }); - - for( var i = 0; i < st.length; i++ ) - { - var iw = st[i], - sig = document.getElementById(iw.id + '-iw-signal'), - info = document.getElementById(iw.id + '-iw-status'), - disabled = (info && info.getAttribute('data-disabled') === 'true'); - - var p = iw.quality; - var q = disabled ? -1 : p; - - var icon; - if (q < 0) - icon = "<%=resource%>/icons/signal-none.png"; - else if (q == 0) - icon = "<%=resource%>/icons/signal-0.png"; - else if (q < 25) - icon = "<%=resource%>/icons/signal-0-25.png"; - else if (q < 50) - icon = "<%=resource%>/icons/signal-25-50.png"; - else if (q < 75) - icon = "<%=resource%>/icons/signal-50-75.png"; - else - icon = "<%=resource%>/icons/signal-75-100.png"; - - - if (sig) - sig.innerHTML = String.format( - '<span class="ifacebadge" title="<%:Signal%>: %d <%:dBm%> / <%:Noise%>: %d <%:dBm%>"><img src="%s" /> %d%%</span>', - iw.signal, iw.noise, icon, p - ); - - if (info) - { - if (iw.is_assoc) - info.innerHTML = String.format( - '<strong><%:SSID%>:</strong> %h | ' + - '<strong><%:Mode%>:</strong> %s<br />' + - '<strong><%:BSSID%>:</strong> %s | ' + - '<strong><%:Encryption%>:</strong> %s', - iw.ssid, iw.mode, iw.bssid, - iw.encryption ? iw.encryption : '<%:None%>' - ); - else - info.innerHTML = String.format( - '<strong><%:SSID%>:</strong> %h | ' + - '<strong><%:Mode%>:</strong> %s<br />' + - '<em>%s</em>', - iw.ssid || '?', iw.mode, - disabled ? '<em><%:Wireless is disabled%></em>' - : '<em><%:Wireless is not associated%></em>' - ); - } - } - - for (var dev in radiostate) - { - var img = document.getElementById(dev + '-iw-upstate'); - if (img) - img.src = '<%=resource%>/icons/wifi' + (radiostate[dev].up ? '' : '_disabled') + '.png'; - - var stat = document.getElementById(dev + '-iw-devinfo'); - if (stat) - stat.innerHTML = String.format( - '<strong><%:Channel%>:</strong> %s (%s <%:GHz%>) | ' + - '<strong><%:Bitrate%>:</strong> %s <%:Mbit/s%>', - radiostate[dev].channel ? radiostate[dev].channel : '?', - radiostate[dev].frequency ? radiostate[dev].frequency : '?', - radiostate[dev].bitrate ? radiostate[dev].bitrate : '?' - ); - } - } - } - ); -//]]></script> diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_network/wifi_status.htm b/modules/luci-mod-admin-full/luasrc/view/admin_network/wifi_status.htm deleted file mode 100644 index bfad3d0804..0000000000 --- a/modules/luci-mod-admin-full/luasrc/view/admin_network/wifi_status.htm +++ /dev/null @@ -1,77 +0,0 @@ -<%+cbi/valueheader%> - -<script type="text/javascript">//<![CDATA[ - XHR.poll(5, '<%=url('admin/network/wireless_status', self.ifname)%>', null, - function(x, iw) - { - if (iw && (iw = iw[0])) - { - var is_assoc = (iw.bssid && iw.bssid != '00:00:00:00:00:00' && iw.channel && !iw.disabled); - var p = iw.quality; - var q = iw.disabled ? -1 : p; - - var icon; - if (q < 0) - icon = "<%=resource%>/icons/signal-none.png"; - else if (q == 0) - icon = "<%=resource%>/icons/signal-0.png"; - else if (q < 25) - icon = "<%=resource%>/icons/signal-0-25.png"; - else if (q < 50) - icon = "<%=resource%>/icons/signal-25-50.png"; - else if (q < 75) - icon = "<%=resource%>/icons/signal-50-75.png"; - else - icon = "<%=resource%>/icons/signal-75-100.png"; - - var s = document.getElementById('<%=self.option%>-iw-status'), - small = s.querySelector('small'), - info = s.querySelector('span'); - - small.innerHTML = info.innerHTML = String.format( - '<img src="%s" title="<%:Signal%>: %d <%:dBm%> / <%:Noise%>: %d <%:dBm%>" /> <br />%d%% ', - icon, iw.signal, iw.noise, p - ); - - if (is_assoc) - info.innerHTML = String.format( - '<strong><%:Mode%>:</strong> %s | ' + - '<strong><%:SSID%>:</strong> %h<br />' + - '<strong><%:BSSID%>:</strong> %s<br />' + - '<strong><%:Encryption%>:</strong> %s<br />' + - '<strong><%:Channel%>:</strong> %d (%.3f <%:GHz%>)<br />' + - '<strong><%:Tx-Power%>:</strong> %d <%:dBm%><br />' + - '<strong><%:Signal%>:</strong> %d <%:dBm%> | ' + - '<strong><%:Noise%>:</strong> %d <%:dBm%><br />' + - '<strong><%:Bitrate%>:</strong> %.1f <%:Mbit/s%> | ' + - '<strong><%:Country%>:</strong> %s', - iw.mode, iw.ssid, iw.bssid, - iw.encryption ? iw.encryption : '<%:None%>', - iw.channel, iw.frequency ? iw.frequency : 0, - iw.txpower, iw.signal, iw.noise, - iw.bitrate ? iw.bitrate : 0, iw.country - ); - else - info.innerHTML = String.format( - '<strong><%:SSID%>:</strong> %h | ' + - '<strong><%:Mode%>:</strong> %s<br />' + - '<em>%s</em>', - iw.ssid || '?', iw.mode, - iw.disabled ? '<em><%:Wireless is disabled%></em>' - : '<em><%:Wireless is not associated%></em>' - ); - } - } - ); -//]]></script> - -<span class="ifacebadge large" id="<%=self.option%>-iw-status"> - <small> - <img src="<%=resource%>/icons/signal-none.png" title="<%:Not associated%>" />  - </small> - <span> - <em><%:Collecting data...%></em> - </span> -</span> - -<%+cbi/valuefooter%> diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_status/bandwidth.htm b/modules/luci-mod-admin-full/luasrc/view/admin_status/bandwidth.htm deleted file mode 100644 index 3bb55f9054..0000000000 --- a/modules/luci-mod-admin-full/luasrc/view/admin_status/bandwidth.htm +++ /dev/null @@ -1,305 +0,0 @@ -<%# - Copyright 2010 Jo-Philipp Wich <jow@openwrt.org> - Licensed to the public under the Apache License 2.0. --%> - -<%- - local ntm = require "luci.model.network".init() - - local dev - local devices = { } - for _, dev in luci.util.vspairs(luci.sys.net.devices()) do - if dev ~= "lo" and not ntm:ignore_interface(dev) then - devices[#devices+1] = dev - end - end - - local curdev = luci.http.formvalue("dev") or devices[1] --%> - -<%+header%> - -<script type="text/javascript">//<![CDATA[ - var bwxhr = new XHR(); - - var G; - var TIME = 0; - var RXB = 1; - var RXP = 2; - var TXB = 3; - var TXP = 4; - - var width = 760; - var height = 300; - var step = 5; - - var data_wanted = Math.floor(width / step); - var data_fill = 0; - var data_stamp = 0; - - var data_rx = [ ]; - var data_tx = [ ]; - - var line_rx; - var line_tx; - - var label_25; - var label_50; - var label_75; - - var label_rx_cur; - var label_rx_avg; - var label_rx_peak; - - var label_tx_cur; - var label_tx_avg; - var label_tx_peak; - - var label_scale; - - - Math.log2 = Math.log2 || function(x) { return Math.log(x) * Math.LOG2E; }; - - function bandwidth_label(bytes, br) - { - var uby = '<%:kB/s%>'; - var kby = (bytes / 1024); - - if (kby >= 1024) - { - uby = '<%:MB/s%>'; - kby = kby / 1024; - } - - var ubi = '<%:kbit/s%>'; - var kbi = (bytes * 8 / 1024); - - if (kbi >= 1024) - { - ubi = '<%:Mbit/s%>'; - kbi = kbi / 1024; - } - - return String.format("%f %s%s(%f %s)", - kbi.toFixed(2), ubi, - br ? '<br />' : ' ', - kby.toFixed(2), uby - ); - } - - /* wait for SVG */ - window.setTimeout( - function() { - var svg = document.getElementById('bwsvg'); - - try { - G = svg.getSVGDocument - ? svg.getSVGDocument() : svg.contentDocument; - } - catch(e) { - G = document.embeds['bwsvg'].getSVGDocument(); - } - - if (!G) - { - window.setTimeout(arguments.callee, 1000); - } - else - { - /* find sizes */ - width = svg.offsetWidth - 2; - height = svg.offsetHeight - 2; - data_wanted = Math.ceil(width / step); - - /* prefill datasets */ - for (var i = 0; i < data_wanted; i++) - { - data_rx[i] = 0; - data_tx[i] = 0; - } - - /* find svg elements */ - line_rx = G.getElementById('rx'); - line_tx = G.getElementById('tx'); - - label_25 = G.getElementById('label_25'); - label_50 = G.getElementById('label_50'); - label_75 = G.getElementById('label_75'); - - label_rx_cur = document.getElementById('rx_bw_cur'); - label_rx_avg = document.getElementById('rx_bw_avg'); - label_rx_peak = document.getElementById('rx_bw_peak'); - - label_tx_cur = document.getElementById('tx_bw_cur'); - label_tx_avg = document.getElementById('tx_bw_avg'); - label_tx_peak = document.getElementById('tx_bw_peak'); - - label_scale = document.getElementById('scale'); - - - /* plot horizontal time interval lines */ - for (var i = width % (step * 60); i < width; i += step * 60) - { - var line = G.createElementNS('http://www.w3.org/2000/svg', 'line'); - line.setAttribute('x1', i); - line.setAttribute('y1', 0); - line.setAttribute('x2', i); - line.setAttribute('y2', '100%'); - line.setAttribute('style', 'stroke:black;stroke-width:0.1'); - - var text = G.createElementNS('http://www.w3.org/2000/svg', 'text'); - text.setAttribute('x', i + 5); - text.setAttribute('y', 15); - text.setAttribute('style', 'fill:#eee; font-size:9pt; font-family:sans-serif; text-shadow:1px 1px 1px #000'); - text.appendChild(G.createTextNode(Math.round((width - i) / step / 60) + 'm')); - - label_25.parentNode.appendChild(line); - label_25.parentNode.appendChild(text); - } - - label_scale.innerHTML = String.format('<%:(%d minute window, %d second interval)%>', data_wanted / 60, 3); - - /* render datasets, start update interval */ - XHR.poll(3, '<%=build_url("admin/status/realtime/bandwidth_status", curdev)%>', null, - function(x, data) - { - var data_max = 0; - var data_scale = 0; - - var data_rx_avg = 0; - var data_tx_avg = 0; - - var data_rx_peak = 0; - var data_tx_peak = 0; - - for (var i = data_stamp ? 0 : 1; i < data.length; i++) - { - /* skip overlapping entries */ - if (data[i][TIME] <= data_stamp) - continue; - - /* normalize difference against time interval */ - if (i > 0) - { - var time_delta = data[i][TIME] - data[i-1][TIME]; - if (time_delta) - { - data_rx.push((data[i][RXB] - data[i-1][RXB]) / time_delta); - data_tx.push((data[i][TXB] - data[i-1][TXB]) / time_delta); - } - } - } - - /* cut off outdated entries */ - data_rx = data_rx.slice(data_rx.length - data_wanted, data_rx.length); - data_tx = data_tx.slice(data_tx.length - data_wanted, data_tx.length); - - /* find peak */ - for (var i = 0; i < data_rx.length; i++) - { - data_max = Math.max(data_max, data_rx[i]); - data_max = Math.max(data_max, data_tx[i]); - - data_rx_peak = Math.max(data_rx_peak, data_rx[i]); - data_tx_peak = Math.max(data_tx_peak, data_tx[i]); - - data_rx_avg += data_rx[i]; - data_tx_avg += data_tx[i]; - } - - data_rx_avg = (data_rx_avg / Math.max(data_rx.length, 1)); - data_tx_avg = (data_tx_avg / Math.max(data_tx.length, 1)); - - var size = Math.floor(Math.log2(data_max)), - div = Math.pow(2, size - (size % 10)), - mult = data_max / div, - mult = (mult < 5) ? 2 : ((mult < 50) ? 10 : ((mult < 500) ? 100 : 1000)); - - data_max = data_max + (mult * div) - (data_max % (mult * div)); - - /* remember current timestamp, calculate horizontal scale */ - data_stamp = data[data.length-1][TIME]; - data_scale = height / data_max; - - /* plot data */ - var pt_rx = '0,' + height; - var pt_tx = '0,' + height; - - var y_rx = 0; - var y_tx = 0; - - for (var i = 0; i < data_rx.length; i++) - { - var x = i * step; - - y_rx = height - Math.floor(data_rx[i] * data_scale); - y_tx = height - Math.floor(data_tx[i] * data_scale); - - pt_rx += ' ' + x + ',' + y_rx; - pt_tx += ' ' + x + ',' + y_tx; - } - - pt_rx += ' ' + width + ',' + y_rx + ' ' + width + ',' + height; - pt_tx += ' ' + width + ',' + y_tx + ' ' + width + ',' + height; - - - line_rx.setAttribute('points', pt_rx); - line_tx.setAttribute('points', pt_tx); - - label_25.firstChild.data = bandwidth_label(0.25 * data_max); - label_50.firstChild.data = bandwidth_label(0.50 * data_max); - label_75.firstChild.data = bandwidth_label(0.75 * data_max); - - label_rx_cur.innerHTML = bandwidth_label(data_rx[data_rx.length-1], true); - label_tx_cur.innerHTML = bandwidth_label(data_tx[data_tx.length-1], true); - - label_rx_avg.innerHTML = bandwidth_label(data_rx_avg, true); - label_tx_avg.innerHTML = bandwidth_label(data_tx_avg, true); - - label_rx_peak.innerHTML = bandwidth_label(data_rx_peak, true); - label_tx_peak.innerHTML = bandwidth_label(data_tx_peak, true); - } - ); - - XHR.run(); - } - }, 1000 - ); -//]]></script> - -<h2 name="content"><%:Realtime Traffic%></h2> - -<ul class="cbi-tabmenu"> - <% for _, dev in ipairs(devices) do %> - <li class="cbi-tab<%= dev == curdev and "" or "-disabled" %>"><a href="?dev=<%=pcdata(dev)%>"><%=pcdata(dev)%></a></li> - <% end %> -</ul> - -<embed id="bwsvg" style="width:100%; height:300px; border:1px solid #000000; background-color:#FFFFFF" src="<%=resource%>/bandwidth.svg" /> -<div style="text-align:right"><small id="scale">-</small></div> -<br /> - -<div class="table" style="width:100%; table-layout:fixed" cellspacing="5"> - <div class="tr"> - <div class="td" style="text-align:right; vertical-align:top"><strong style="border-bottom:2px solid blue"><%:Inbound:%></strong></div> - <div class="td" id="rx_bw_cur">0 <%:kbit/s%><br />(0 <%:kB/s%>)</div> - - <div class="td" style="text-align:right; vertical-align:top"><strong><%:Average:%></strong></div> - <div class="td" id="rx_bw_avg">0 <%:kbit/s%><br />(0 <%:kB/s%>)</div> - - <div class="td" style="text-align:right; vertical-align:top"><strong><%:Peak:%></strong></div> - <div class="td" id="rx_bw_peak">0 <%:kbit/s%><br />(0 <%:kB/s%>)</div> - </div> - <div class="tr"> - <div class="td" style="text-align:right; vertical-align:top"><strong style="border-bottom:2px solid green"><%:Outbound:%></strong></div> - <div class="td" id="tx_bw_cur">0 <%:kbit/s%><br />(0 <%:kB/s%>)</div> - - <div class="td" style="text-align:right; vertical-align:top"><strong><%:Average:%></strong></div> - <div class="td" id="tx_bw_avg">0 <%:kbit/s%><br />(0 <%:kB/s%>)</div> - - <div class="td" style="text-align:right; vertical-align:top"><strong><%:Peak:%></strong></div> - <div class="td" id="tx_bw_peak">0 <%:kbit/s%><br />(0 <%:kB/s%>)</div> - </div> -</div> - -<%+footer%> diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_status/connections.htm b/modules/luci-mod-admin-full/luasrc/view/admin_status/connections.htm deleted file mode 100644 index 0a0db3be78..0000000000 --- a/modules/luci-mod-admin-full/luasrc/view/admin_status/connections.htm +++ /dev/null @@ -1,376 +0,0 @@ -<%# - Copyright 2010 Jo-Philipp Wich <jow@openwrt.org> - Licensed to the public under the Apache License 2.0. --%> - -<%+header%> - -<script type="text/javascript">//<![CDATA[ - var bwxhr = new XHR(); - - var G; - var TIME = 0; - var UDP = 1; - var TCP = 2; - var OTHER = 3; - - var width = 760; - var height = 300; - var step = 5; - - var data_wanted = Math.floor(width / step); - var data_fill = 0; - var data_stamp = 0; - - var data_udp = [ ]; - var data_tcp = [ ]; - var data_otr = [ ]; - - var line_udp; - var line_tcp; - - var label_25; - var label_50; - var label_75; - - var label_udp_cur; - var label_udp_avg; - var label_udp_peak; - - var label_tcp_cur; - var label_tcp_avg; - var label_tcp_peak; - - var label_otr_cur; - var label_otr_avg; - var label_otr_peak; - - var label_scale; - - var conn_table; - - var dns_cache = { }; - - - /* wait for SVG */ - window.setTimeout( - function() { - var svg = document.getElementById('bwsvg'); - - try { - G = svg.getSVGDocument - ? svg.getSVGDocument() : svg.contentDocument; - } - catch(e) { - G = document.embeds['bwsvg'].getSVGDocument(); - } - - if (!G) - { - window.setTimeout(arguments.callee, 1000); - } - else - { - /* find sizes */ - width = svg.offsetWidth - 2; - height = svg.offsetHeight - 2; - data_wanted = Math.ceil(width / step); - - /* prefill datasets */ - for (var i = 0; i < data_wanted; i++) - { - data_udp[i] = 0; - data_tcp[i] = 0; - data_otr[i] = 0; - } - - /* find svg elements */ - line_udp = G.getElementById('udp'); - line_tcp = G.getElementById('tcp'); - line_otr = G.getElementById('other'); - - label_25 = G.getElementById('label_25'); - label_50 = G.getElementById('label_50'); - label_75 = G.getElementById('label_75'); - - label_udp_cur = document.getElementById('lb_udp_cur'); - label_udp_avg = document.getElementById('lb_udp_avg'); - label_udp_peak = document.getElementById('lb_udp_peak'); - - label_tcp_cur = document.getElementById('lb_tcp_cur'); - label_tcp_avg = document.getElementById('lb_tcp_avg'); - label_tcp_peak = document.getElementById('lb_tcp_peak'); - - label_otr_cur = document.getElementById('lb_otr_cur'); - label_otr_avg = document.getElementById('lb_otr_avg'); - label_otr_peak = document.getElementById('lb_otr_peak'); - - label_scale = document.getElementById('scale'); - - conn_table = document.getElementById('connections'); - - - /* plot horizontal time interval lines */ - for (var i = width % (step * 60); i < width; i += step * 60) - { - var line = G.createElementNS('http://www.w3.org/2000/svg', 'line'); - line.setAttribute('x1', i); - line.setAttribute('y1', 0); - line.setAttribute('x2', i); - line.setAttribute('y2', '100%'); - line.setAttribute('style', 'stroke:black;stroke-width:0.1'); - - var text = G.createElementNS('http://www.w3.org/2000/svg', 'text'); - text.setAttribute('x', i + 5); - text.setAttribute('y', 15); - text.setAttribute('style', 'fill:#eee; font-size:9pt; font-family:sans-serif; text-shadow:1px 1px 1px #000'); - text.appendChild(G.createTextNode(Math.round((width - i) / step / 60) + 'm')); - - label_25.parentNode.appendChild(line); - label_25.parentNode.appendChild(text); - } - - label_scale.innerHTML = String.format('<%:(%d minute window, %d second interval)%>', data_wanted / 60, 3); - - /* render datasets, start update interval */ - XHR.poll(3, '<%=build_url("admin/status/realtime/connections_status")%>', null, - function(x, json) - { - var rows = []; - var conn = json.connections; - - var lookup_queue = [ ]; - - conn.sort(function(a, b) { - return b.bytes - a.bytes; - }); - - for (var i = 0; i < conn.length; i++) - { - var c = conn[i]; - - if ((c.src == '127.0.0.1' && c.dst == '127.0.0.1') || - (c.src == '::1' && c.dst == '::1')) - continue; - - if (!dns_cache[c.src]) - lookup_queue.push(c.src); - - if (!dns_cache[c.dst]) - lookup_queue.push(c.dst); - - var src = dns_cache[c.src] || (c.layer3 == 'ipv6' ? '[' + c.src + ']' : c.src); - var dst = dns_cache[c.dst] || (c.layer3 == 'ipv6' ? '[' + c.dst + ']' : c.dst); - - rows.push([ - c.layer3.toUpperCase(), - c.layer4.toUpperCase(), - src + ':' + c.sport, - dst + ':' + c.dport, - '%1024.2mB (%d <%:Pkts.%>)'.format(c.bytes, c.packets) - ]); - } - - cbi_update_table(conn_table, rows, '<em><%:No information available%></em>'); - - if (lookup_queue.length > 0) - XHR.get('<%=build_url("admin/status/nameinfo")%>/' + lookup_queue.slice(0, 100).join('/'), null, - function(x, json) - { - for (var addr in json) - dns_cache[addr] = json[addr]; - } - ); - - - var data = json.statistics; - - var data_max = 0; - var data_scale = 0; - - var data_udp_avg = 0; - var data_tcp_avg = 0; - var data_otr_avg = 0; - - var data_udp_peak = 0; - var data_tcp_peak = 0; - var data_otr_peak = 0; - - for (var i = data_stamp ? 0 : 1; i < data.length; i++) - { - /* skip overlapping entries */ - if (data[i][TIME] <= data_stamp) - continue; - - data_udp.push(data[i][UDP]); - data_tcp.push(data[i][TCP]); - data_otr.push(data[i][OTHER]); - } - - /* cut off outdated entries */ - data_udp = data_udp.slice(data_udp.length - data_wanted, data_udp.length); - data_tcp = data_tcp.slice(data_tcp.length - data_wanted, data_tcp.length); - data_otr = data_otr.slice(data_otr.length - data_wanted, data_otr.length); - - /* find peak */ - for (var i = 0; i < data_udp.length; i++) - { - data_max = Math.max(data_max, data_udp[i]); - data_max = Math.max(data_max, data_tcp[i]); - data_max = Math.max(data_max, data_otr[i]); - - data_udp_peak = Math.max(data_udp_peak, data_udp[i]); - data_tcp_peak = Math.max(data_tcp_peak, data_tcp[i]); - data_otr_peak = Math.max(data_otr_peak, data_otr[i]); - - if (i > 0) - { - data_udp_avg = (data_udp_avg + data_udp[i]) / 2; - data_tcp_avg = (data_tcp_avg + data_tcp[i]) / 2; - data_otr_avg = (data_otr_avg + data_otr[i]) / 2; - } - else - { - data_udp_avg = data_udp[i]; - data_tcp_avg = data_tcp[i]; - data_otr_avg = data_otr[i]; - } - } - - /* remember current timestamp, calculate horizontal scale */ - data_stamp = data[data.length-1][TIME]; - data_scale = height / (data_max * 1.1); - - - /* plot data */ - var pt_udp = '0,' + height; - var pt_tcp = '0,' + height; - var pt_otr = '0,' + height; - - var y_udp = 0; - var y_tcp = 0; - var y_otr = 0; - - for (var i = 0; i < data_udp.length; i++) - { - var x = i * step; - - y_udp = height - Math.floor(data_udp[i] * data_scale); - y_tcp = height - Math.floor(data_tcp[i] * data_scale); - y_otr = height - Math.floor(data_otr[i] * data_scale); - - pt_udp += ' ' + x + ',' + y_udp; - pt_tcp += ' ' + x + ',' + y_tcp; - pt_otr += ' ' + x + ',' + y_otr; - } - - pt_udp += ' ' + width + ',' + y_udp + ' ' + width + ',' + height; - pt_tcp += ' ' + width + ',' + y_tcp + ' ' + width + ',' + height; - pt_otr += ' ' + width + ',' + y_otr + ' ' + width + ',' + height; - - - var order = [ - [ line_udp, data_udp[data_udp.length-1] ], - [ line_tcp, data_tcp[data_tcp.length-1] ], - [ line_otr, data_otr[data_otr.length-1] ] - ]; - - order.sort(function(a, b) { return b[1] - a[1] }); - - for (var i = 0; i < order.length; i++) - order[i][0].parentNode.appendChild(order[i][0]); - - - line_udp.setAttribute('points', pt_udp); - line_tcp.setAttribute('points', pt_tcp); - line_otr.setAttribute('points', pt_otr); - - label_25.firstChild.data = Math.floor(1.1 * 0.25 * data_max); - label_50.firstChild.data = Math.floor(1.1 * 0.50 * data_max); - label_75.firstChild.data = Math.floor(1.1 * 0.75 * data_max); - - label_udp_cur.innerHTML = Math.floor(data_udp[data_udp.length-1]); - label_tcp_cur.innerHTML = Math.floor(data_tcp[data_tcp.length-1]); - label_otr_cur.innerHTML = Math.floor(data_otr[data_otr.length-1]); - - label_udp_avg.innerHTML = Math.floor(data_udp_avg); - label_tcp_avg.innerHTML = Math.floor(data_tcp_avg); - label_otr_avg.innerHTML = Math.floor(data_otr_avg); - - label_udp_peak.innerHTML = Math.floor(data_udp_peak); - label_tcp_peak.innerHTML = Math.floor(data_tcp_peak); - label_otr_peak.innerHTML = Math.floor(data_otr_peak); - } - ); - - XHR.run(); - } - }, 1000 - ); -//]]></script> - -<h2 name="content"><%:Realtime Connections%></h2> - -<div class="cbi-map-descr"><%:This page gives an overview over currently active network connections.%></div> - -<fieldset class="cbi-section" id="cbi-table-table"> - <legend><%:Active Connections%></legend> - - <embed id="bwsvg" style="width:100%; height:300px; border:1px solid #000000; background-color:#FFFFFF" src="<%=resource%>/connections.svg" /> - <div style="text-align:right"><small id="scale">-</small></div> - <br /> - - <div class="table"> - <div class="tr"> - <div class="td" style="text-align:right; vertical-align:top"><strong style="border-bottom:2px solid blue"><%:UDP:%></strong></div> - <div class="td" id="lb_udp_cur">0</div> - - <div class="td" style="text-align:right; vertical-align:top"><strong><%:Average:%></strong></div> - <div class="td" id="lb_udp_avg">0</div> - - <div class="td" style="text-align:right; vertical-align:top"><strong><%:Peak:%></strong></div> - <div class="td" id="lb_udp_peak">0</div> - </div> - <div class="tr"> - <div class="td" style="text-align:right; vertical-align:top"><strong style="border-bottom:2px solid green"><%:TCP:%></strong></div> - <div class="td" id="lb_tcp_cur">0</div> - - <div class="td" style="text-align:right; vertical-align:top"><strong><%:Average:%></strong></div> - <div class="td" id="lb_tcp_avg">0</div> - - <div class="td" style="text-align:right; vertical-align:top"><strong><%:Peak:%></strong></div> - <div class="td" id="lb_tcp_peak">0</div> - </div> - <div class="tr"> - <div class="td" style="text-align:right; vertical-align:top"><strong style="border-bottom:2px solid red"><%:Other:%></strong></div> - <div class="td" id="lb_otr_cur">0</div> - - <div class="td" style="text-align:right; vertical-align:top"><strong><%:Average:%></strong></div> - <div class="td" id="lb_otr_avg">0</div> - - <div class="td" style="text-align:right; vertical-align:top"><strong><%:Peak:%></strong></div> - <div class="td" id="lb_otr_peak">0</div> - </div> - </div> - <br /> - - <div class="cbi-section-node"> - <div class="table" id="connections"> - <div class="tr table-titles"> - <div class="th col-2 hide-xs"><%:Network%></div> - <div class="th col-2"><%:Protocol%></div> - <div class="th col-7"><%:Source%></div> - <div class="th col-7"><%:Destination%></div> - <div class="th col-4"><%:Transfer%></div> - </div> - - <div class="tr placeholder"> - <div class="td"> - <em><%:Collecting data...%></em> - </div> - </div> - </div> - </div> -</fieldset> - -<%+footer%> diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_status/dmesg.htm b/modules/luci-mod-admin-full/luasrc/view/admin_status/dmesg.htm deleted file mode 100644 index 1a8770ef88..0000000000 --- a/modules/luci-mod-admin-full/luasrc/view/admin_status/dmesg.htm +++ /dev/null @@ -1,12 +0,0 @@ -<%# - Copyright 2008 Steven Barth <steven@midlink.org> - Copyright 2008 Jo-Philipp Wich <jow@openwrt.org> - Licensed to the public under the Apache License 2.0. --%> - -<%+header%> -<h2 name="content"><%:Kernel Log%></h2> -<div id="content_syslog"> -<textarea style="font-size: 12px;" readonly="readonly" wrap="off" rows="<%=dmesg:cmatch("\n")+2%>" id="syslog"><%=dmesg:pcdata()%></textarea> -</div> -<%+footer%> diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_status/index.htm b/modules/luci-mod-admin-full/luasrc/view/admin_status/index.htm deleted file mode 100644 index 8820ae1cf3..0000000000 --- a/modules/luci-mod-admin-full/luasrc/view/admin_status/index.htm +++ /dev/null @@ -1,487 +0,0 @@ -<%# - Copyright 2008 Steven Barth <steven@midlink.org> - Copyright 2008-2011 Jo-Philipp Wich <jow@openwrt.org> - Licensed to the public under the Apache License 2.0. --%> - -<% - local fs = require "nixio.fs" - local ipc = require "luci.ip" - local util = require "luci.util" - local stat = require "luci.tools.status" - local ver = require "luci.version" - - local has_ipv6 = fs.access("/proc/net/ipv6_route") - local has_dhcp = fs.access("/etc/config/dhcp") - local has_wifi = ((fs.stat("/etc/config/wireless", "size") or 0) > 0) - - local sysinfo = luci.util.ubus("system", "info") or { } - local boardinfo = luci.util.ubus("system", "board") or { } - local unameinfo = nixio.uname() or { } - - local meminfo = sysinfo.memory or { - total = 0, - free = 0, - buffered = 0, - shared = 0 - } - - local swapinfo = sysinfo.swap or { - total = 0, - free = 0 - } - - local has_dsl = fs.access("/etc/init.d/dsl_control") - - if luci.http.formvalue("status") == "1" then - local ntm = require "luci.model.network".init() - local wan_nets = ntm:get_wan_networks() - local wan6_nets = ntm:get_wan6_networks() - - local conn_count = tonumber( - fs.readfile("/proc/sys/net/netfilter/nf_conntrack_count") or "") or 0 - - local conn_max = tonumber(luci.sys.exec( - "sysctl -n -e net.nf_conntrack_max net.ipv4.netfilter.ip_conntrack_max" - ):match("%d+")) or 4096 - - local rv = { - uptime = sysinfo.uptime or 0, - localtime = os.date(), - loadavg = sysinfo.load or { 0, 0, 0 }, - memory = meminfo, - swap = swapinfo, - connmax = conn_max, - conncount = conn_count, - wifinets = stat.wifi_networks() - } - - if #wan_nets > 0 then - local k, v - - rv.wan = { } - - for k, v in pairs(wan_nets) do - local dev = v:get_interface() - local link = dev and ipc.link(dev:name()) - - local wan_info = { - ipaddr = v:ipaddr(), - gwaddr = v:gwaddr(), - netmask = v:netmask(), - dns = v:dnsaddrs(), - expires = v:expires(), - uptime = v:uptime(), - proto = v:proto(), - i18n = v:get_i18n(), - ifname = v:ifname(), - link = v:adminlink(), - mac = dev and dev:mac(), - type = dev and dev:type(), - name = dev and dev:get_i18n(), - ether = link and link.type == 1 - } - - rv.wan[#rv.wan+1] = wan_info - end - end - - if #wan6_nets > 0 then - local k, v - - rv.wan6 = { } - - for k, v in pairs(wan6_nets) do - local dev = v:get_interface() - local link = dev and ipc.link(dev:name()) - local wan6_info = { - ip6addr = v:ip6addr(), - gw6addr = v:gw6addr(), - dns = v:dns6addrs(), - ip6prefix = v:ip6prefix(), - uptime = v:uptime(), - proto = v:proto(), - i18n = v:get_i18n(), - ifname = v:ifname(), - link = v:adminlink(), - mac = dev and dev:mac(), - type = dev and dev:type(), - name = dev and dev:get_i18n(), - ether = link and link.type == 1 - } - - rv.wan6[#rv.wan6+1] = wan6_info - end - end - - if has_dsl then - local dsl_stat = luci.sys.exec("/etc/init.d/dsl_control lucistat") - local dsl_func = loadstring(dsl_stat) - if dsl_func then - rv.dsl = dsl_func() - end - end - - luci.http.prepare_content("application/json") - luci.http.write_json(rv) - - return - end --%> - -<%+header%> - -<script type="text/javascript">//<![CDATA[ - function progressbar(v, m) - { - var vn = parseInt(v) || 0; - var mn = parseInt(m) || 100; - var pc = Math.floor((100 / mn) * vn); - - return String.format( - '<div style="width:100%%; max-width:200px; position:relative; border:1px solid #999999">' + - '<div style="background-color:#CCCCCC; width:%d%%; height:15px">' + - '<div style="position:absolute; left:0; top:0; text-align:center; width:100%%; color:#000000">' + - '<small>%s / %s (%d%%)</small>' + - '</div>' + - '</div>' + - '</div>', pc, v, m, pc - ); - } - - function labelList(items, offset) { - var rv = [ ]; - - for (var i = offset || 0; i < items.length; i += 2) { - var label = items[i], - value = items[i+1]; - - if (value === undefined || value === null) - continue; - - if (label) - rv.push(E('strong', [label, ': '])); - - rv.push(value, E('br')); - } - - return rv; - } - - function renderBox(title, active, childs) { - childs = childs || []; - childs.unshift(E('span', labelList(arguments, 3))); - - return E('div', { class: 'ifacebox' }, [ - E('div', { class: 'ifacebox-head center ' + (active ? 'active' : '') }, - E('strong', title)), - E('div', { class: 'ifacebox-body left' }, childs) - ]); - } - - function renderBadge(icon, title) { - return E('span', { class: 'ifacebadge' }, [ - E('img', { src: icon, title: title || '' }), - E('span', labelList(arguments, 2)) - ]); - } - - XHR.poll(5, '<%=REQUEST_URI%>', { status: 1 }, - function(x, info) - { - var us = document.getElementById('upstream_status_table'); - - while (us.lastElementChild) - us.removeChild(us.lastElementChild); - - var wan_list = info.wan || []; - - for (var i = 0; i < wan_list.length; i++) { - var ifc = wan_list[i]; - - us.appendChild(renderBox( - '<%:IPv4 Upstream%>', - (ifc.ifname && ifc.proto != 'none'), - [ E('div', {}, renderBadge( - '<%=resource%>' + '/icons/%s.png'.format((ifc && ifc.type) ? ifc.type : 'ethernet_disabled'), null, - '<%:Device%>', ifc ? (ifc.name || ifc.ifname || '-') : '-', - '<%:MAC-Address%>', (ifc && ifc.ether) ? ifc.mac : null)) ], - '<%:Protocol%>', ifc.i18n || E('em', '<%:Not connected%>'), - '<%:Address%>', (ifc.ipaddr) ? ifc.ipaddr : '0.0.0.0', - '<%:Netmask%>', (ifc.netmask && ifc.netmask != ifc.ipaddr) ? ifc.netmask : '255.255.255.255', - '<%:Gateway%>', (ifc.gwaddr) ? ifc.gwaddr : '0.0.0.0', - '<%:DNS%> 1', (ifc.dns) ? ifc.dns[0] : null, - '<%:DNS%> 2', (ifc.dns) ? ifc.dns[1] : null, - '<%:DNS%> 3', (ifc.dns) ? ifc.dns[2] : null, - '<%:DNS%> 4', (ifc.dns) ? ifc.dns[3] : null, - '<%:DNS%> 5', (ifc.dns) ? ifc.dns[4] : null, - '<%:Expires%>', (ifc.expires > -1) ? '%t'.format(ifc.expires) : null, - '<%:Connected%>', (ifc.uptime > 0) ? '%t'.format(ifc.uptime) : null)); - } - - <% if has_ipv6 then %> - var wan6_list = info.wan6 || []; - - for (var i = 0; i < wan6_list.length; i++) { - var ifc6 = wan6_list[i]; - - us.appendChild(renderBox( - '<%:IPv6 Upstream%>', - (ifc6.ifname && ifc6.proto != 'none'), - [ E('div', {}, renderBadge( - '<%=resource%>/icons/%s.png'.format(ifc6.type || 'ethernet_disabled'), null, - '<%:Device%>', ifc6 ? (ifc6.name || ifc6.ifname || '-') : '-', - '<%:MAC-Address%>', (ifc6 && ifc6.ether) ? ifc6.mac : null)) ], - '<%:Protocol%>', ifc6.i18n ? (ifc6.i18n + (ifc6.proto === 'dhcp' && ifc6.ip6prefix ? '-PD' : '')) : E('em', '<%:Not connected%>'), - '<%:Prefix Delegated%>', ifc6.ip6prefix, - '<%:Address%>', (ifc6.ip6prefix) ? (ifc6.ip6addr || null) : (ifc6.ipaddr || '::'), - '<%:Gateway%>', (ifc6.gw6addr) ? ifc6.gw6addr : '::', - '<%:DNS%> 1', (ifc6.dns) ? ifc6.dns[0] : null, - '<%:DNS%> 2', (ifc6.dns) ? ifc6.dns[1] : null, - '<%:DNS%> 3', (ifc6.dns) ? ifc6.dns[2] : null, - '<%:DNS%> 4', (ifc6.dns) ? ifc6.dns[3] : null, - '<%:DNS%> 5', (ifc6.dns) ? ifc6.dns[4] : null, - '<%:Connected%>', (ifc6.uptime > 0) ? '%t'.format(ifc6.uptime) : null)); - } - <% end %> - - <% if has_dsl then %> - var ds = document.getElementById('dsl_status_table'); - - while (ds.lastElementChild) - ds.removeChild(ds.lastElementChild); - - ds.appendChild(renderBox( - '<%:DSL Status%>', - (info.dsl.line_state === 'UP'), [ ], - '<%:Line State%>', '%s [0x%x]'.format(info.dsl.line_state, info.dsl.line_state_detail), - '<%:Line Mode%>', info.dsl.line_mode_s || '-', - '<%:Line Uptime%>', info.dsl.line_uptime_s || '-', - '<%:Annex%>', info.dsl.annex_s || '-', - '<%:Profile%>', info.dsl.profile_s || '-', - '<%:Data Rate%>', '%s/s / %s/s'.format(info.dsl.data_rate_down_s, info.dsl.data_rate_up_s), - '<%:Max. Attainable Data Rate (ATTNDR)%>', '%s/s / %s/s'.format(info.dsl.max_data_rate_down_s, info.dsl.max_data_rate_up_s), - '<%:Latency%>', '%s / %s'.format(info.dsl.latency_num_down, info.dsl.latency_num_up), - '<%:Line Attenuation (LATN)%>', '%.1f dB / %.1f dB'.format(info.dsl.line_attenuation_down, info.dsl.line_attenuation_up), - '<%:Signal Attenuation (SATN)%>', '%.1f dB / %.1f dB'.format(info.dsl.signal_attenuation_down, info.dsl.signal_attenuation_up), - '<%:Noise Margin (SNR)%>', '%.1f dB / %.1f dB'.format(info.dsl.noise_margin_down, info.dsl.noise_margin_up), - '<%:Aggregate Transmit Power(ACTATP)%>', '%.1f dB / %.1f dB'.format(info.dsl.actatp_down, info.dsl.actatp_up), - '<%:Forward Error Correction Seconds (FECS)%>', '%d / %d'.format(info.dsl.errors_fec_near, info.dsl.errors_fec_far), - '<%:Errored seconds (ES)%>', '%d / %d'.format(info.dsl.errors_es_near, info.dsl.errors_es_far), - '<%:Severely Errored Seconds (SES)%>', '%d / %d'.format(info.dsl.errors_ses_near, info.dsl.errors_ses_far), - '<%:Loss of Signal Seconds (LOSS)%>', '%d / %d'.format(info.dsl.errors_loss_near, info.dsl.errors_loss_far), - '<%:Unavailable Seconds (UAS)%>', '%d / %d'.format(info.dsl.errors_uas_near, info.dsl.errors_uas_far), - '<%:Header Error Code Errors (HEC)%>', '%d / %d'.format(info.dsl.errors_hec_near, info.dsl.errors_hec_far), - '<%:Non Pre-emtive CRC errors (CRC_P)%>', '%d / %d'.format(info.dsl.errors_crc_p_near, info.dsl.errors_crc_p_far), - '<%:Pre-emtive CRC errors (CRCP_P)%>', '%d / %d'.format(info.dsl.errors_crcp_p_near, info.dsl.errors_crcp_p_far), - '<%:ATU-C System Vendor ID%>', info.dsl.atuc_vendor_id, - '<%:Power Management Mode%>', info.dsl.power_mode_s)); - <% end %> - - <% if has_wifi then %> - var ws = document.getElementById('wifi_status_table'); - if (ws) - { - while (ws.lastElementChild) - ws.removeChild(ws.lastElementChild); - - for (var didx = 0; didx < info.wifinets.length; didx++) - { - var dev = info.wifinets[didx]; - var net0 = (dev.networks && dev.networks[0]) ? dev.networks[0] : {}; - var vifs = []; - - for (var nidx = 0; nidx < dev.networks.length; nidx++) - { - var net = dev.networks[nidx]; - var is_assoc = (net.bssid != '00:00:00:00:00:00' && net.channel && !net.disabled); - - var icon; - if (net.disabled) - icon = "<%=resource%>/icons/signal-none.png"; - else if (net.quality <= 0) - icon = "<%=resource%>/icons/signal-0.png"; - else if (net.quality < 25) - icon = "<%=resource%>/icons/signal-0-25.png"; - else if (net.quality < 50) - icon = "<%=resource%>/icons/signal-25-50.png"; - else if (net.quality < 75) - icon = "<%=resource%>/icons/signal-50-75.png"; - else - icon = "<%=resource%>/icons/signal-75-100.png"; - - vifs.push(renderBadge( - icon, - '<%:Signal%>: %d dBm / <%:Quality%>: %d%%'.format(net.signal, net.quality), - '<%:SSID%>', E('a', { href: net.link }, [ net.ssid || '?' ]), - '<%:Mode%>', net.mode, - '<%:BSSID%>', is_assoc ? (net.bssid || '-') : null, - '<%:Encryption%>', is_assoc ? net.encryption : null, - '<%:Associations%>', is_assoc ? (net.num_assoc || '-') : null, - null, is_assoc ? null : E('em', net.disabled ? '<%:Wireless is disabled%>' : '<%:Wireless is not associated%>'))); - } - - ws.appendChild(renderBox( - dev.device, dev.up || net0.up, - [ E('div', vifs) ], - '<%:Type%>', dev.name.replace(/^Generic | Wireless Controller .+$/g, ''), - '<%:Channel%>', net0.channel ? '%d (%.3f <%:GHz%>)'.format(net0.channel, net0.frequency) : '-', - '<%:Bitrate%>', net0.bitrate ? '%d <%:Mbit/s%>'.format(net0.bitrate) : '-')); - } - - if (!ws.lastElementChild) - ws.appendChild(E('<em><%:No information available%></em>')); - } - <% end %> - - var e; - - if (e = document.getElementById('localtime')) - e.innerHTML = info.localtime; - - if (e = document.getElementById('uptime')) - e.innerHTML = String.format('%t', info.uptime); - - if (e = document.getElementById('loadavg')) - e.innerHTML = String.format( - '%.02f, %.02f, %.02f', - info.loadavg[0] / 65535.0, - info.loadavg[1] / 65535.0, - info.loadavg[2] / 65535.0 - ); - - if (e = document.getElementById('memtotal')) - e.innerHTML = progressbar( - ((info.memory.free + info.memory.buffered) / 1024) + " <%:kB%>", - (info.memory.total / 1024) + " <%:kB%>" - ); - - if (e = document.getElementById('memfree')) - e.innerHTML = progressbar( - (info.memory.free / 1024) + " <%:kB%>", - (info.memory.total / 1024) + " <%:kB%>" - ); - - if (e = document.getElementById('membuff')) - e.innerHTML = progressbar( - (info.memory.buffered / 1024) + " <%:kB%>", - (info.memory.total / 1024) + " <%:kB%>" - ); - - if (e = document.getElementById('swaptotal')) - e.innerHTML = progressbar( - (info.swap.free / 1024) + " <%:kB%>", - (info.swap.total / 1024) + " <%:kB%>" - ); - - if (e = document.getElementById('swapfree')) - e.innerHTML = progressbar( - (info.swap.free / 1024) + " <%:kB%>", - (info.swap.total / 1024) + " <%:kB%>" - ); - - if (e = document.getElementById('conns')) - e.innerHTML = progressbar(info.conncount, info.connmax); - - } - ); -//]]></script> - -<h2 name="content"><%:Status%></h2> - -<div class="cbi-section"> - <h3><%:System%></h3> - - <div class="table" width="100%"> - <div class="tr"><div class="td left" width="33%"><%:Hostname%></div><div class="td left"><%=luci.sys.hostname() or "?"%></div></div> - <div class="tr"><div class="td left" width="33%"><%:Model%></div><div class="td left"><%=pcdata(boardinfo.model or "?")%></div></div> - <div class="tr"><div class="td left" width="33%"><%:Architecture%></div><div class="td left"><%=pcdata(boardinfo.system or "?")%></div></div> - <div class="tr"><div class="td left" width="33%"><%:Firmware Version%></div><div class="td left"> - <%=pcdata(ver.distname)%> <%=pcdata(ver.distversion)%> / - <%=pcdata(ver.luciname)%> (<%=pcdata(ver.luciversion)%>) - </div></div> - <div class="tr"><div class="td left" width="33%"><%:Kernel Version%></div><div class="td left"><%=unameinfo.release or "?"%></div></div> - <div class="tr"><div class="td left" width="33%"><%:Local Time%></div><div class="td left" id="localtime">-</div></div> - <div class="tr"><div class="td left" width="33%"><%:Uptime%></div><div class="td left" id="uptime">-</div></div> - <div class="tr"><div class="td left" width="33%"><%:Load Average%></div><div class="td left" id="loadavg">-</div></div> - </div> -</div> - -<div class="cbi-section"> - <h3><%:Memory%></h3> - - <div class="table" width="100%"> - <div class="tr"><div class="td left" width="33%"><%:Total Available%></div><div class="td left" id="memtotal">-</div></div> - <div class="tr"><div class="td left" width="33%"><%:Free%></div><div class="td left" id="memfree">-</div></div> - <div class="tr"><div class="td left" width="33%"><%:Buffered%></div><div class="td left" id="membuff">-</div></div> - </div> -</div> - -<% if swapinfo.total > 0 then %> -<div class="cbi-section"> - <h3><%:Swap%></h3> - - <div class="table" width="100%"> - <div class="tr"><div class="td left" width="33%"><%:Total Available%></div><div class="td left" id="swaptotal">-</div></div> - <div class="tr"><div class="td left" width="33%"><%:Free%></div><div class="td left" id="swapfree">-</div></div> - </div> -</div> -<% end %> - -<div class="cbi-section"> - <h3><%:Network%></h3> - - <div id="upstream_status_table" class="network-status-table"> - <p><em><%:Collecting data...%></em></p> - </div> - - <div class="table" width="100%"> - <div class="tr"><div class="td left" width="33%"><%:Active Connections%></div><div class="td left" id="conns">-</div></div> - </div> -</div> - -<% - if has_dhcp then - include("admin_network/lease_status") - end -%> - -<% if has_dsl then %> -<div class="cbi-section"> - <h3><%:DSL%></h3> - - <div id="dsl_status_table" class="network-status-table"> - <p><em><%:Collecting data...%></em></p> - </div> -</div> -<% end %> - -<% if has_wifi then %> -<div class="cbi-section"> - <h3><%:Wireless%></h3> - - <div id="wifi_status_table" class="network-status-table"> - <p><em><%:Collecting data...%></em></p> - </div> -</div> - -<div class="cbi-section"> - <h3><%:Associated Stations%></h3> - - <%+admin_network/wifi_assoclist%> -</div> -<% end %> - -<%- - local incdir = util.libpath() .. "/view/admin_status/index/" - if fs.access(incdir) then - local inc - for inc in fs.dir(incdir) do - if inc:match("%.htm$") then - include("admin_status/index/" .. inc:gsub("%.htm$", "")) - end - end - end --%> - -<%+footer%> diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_status/iptables.htm b/modules/luci-mod-admin-full/luasrc/view/admin_status/iptables.htm deleted file mode 100644 index 51e428e40e..0000000000 --- a/modules/luci-mod-admin-full/luasrc/view/admin_status/iptables.htm +++ /dev/null @@ -1,155 +0,0 @@ -<%# - Copyright 2008-2009 Steven Barth <steven@midlink.org> - Copyright 2008-2015 Jo-Philipp Wich <jow@openwrt.org> - Licensed to the public under the Apache License 2.0. --%> - -<%- - - require "luci.sys.iptparser" - local wba = require "luci.tools.webadmin" - local fs = require "nixio.fs" - local io = require "io" - - local has_ip6tables = fs.access("/usr/sbin/ip6tables") - local mode = 4 - - if has_ip6tables then - mode = luci.dispatcher.context.requestpath - mode = tonumber(mode[#mode] ~= "iptables" and mode[#mode]) or 4 - end - - local ipt = luci.sys.iptparser.IptParser(mode) - - local rowcnt = 1 - function rowstyle() - rowcnt = rowcnt + 1 - return (rowcnt % 2) + 1 - end - - function link_target(t,c) - if ipt:is_custom_target(c) then - return '<a href="#rule_%s_%s">%s</a>' %{ t:lower(), c, c } - end - return c - end - - function link_iface(i) - local net = wba.iface_get_network(i) - if net and i ~= "lo" then - return '<a href="%s">%s</a>' %{ - url("admin/network/network", net), i - } - - end - return i - end - - local tables = { "Filter", "NAT", "Mangle", "Raw" } - if mode == 6 then - tables = { "Filter", "Mangle", "Raw" } - local ok, lines = pcall(io.lines, "/proc/net/ip6_tables_names") - if ok and lines then - local line - for line in lines do - if line == "nat" then - tables = { "Filter", "NAT", "Mangle", "Raw" } - end - end - end - end --%> - -<%+header%> - -<style type="text/css"> - span:target { - color: blue; - text-decoration: underline; - } -</style> - -<h2 name="content"><%:Firewall Status%></h2> - -<% if has_ip6tables then %> -<ul class="cbi-tabmenu"> - <li class="cbi-tab<%= mode ~= 4 and "-disabled" %>"><a href="<%=url("admin/status/iptables/4")%>"><%:IPv4 Firewall%></a></li> - <li class="cbi-tab<%= mode ~= 6 and "-disabled" %>"><a href="<%=url("admin/status/iptables/6")%>"><%:IPv6 Firewall%></a></li> -</ul> -<% end %> - -<div class="cbi-map" style="position: relative"> - - <form method="post" action="<%=url("admin/status/iptables_action")%>" style="position: absolute; right: 0"> - <input type="hidden" name="token" value="<%=token%>" /> - <input type="hidden" name="family" value="<%=mode%>" /> - <input type="submit" class="cbi-button" name="zero" value="<%:Reset Counters%>" /> - <input type="submit" class="cbi-button" name="restart" value="<%:Restart Firewall%>" /> - </form> - - <div class="cbi-section"> - - <% for _, tbl in ipairs(tables) do chaincnt = 0 %> - <h3><%:Table%>: <%=tbl%></h3> - - <% for _, chain in ipairs(ipt:chains(tbl)) do - rowcnt = 0 - chaincnt = chaincnt + 1 - chaininfo = ipt:chain(tbl, chain) - %> - <h4 id="rule_<%=tbl:lower()%>_<%=chain%>"> - <%:Chain%> <em><%=chain%></em> - (<%- if chaininfo.policy then -%> - <%:Policy%>: <em><%=chaininfo.policy%></em>, <%:Packets%>: <%=chaininfo.packets%>, <%:Traffic%>: <%=wba.byte_format(chaininfo.bytes)-%> - <%- else -%> - <%:References%>: <%=chaininfo.references-%> - <%- end -%>) - </h4> - - <div class="cbi-section-node"> - <div class="table" style="font-size:90%"> - <div class="tr table-titles cbi-rowstyle-<%=rowstyle()%>"> - <div class="th hide-xs"><%:Pkts.%></div> - <div class="th nowrap"><%:Traffic%></div> - <div class="th col-5"><%:Target%></div> - <div class="th"><%:Prot.%></div> - <div class="th"><%:In%></div> - <div class="th"><%:Out%></div> - <div class="th"><%:Source%></div> - <div class="th"><%:Destination%></div> - <div class="th col-9 hide-xs"><%:Options%></div> - </div> - - <% for _, rule in ipairs(ipt:find({table=tbl, chain=chain})) do %> - <div class="tr cbi-rowstyle-<%=rowstyle()%>"> - <div class="td"><%=rule.packets%></div> - <div class="td nowrap"><%=wba.byte_format(rule.bytes)%></div> - <div class="td col-5"><%=rule.target and link_target(tbl, rule.target) or "-"%></div> - <div class="td"><%=rule.protocol%></div> - <div class="td"><%=link_iface(rule.inputif)%></div> - <div class="td"><%=link_iface(rule.outputif)%></div> - <div class="td"><%=rule.source%></div> - <div class="td"><%=rule.destination%></div> - <div class="td col-9 hide-xs"><%=#rule.options > 0 and luci.util.pcdata(table.concat(rule.options, " ")) or "-"%></div> - </div> - <% end %> - - <% if rowcnt == 1 then %> - <div class="tr cbi-rowstyle-<%=rowstyle()%>"> - <div class="td" colspan="9"><em><%:No rules in this chain%></em></div> - </div> - <% end %> - </div> - </div> - <% end %> - - <% if chaincnt == 0 then %> - <em><%:No chains in this table%></em> - <% end %> - - <br /><br /> - <% end %> - </div> -</div> - -<%+footer%> diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_status/load.htm b/modules/luci-mod-admin-full/luasrc/view/admin_status/load.htm deleted file mode 100644 index bced06fa22..0000000000 --- a/modules/luci-mod-admin-full/luasrc/view/admin_status/load.htm +++ /dev/null @@ -1,285 +0,0 @@ -<%# - Copyright 2010 Jo-Philipp Wich <jow@openwrt.org> - Licensed to the public under the Apache License 2.0. --%> - -<%+header%> - -<script type="text/javascript">//<![CDATA[ - var bwxhr = new XHR(); - - var G; - var TIME = 0; - var L01 = 1; - var L05 = 2; - var L15 = 3; - - var width = 760; - var height = 300; - var step = 5; - - var data_wanted = Math.floor(width / step); - var data_fill = 0; - var data_stamp = 0; - - var data_01 = [ ]; - var data_05 = [ ]; - var data_15 = [ ]; - - var line_01; - var line_05; - var line_15; - - var label_25; - var label_050; - var label_75; - - var label_01_cur; - var label_01_avg; - var label_01_peak; - - var label_05_cur; - var label_05_avg; - var label_05_peak; - - var label_15_cur; - var label_15_avg; - var label_15_peak; - - var label_scale; - - - /* wait for SVG */ - window.setTimeout( - function() { - var svg = document.getElementById('bwsvg'); - - try { - G = svg.getSVGDocument - ? svg.getSVGDocument() : svg.contentDocument; - } - catch(e) { - G = document.embeds['bwsvg'].getSVGDocument(); - } - - if (!G) - { - window.setTimeout(arguments.callee, 1000); - } - else - { - /* find sizes */ - width = svg.offsetWidth - 2; - height = svg.offsetHeight - 2; - data_wanted = Math.ceil(width / step); - - /* prefill datasets */ - for (var i = 0; i < data_wanted; i++) - { - data_01[i] = 0; - data_05[i] = 0; - data_15[i] = 0; - } - - /* find svg elements */ - line_01 = G.getElementById('load01'); - line_05 = G.getElementById('load05'); - line_15 = G.getElementById('load15'); - - label_25 = G.getElementById('label_25'); - label_50 = G.getElementById('label_50'); - label_75 = G.getElementById('label_75'); - - label_01_cur = document.getElementById('lb_load01_cur'); - label_01_avg = document.getElementById('lb_load01_avg'); - label_01_peak = document.getElementById('lb_load01_peak'); - - label_05_cur = document.getElementById('lb_load05_cur'); - label_05_avg = document.getElementById('lb_load05_avg'); - label_05_peak = document.getElementById('lb_load05_peak'); - - label_15_cur = document.getElementById('lb_load15_cur'); - label_15_avg = document.getElementById('lb_load15_avg'); - label_15_peak = document.getElementById('lb_load15_peak'); - - label_scale = document.getElementById('scale'); - - - /* plot horizontal time interval lines */ - for (var i = width % (step * 60); i < width; i += step * 60) - { - var line = G.createElementNS('http://www.w3.org/2000/svg', 'line'); - line.setAttribute('x1', i); - line.setAttribute('y1', 0); - line.setAttribute('x2', i); - line.setAttribute('y2', '100%'); - line.setAttribute('style', 'stroke:black;stroke-width:0.1'); - - var text = G.createElementNS('http://www.w3.org/2000/svg', 'text'); - text.setAttribute('x', i + 5); - text.setAttribute('y', 15); - text.setAttribute('style', 'fill:#eee; font-size:9pt; font-family:sans-serif; text-shadow:1px 1px 1px #000'); - text.appendChild(G.createTextNode(Math.round((width - i) / step / 60) + 'm')); - - label_25.parentNode.appendChild(line); - label_25.parentNode.appendChild(text); - } - - label_scale.innerHTML = String.format('<%:(%d minute window, %d second interval)%>', data_wanted / 60, 3); - - /* render datasets, start update interval */ - XHR.poll(3, '<%=build_url("admin/status/realtime/load_status")%>', null, - function(x, data) - { - var data_max = 0; - var data_scale = 0; - - var data_01_avg = 0; - var data_05_avg = 0; - var data_15_avg = 0; - - var data_01_peak = 0; - var data_05_peak = 0; - var data_15_peak = 0; - - for (var i = data_stamp ? 0 : 1; i < data.length; i++) - { - /* skip overlapping entries */ - if (data[i][TIME] <= data_stamp) - continue; - - data_01.push(data[i][L01]); - data_05.push(data[i][L05]); - data_15.push(data[i][L15]); - } - - /* cut off outdated entries */ - data_01 = data_01.slice(data_01.length - data_wanted, data_01.length); - data_05 = data_05.slice(data_05.length - data_wanted, data_05.length); - data_15 = data_15.slice(data_15.length - data_wanted, data_15.length); - - /* find peak */ - for (var i = 0; i < data_01.length; i++) - { - data_max = Math.max(data_max, data_01[i]); - data_max = Math.max(data_max, data_05[i]); - data_max = Math.max(data_max, data_15[i]); - - data_01_peak = Math.max(data_01_peak, data_01[i]); - data_05_peak = Math.max(data_05_peak, data_05[i]); - data_15_peak = Math.max(data_15_peak, data_15[i]); - - if (i > 0) - { - data_01_avg = (data_01_avg + data_01[i]) / 2; - data_05_avg = (data_05_avg + data_05[i]) / 2; - data_15_avg = (data_15_avg + data_15[i]) / 2; - } - else - { - data_01_avg = data_01[i]; - data_05_avg = data_05[i]; - data_15_avg = data_15[i]; - } - } - - /* remember current timestamp, calculate horizontal scale */ - data_stamp = data[data.length-1][TIME]; - data_scale = height / (data_max * 1.1); - - - /* plot data */ - var pt_01 = '0,' + height; - var pt_05 = '0,' + height; - var pt_15 = '0,' + height; - - var y_01 = 0; - var y_05 = 0; - var y_15 = 0; - - for (var i = 0; i < data_01.length; i++) - { - var x = i * step; - - y_01 = height - Math.floor(data_01[i] * data_scale); - y_05 = height - Math.floor(data_05[i] * data_scale); - y_15 = height - Math.floor(data_15[i] * data_scale); - - pt_01 += ' ' + x + ',' + y_01; - pt_05 += ' ' + x + ',' + y_05; - pt_15 += ' ' + x + ',' + y_15; - } - - pt_01 += ' ' + width + ',' + y_01 + ' ' + width + ',' + height; - pt_05 += ' ' + width + ',' + y_05 + ' ' + width + ',' + height; - pt_15 += ' ' + width + ',' + y_15 + ' ' + width + ',' + height; - - - line_01.setAttribute('points', pt_01); - line_05.setAttribute('points', pt_05); - line_15.setAttribute('points', pt_15); - - label_25.firstChild.data = (1.1 * 0.25 * data_max / 100).toFixed(2); - label_50.firstChild.data = (1.1 * 0.50 * data_max / 100).toFixed(2); - label_75.firstChild.data = (1.1 * 0.75 * data_max / 100).toFixed(2); - - label_01_cur.innerHTML = (data_01[data_01.length-1] / 100).toFixed(2); - label_05_cur.innerHTML = (data_05[data_05.length-1] / 100).toFixed(2); - label_15_cur.innerHTML = (data_15[data_15.length-1] / 100).toFixed(2); - - label_01_avg.innerHTML = (data_01_avg / 100).toFixed(2); - label_05_avg.innerHTML = (data_05_avg / 100).toFixed(2); - label_15_avg.innerHTML = (data_15_avg / 100).toFixed(2); - - label_01_peak.innerHTML = (data_01_peak / 100).toFixed(2); - label_05_peak.innerHTML = (data_05_peak / 100).toFixed(2); - label_15_peak.innerHTML = (data_15_peak / 100).toFixed(2); - } - ); - - XHR.run(); - } - }, 1000 - ); -//]]></script> - -<h2 name="content"><%:Realtime Load%></h2> - -<embed id="bwsvg" style="width:100%; height:300px; border:1px solid #000000; background-color:#FFFFFF" src="<%=resource%>/load.svg" /> -<div style="text-align:right"><small id="scale">-</small></div> -<br /> - -<div class="table" style="width:100%; table-layout:fixed" cellspacing="5"> - <div class="tr"> - <div class="td" style="text-align:right; vertical-align:top"><strong style="border-bottom:2px solid #ff0000; white-space:nowrap"><%:1 Minute Load:%></strong></div> - <div class="td" id="lb_load01_cur">0</div> - - <div class="td" style="text-align:right; vertical-align:top"><strong><%:Average:%></strong></div> - <div class="td" id="lb_load01_avg">0</div> - - <div class="td" style="text-align:right; vertical-align:top"><strong><%:Peak:%></strong></div> - <div class="td" id="lb_load01_peak">0</div> - </div> - <div class="tr"> - <div class="td" style="text-align:right; vertical-align:top"><strong style="border-bottom:2px solid #ff6600; white-space:nowrap"><%:5 Minute Load:%></strong></div> - <div class="td" id="lb_load05_cur">0</div> - - <div class="td" style="text-align:right; vertical-align:top"><strong><%:Average:%></strong></div> - <div class="td" id="lb_load05_avg">0</div> - - <div class="td" style="text-align:right; vertical-align:top"><strong><%:Peak:%></strong></div> - <div class="td" id="lb_load05_peak">0</div> - </div> - <div class="tr"> - <div class="td" style="text-align:right; vertical-align:top"><strong style="border-bottom:2px solid #ffaa00; white-space:nowrap"><%:15 Minute Load:%></strong></div> - <div class="td" id="lb_load15_cur">0</div> - - <div class="td" style="text-align:right; vertical-align:top"><strong><%:Average:%></strong></div> - <div class="td" id="lb_load15_avg">0</div> - - <div class="td" style="text-align:right; vertical-align:top"><strong><%:Peak:%></strong></div> - <div class="td" id="lb_load15_peak">0</div> - </div> -</div> - -<%+footer%> diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_status/routes.htm b/modules/luci-mod-admin-full/luasrc/view/admin_status/routes.htm deleted file mode 100644 index 74779f6ad8..0000000000 --- a/modules/luci-mod-admin-full/luasrc/view/admin_status/routes.htm +++ /dev/null @@ -1,156 +0,0 @@ -<%# - Copyright 2008-2009 Steven Barth <steven@midlink.org> - Copyright 2008-2015 Jo-Philipp Wich <jow@openwrt.org> - Licensed to the public under the Apache License 2.0. --%> - -<%- - require "luci.tools.webadmin" - require "nixio.fs" - - local ip = require "luci.ip" - local style = true - local _, v - - local rtn = { - [255] = "local", - [254] = "main", - [253] = "default", - [0] = "unspec" - } - - if nixio.fs.access("/etc/iproute2/rt_tables") then - local ln - for ln in io.lines("/etc/iproute2/rt_tables") do - local i, n = ln:match("^(%d+)%s+(%S+)") - if i and n then - rtn[tonumber(i)] = n - end - end - end --%> - -<%+header%> - - -<div class="cbi-map" id="cbi-network"> - <h2 name="content"><%:Routes%></h2> - <div class="cbi-map-descr"><%:The following rules are currently active on this system.%></div> - - <div class="cbi-section"> - <legend>ARP</legend> - <div class="cbi-section-node"> - <div class="table"> - <div class="tr table-titles"> - <div class="th"><%_<abbr title="Internet Protocol Version 4">IPv4</abbr>-Address%></div> - <div class="th"><%_<abbr title="Media Access Control">MAC</abbr>-Address%></div> - <div class="th"><%:Interface%></div> - </div> - - <% - for _, v in ipairs(ip.neighbors({ family = 4 })) do - if v.mac then - %> - <div class="tr cbi-rowstyle-<%=(style and 1 or 2)%>"> - <div class="td"><%=v.dest%></div> - <div class="td"><%=v.mac%></div> - <div class="td"><%=luci.tools.webadmin.iface_get_network(v.dev) or '(' .. v.dev .. ')'%></div> - </div> - <% - style = not style - end - end - %> - </div> - </div> - </div> - - <div class="cbi-section"> - <legend><%_Active <abbr title="Internet Protocol Version 4">IPv4</abbr>-Routes%></legend> - <div class="cbi-section-node"> - <div class="table"> - <div class="tr table-titles"> - <div class="th"><%:Network%></div> - <div class="th"><%:Target%></div> - <div class="th"><%_<abbr title="Internet Protocol Version 4">IPv4</abbr>-Gateway%></div> - <div class="th"><%:Metric%></div> - <div class="th"><%:Table%></div> - </div> - <% for _, v in ipairs(ip.routes({ family = 4, type = 1 })) do %> - <div class="tr cbi-rowstyle-<%=(style and 1 or 2)%>"> - <div class="td"><%=luci.tools.webadmin.iface_get_network(v.dev) or v.dev%></div> - <div class="td"><%=v.dest%></div> - <div class="td"><%=v.gw or "-"%></div> - <div class="td"><%=v.metric or 0%></div> - <div class="td"><%=rtn[v.table] or v.table%></div> - </div> - <% style = not style end %> - </div> - </div> - </div> - - <% - if nixio.fs.access("/proc/net/ipv6_route") then - style = true - %> - <div class="cbi-section"> - <legend><%_Active <abbr title="Internet Protocol Version 6">IPv6</abbr>-Routes%></legend> - <div class="cbi-section-node"> - <div class="table"> - <div class="tr table-titles"> - <div class="th"><%:Network%></div> - <div class="th"><%:Target%></div> - <div class="th"><%:Source%></div> - <div class="th"><%:Metric%></div> - <div class="th"><%:Table%></div> - </div> - <% - for _, v in ipairs(ip.routes({ family = 6, type = 1 })) do - if v.dest and not v.dest:is6linklocal() then - %> - <div class="tr cbi-rowstyle-<%=(style and 1 or 2)%>"> - <div class="td"><%=luci.tools.webadmin.iface_get_network(v.dev) or '(' .. v.dev .. ')'%></div> - <div class="td"><%=v.dest%></div> - <div class="td"><%=v.from%></div> - <div class="td"><%=v.metric or 0%></div> - <div class="td"><%=rtn[v.table] or v.table%></div> - </div> - <% - style = not style - end - end - %> - </div> - </div> - </div> - - <div class="cbi-section"> - <legend><%:IPv6 Neighbours%></legend> - <div class="cbi-section-node"> - <div class="table"> - <div class="tr table-titles"> - <div class="th"><%:IPv6-Address%></div> - <div class="th"><%:MAC-Address%></div> - <div class="th"><%:Interface%></div> - </div> - <% - for _, v in ipairs(ip.neighbors({ family = 6 })) do - if v.dest and not v.dest:is6linklocal() and v.mac then - %> - <div class="tr cbi-rowstyle-<%=(style and 1 or 2)%>"> - <div class="td"><%=v.dest%></div> - <div class="td"><%=v.mac%></div> - <div class="td"><%=luci.tools.webadmin.iface_get_network(v.dev) or '(' .. v.dev .. ')'%></div> - </div> - <% - style = not style - end - end - %> - </div> - </div> - </div> - <% end %> -</div> - -<%+footer%> diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_status/syslog.htm b/modules/luci-mod-admin-full/luasrc/view/admin_status/syslog.htm deleted file mode 100644 index fb734a76d9..0000000000 --- a/modules/luci-mod-admin-full/luasrc/view/admin_status/syslog.htm +++ /dev/null @@ -1,12 +0,0 @@ -<%# - Copyright 2008 Steven Barth <steven@midlink.org> - Copyright 2008 Jo-Philipp Wich <jow@openwrt.org> - Licensed to the public under the Apache License 2.0. --%> - -<%+header%> -<h2 name="content"><%:System Log%></h2> -<div id="content_syslog"> -<textarea style="font-size: 12px;" readonly="readonly" wrap="off" rows="<%=syslog:cmatch("\n")+2%>" id="syslog"><%=syslog:pcdata()%></textarea> -</div> -<%+footer%> diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_status/wireless.htm b/modules/luci-mod-admin-full/luasrc/view/admin_status/wireless.htm deleted file mode 100644 index 8ec43cb0e6..0000000000 --- a/modules/luci-mod-admin-full/luasrc/view/admin_status/wireless.htm +++ /dev/null @@ -1,371 +0,0 @@ -<%# - Copyright 2011 Jo-Philipp Wich <jow@openwrt.org> - Licensed to the public under the Apache License 2.0. --%> - -<%- - local ntm = require "luci.model.network".init() - - local dev - local devices = { } - for _, dev in luci.util.vspairs(luci.sys.net.devices()) do - if dev:match("^wlan%d") or dev:match("^ath%d") or dev:match("^wl%d") then - devices[#devices+1] = dev - end - end - - local curdev = luci.http.formvalue("dev") or devices[1] --%> - -<%+header%> - -<script type="text/javascript">//<![CDATA[ - var bwxhr = new XHR(); - - var G, G2; - var TIME = 0; - var RATE = 1; - var RSSI = 2; - var NOISE = 3; - - var width = 760; - var height = 300; - var step = 5; - - var data_wanted = Math.floor(width / step); - var data_fill = 0; - var data_stamp = 0; - - var data_rssi = [ ]; - var data_noise = [ ]; - var data_rate = [ ]; - - var line_rssi; - var line_noise; - var line_rate; - - var label_25, label_25_2; - var label_50, label_50_2; - var label_75, label_75_2; - - var label_rssi_cur; - var label_rssi_avg; - var label_rssi_peak; - - var label_noise_cur; - var label_noise_avg; - var label_noise_peak; - - var label_rate_cur; - var label_rate_avg; - var label_rate_peak; - - var label_scale; - - - /* wait for SVG */ - window.setTimeout( - function() { - var svg = document.getElementById('iwsvg'); - var svg2 = document.getElementById('iwsvg2'); - - try { - G = svg.getSVGDocument - ? svg.getSVGDocument() : svg.contentDocument; - G2 = svg2.getSVGDocument - ? svg2.getSVGDocument() : svg2.contentDocument; - } - catch(e) { - G = document.embeds['iwsvg'].getSVGDocument(); - G2 = document.embeds['iwsvg2'].getSVGDocument(); - } - - if (!G || !G2) - { - window.setTimeout(arguments.callee, 1000); - } - else - { - /* find sizes */ - width = svg.offsetWidth - 2; - height = svg.offsetHeight - 2; - data_wanted = Math.ceil(width / step); - - /* prefill datasets */ - for (var i = 0; i < data_wanted; i++) - { - data_rssi[i] = 0; - data_noise[i] = 0; - data_rate[i] = 0; - } - - /* find svg elements */ - line_rssi = G.getElementById('rssi'); - line_noise = G.getElementById('noise'); - line_rate = G2.getElementById('rate'); - - label_25 = G.getElementById('label_25'); - label_50 = G.getElementById('label_50'); - label_75 = G.getElementById('label_75'); - label_25_2 = G2.getElementById('label_25'); - label_50_2 = G2.getElementById('label_50'); - label_75_2 = G2.getElementById('label_75'); - - label_rssi_cur = document.getElementById('rssi_bw_cur'); - label_rssi_avg = document.getElementById('rssi_bw_avg'); - label_rssi_peak = document.getElementById('rssi_bw_peak'); - - label_noise_cur = document.getElementById('noise_bw_cur'); - label_noise_avg = document.getElementById('noise_bw_avg'); - label_noise_peak = document.getElementById('noise_bw_peak'); - - label_rate_cur = document.getElementById('rate_bw_cur'); - label_rate_avg = document.getElementById('rate_bw_avg'); - label_rate_peak = document.getElementById('rate_bw_peak'); - - label_scale = document.getElementById('scale'); - label_scale_2 = document.getElementById('scale2'); - - - /* plot horizontal time interval lines */ - for (var i = width % (step * 60); i < width; i += step * 60) - { - var line = G.createElementNS('http://www.w3.org/2000/svg', 'line'); - line.setAttribute('x1', i); - line.setAttribute('y1', 0); - line.setAttribute('x2', i); - line.setAttribute('y2', '100%'); - line.setAttribute('style', 'stroke:black;stroke-width:0.1'); - - var text = G.createElementNS('http://www.w3.org/2000/svg', 'text'); - text.setAttribute('x', i + 5); - text.setAttribute('y', 15); - text.setAttribute('style', 'fill:#eee; font-size:9pt; font-family:sans-serif; text-shadow:1px 1px 1px #000'); - text.appendChild(G.createTextNode(Math.round((width - i) / step / 60) + 'm')); - - label_25.parentNode.appendChild(line); - label_25.parentNode.appendChild(text); - - - var line2 = G2.createElementNS('http://www.w3.org/2000/svg', 'line'); - line2.setAttribute('x1', i); - line2.setAttribute('y1', 0); - line2.setAttribute('x2', i); - line2.setAttribute('y2', '100%'); - line2.setAttribute('style', 'stroke:black;stroke-width:0.1'); - - var text2 = G2.createElementNS('http://www.w3.org/2000/svg', 'text'); - text2.setAttribute('x', i + 5); - text2.setAttribute('y', 15); - text2.setAttribute('style', 'fill:#eee; font-size:9pt; font-family:sans-serif; text-shadow:1px 1px 1px #000'); - text2.appendChild(G.createTextNode(Math.round((width - i) / step / 60) + 'm')); - - label_25_2.parentNode.appendChild(line2); - label_25_2.parentNode.appendChild(text2); - } - - label_scale.innerHTML = String.format('<%:(%d minute window, %d second interval)%>', data_wanted / 60, 3); - label_scale_2.innerHTML = String.format('<%:(%d minute window, %d second interval)%>', data_wanted / 60, 3); - - /* render datasets, start update interval */ - XHR.poll(3, '<%=build_url("admin/status/realtime/wireless_status", curdev)%>', null, - function(x, data) - { - var noise_floor = 255; - var rate_floor = 60000; - - for (var i = 0; i < data.length; i++) { - noise_floor = Math.min(noise_floor, data[i][NOISE]); - rate_floor = Math.min(rate_floor, data[i][RATE]); - } - - noise_floor -= 5; - - var data_max = 0; - var data_scale = 0; - var data_max_2 = 0; - var data_scale_2 = 0; - - var data_rssi_avg = 0; - var data_noise_avg = 0; - var data_rate_avg = 0; - - var data_rssi_peak = 0; - var data_noise_peak = 0; - var data_rate_peak = 0; - - for (var i = data_stamp ? 0 : 1; i < data.length; i++) - { - /* skip overlapping entries */ - if (data[i][TIME] <= data_stamp) - continue; - - data_rssi.push(data[i][RSSI] - noise_floor); - data_noise.push(data[i][NOISE] - noise_floor); - data_rate.push(Math.floor(data[i][RATE] / 1000)); - } - - /* cut off outdated entries */ - data_rssi = data_rssi.slice(data_rssi.length - data_wanted, data_rssi.length); - data_noise = data_noise.slice(data_noise.length - data_wanted, data_noise.length); - data_rate = data_rate.slice(data_rate.length - data_wanted, data_rate.length); - - /* find peak */ - for (var i = 0; i < data_rssi.length; i++) - { - data_max = Math.max(data_max, data_rssi[i]); - data_max_2 = Math.max(data_max_2, data_rate[i]); - - data_rssi_peak = Math.max(data_rssi_peak, data_rssi[i]); - data_noise_peak = Math.max(data_noise_peak, data_noise[i]); - data_rate_peak = Math.max(data_rate_peak, data_rate[i]); - - if (i > 0) - { - data_rssi_avg = (data_rssi_avg + data_rssi[i]) / 2; - data_noise_avg = (data_noise_avg + data_noise[i]) / 2; - data_rate_avg = (data_rate_avg + data_rate[i]) / 2; - } - else - { - data_rssi_avg = data_rssi[i]; - data_noise_avg = data_noise[i]; - data_rate_avg = data_rate[i]; - } - } - - /* remember current timestamp, calculate horizontal scale */ - data_stamp = data[data.length-1][TIME]; - data_scale = (height / (data_max * 1.1)).toFixed(1); - data_scale_2 = (height / (data_max_2 * 1.1)).toFixed(1); - - /* plot data */ - var pt_rssi = '0,' + height; - var pt_noise = '0,' + height; - var pt_rate = '0,' + height; - - var y_rssi = 0; - var y_noise = 0; - var y_rate = 0; - - for (var i = 0; i < data_rssi.length; i++) - { - var x = i * step; - - y_rssi = height - Math.floor(data_rssi[i] * data_scale); - y_noise = height - Math.floor(data_noise[i] * data_scale); - y_rate = height - Math.floor(data_rate[i] * data_scale_2); - - y_rssi -= Math.floor(y_rssi % (1/data_scale)); - y_noise -= Math.floor(y_noise % (1/data_scale)); - - pt_rssi += ' ' + x + ',' + y_rssi; - pt_noise += ' ' + x + ',' + y_noise; - pt_rate += ' ' + x + ',' + y_rate; - } - - pt_rssi += ' ' + width + ',' + y_rssi + ' ' + width + ',' + height; - pt_noise += ' ' + width + ',' + y_noise + ' ' + width + ',' + height; - pt_rate += ' ' + width + ',' + y_rate + ' ' + width + ',' + height; - - line_rssi.setAttribute('points', pt_rssi); - line_noise.setAttribute('points', pt_noise); - line_rate.setAttribute('points', pt_rate); - - function wireless_label(dbm, noise) - { - if (noise) - return String.format("%d <%:dBm%> (SNR %d <%:dB%>)", noise_floor + dbm - 255, dbm - noise); - else - return String.format("%d <%:dBm%>", noise_floor + dbm - 255); - } - - function rate_label(mbit) - { - return String.format("%d <%:Mbit/s%>", mbit); - } - - label_25.firstChild.data = wireless_label(1.1 * 0.25 * data_max); - label_50.firstChild.data = wireless_label(1.1 * 0.50 * data_max); - label_75.firstChild.data = wireless_label(1.1 * 0.75 * data_max); - - label_25_2.firstChild.data = rate_label(1.1 * 0.25 * data_max_2); - label_50_2.firstChild.data = rate_label(1.1 * 0.50 * data_max_2); - label_75_2.firstChild.data = rate_label(1.1 * 0.75 * data_max_2); - - label_rssi_cur.innerHTML = wireless_label(data_rssi[data_rssi.length-1], data_noise[data_noise.length-1]).nobr(); - label_noise_cur.innerHTML = wireless_label(data_noise[data_noise.length-1]).nobr(); - - label_rssi_avg.innerHTML = wireless_label(data_rssi_avg, data_noise_avg).nobr(); - label_noise_avg.innerHTML = wireless_label(data_noise_avg).nobr(); - - label_rssi_peak.innerHTML = wireless_label(data_rssi_peak, data_noise_peak).nobr(); - label_noise_peak.innerHTML = wireless_label(data_noise_peak).nobr(); - - label_rate_cur.innerHTML = rate_label(data_rate[data_rate.length-1]); - label_rate_avg.innerHTML = rate_label(data_rate_avg); - label_rate_peak.innerHTML = rate_label(data_rate_peak); - } - ); - - XHR.run(); - } - }, 1000 - ); -//]]></script> - -<h2 name="content"><%:Realtime Wireless%></h2> - -<ul class="cbi-tabmenu"> - <% for _, dev in ipairs(devices) do %> - <li class="cbi-tab<%= dev == curdev and "" or "-disabled" %>"><a href="?dev=<%=pcdata(dev)%>"><%=pcdata(dev)%></a></li> - <% end %> -</ul> - -<embed id="iwsvg" style="width:100%; height:300px; border:1px solid #000000; background-color:#FFFFFF" src="<%=resource%>/wireless.svg" /> -<div style="text-align:right"><small id="scale">-</small></div> -<br /> - -<div class="table" style="width:100%; table-layout:fixed" cellspacing="5"> - <div class="tr"> - <div class="td" style="text-align:right; vertical-align:top"><strong style="border-bottom:2px solid blue"><%:Signal:%></strong></div> - <div class="td" id="rssi_bw_cur">0 <%:dBm%></div> - - <div class="td" style="text-align:right; vertical-align:top"><strong><%:Average:%></strong></div> - <div class="td" id="rssi_bw_avg">0 <%:dBm%></div> - - <div class="td" style="text-align:right; vertical-align:top"><strong><%:Peak:%></strong></div> - <div class="td" id="rssi_bw_peak">0 <%:dBm%></div> - </div> - <div class="tr"> - <div class="td" style="text-align:right; vertical-align:top"><strong style="border-bottom:2px solid red"><%:Noise:%></strong></div> - <div class="td" id="noise_bw_cur">0 <%:dBm%></div> - - <div class="td" style="text-align:right; vertical-align:top"><strong><%:Average:%></strong></div> - <div class="td" id="noise_bw_avg">0 <%:dBm%></div> - - <div class="td" style="text-align:right; vertical-align:top"><strong><%:Peak:%></strong></div> - <div class="td" id="noise_bw_peak">0 <%:dBm%></div> - </div> -</div> - -<br /> - -<embed id="iwsvg2" style="width:100%; height:300px; border:1px solid #000000; background-color:#FFFFFF" src="<%=resource%>/wifirate.svg" /> -<div style="text-align:right"><small id="scale2">-</small></div> -<br /> - -<div class="table" style="width:100%; table-layout:fixed" cellspacing="5"> - <div class="tr"> - <div class="td" style="text-align:right; vertical-align:top"><strong style="border-bottom:2px solid green"><%:Phy Rate:%></strong></div> - <div class="td" id="rate_bw_cur">0 MBit/s</div> - - <div class="td" style="text-align:right; vertical-align:top"><strong><%:Average:%></strong></div> - <div class="td" id="rate_bw_avg">0 MBit/s</div> - - <div class="td" style="text-align:right; vertical-align:top"><strong><%:Peak:%></strong></div> - <div class="td" id="rate_bw_peak">0 MBit/s</div> - </div> -</div> - -<%+footer%> diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_system/applyreboot.htm b/modules/luci-mod-admin-full/luasrc/view/admin_system/applyreboot.htm deleted file mode 100644 index e235bd4679..0000000000 --- a/modules/luci-mod-admin-full/luasrc/view/admin_system/applyreboot.htm +++ /dev/null @@ -1,53 +0,0 @@ -<%# - Copyright 2008 Steven Barth <steven@midlink.org> - Copyright 2008 Jo-Philipp Wich <jow@openwrt.org> - Licensed to the public under the Apache License 2.0. --%> - -<html> - <head> - <title><%=luci.sys.hostname()%> - <%= title or translate("Rebooting...") %></title> - <link rel="stylesheet" type="text/css" media="screen" href="<%=media%>/cascade.css" /> - <script type="text/javascript" src="<%=resource%>/xhr.js"></script> - <script type="text/javascript">//<![CDATA[ - var interval = window.setInterval(function() { - var img = new Image(); - var target = ('https:' == document.location.protocol ? 'https://' : 'http://') + <%=addr and "'%s'" % addr or "window.location.host"%>; - - img.onload = function() { - window.clearInterval(interval); - window.location.replace(target); - }; - - img.src = target + '<%=resource%>/icons/loading.gif?' + Math.random(); - - }, 5000); - //]]></script> - </head> - <body> - <header> - <div class="fill"> - <div class="container"> - <p class="brand"><%=luci.sys.hostname() or "?"%></p> - </div> - </div> - </header> -   - <div class="main"> - <div id="maincontainer"> - <div id="maincontent" class="container"> - <h2 name="content" id="applyreboot-container" ><%:System%> - <%= title or translate("Rebooting...") %></h2> - <div class="cbi-section" id="applyreboot-section"> - <div> - <%= msg or translate("Changes applied.") %> - </div> - <div> - <img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle" /> - <%:Waiting for changes to be applied...%> - </div> - </div> - </div> - </div> - </div> - </body> -</html>
\ No newline at end of file diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_system/backupfiles.htm b/modules/luci-mod-admin-full/luasrc/view/admin_system/backupfiles.htm deleted file mode 100644 index c1f3361ae2..0000000000 --- a/modules/luci-mod-admin-full/luasrc/view/admin_system/backupfiles.htm +++ /dev/null @@ -1,10 +0,0 @@ -<%# - Copyright 2008 Steven Barth <steven@midlink.org> - Copyright 2008 Jo-Philipp Wich <jow@openwrt.org> - Licensed to the public under the Apache License 2.0. --%> - -<ul class="cbi-tabmenu"> - <li class="cbi-tab-disabled"><a href="<%=url("admin/system/flashops")%>"><%:Actions%></a></li> - <li class="cbi-tab"><a href="#"><%:Configuration%></a></li> -</ul> diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_system/clock_status.htm b/modules/luci-mod-admin-full/luasrc/view/admin_system/clock_status.htm deleted file mode 100644 index 37d8ae0e85..0000000000 --- a/modules/luci-mod-admin-full/luasrc/view/admin_system/clock_status.htm +++ /dev/null @@ -1,36 +0,0 @@ -<%+cbi/valueheader%> - -<script type="text/javascript">//<![CDATA[ - XHR.poll(5, '<%=url('admin/system/clock_status')%>', null, - function(x, rv) - { - var s = document.getElementById('<%=self.option%>-clock-status'); - if (s) - { - s.innerHTML = rv.timestring || '?'; - } - } - ); - - function sync_clock(btn) - { - btn.disabled = true; - btn.value = '<%:Synchronizing...%>'; - - (new XHR()).post('<%=url('admin/system/clock_status')%>', - { token: '<%=token%>', set: Math.floor((new Date()).getTime() / 1000) }, - function() - { - btn.disabled = false; - btn.value = '<%:Sync with browser%>'; - } - ); - - return false; - } -//]]></script> - -<span id="<%=self.option%>-clock-status"><em><%:Collecting data...%></em></span> -<input type="button" class="cbi-button cbi-button-apply" value="<%:Sync with browser%>" onclick="return sync_clock(this)" /> - -<%+cbi/valuefooter%> diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_system/flashops.htm b/modules/luci-mod-admin-full/luasrc/view/admin_system/flashops.htm deleted file mode 100644 index 8204d38e34..0000000000 --- a/modules/luci-mod-admin-full/luasrc/view/admin_system/flashops.htm +++ /dev/null @@ -1,137 +0,0 @@ -<%# - Copyright 2008 Steven Barth <steven@midlink.org> - Copyright 2008-2015 Jo-Philipp Wich <jow@openwrt.org> - Licensed to the public under the Apache License 2.0. --%> - -<%+header%> - -<h2 name="content"><%:Flash operations%></h2> - -<ul class="cbi-tabmenu"> - <li class="cbi-tab"><a href="#"><%:Actions%></a></li> - <li class="cbi-tab-disabled"><a href="<%=url('admin/system/flashops/backupfiles')%>"><%:Configuration%></a></li> -</ul> - -<div class="cbi-section"> - <h3><%:Backup%></h3> - <div class="cbi-section-descr"><%:Click "Generate archive" to download a tar archive of the current configuration files.%></div> - <div class="cbi-section-node"> - <form class="inline" method="post" action="<%=url('admin/system/flashops/backup')%>"> - <input type="hidden" name="token" value="<%=token%>" /> - <div class="cbi-value<% if not reset_avail then %> cbi-value-last<% end %>"> - <label class="cbi-value-title" for="image"><%:Download backup%></label> - <div class="cbi-value-field"> - <input class="cbi-button cbi-button-action important" type="submit" name="backup" value="<%:Generate archive%>" /> - </div> - </div> - </form> - </div> - - <h3><%:Restore%></h3> - <div class="cbi-section-descr"><%:To restore configuration files, you can upload a previously generated backup archive here. To reset the firmware to its initial state, click "Perform reset" (only possible with squashfs images).%></div> - <div class="cbi-section-node"> - <% if reset_avail then %> - <form class="inline" method="post" action="<%=url('admin/system/flashops/reset')%>"> - <input type="hidden" name="token" value="<%=token%>" /> - <div class="cbi-value cbi-value-last"> - <label class="cbi-value-title"><%:Reset to defaults%></label> - <div class="cbi-value-field"> - <input onclick="return confirm('<%:Really reset all changes?%>')" class="cbi-button cbi-button-reset" type="submit" name="reset" value="<%:Perform reset%>" /> - </div> - </div> - </form> - <% end %> - <form class="inline" method="post" action="<%=url('admin/system/flashops/restore')%>" enctype="multipart/form-data"> - <div class="cbi-value cbi-value-last"> - <label class="cbi-value-title" for="archive"><%:Restore backup%></label> - <div class="cbi-value-field"> - <input type="hidden" name="token" value="<%=token%>" /> - <input type="file" name="archive" id="archive" /> - <input type="submit" class="cbi-button cbi-button-action important" name="restore" value="<%:Upload archive...%>" /> - <% if reset_avail then %> - <div class="cbi-value-description"><%:Custom files (certificates, scripts) may remain on the system. To prevent this, perform a factory-reset first.%></div> - <% end %> - </div> - </div> - </form> - <% if backup_invalid then %> - <div class="cbi-section-error"><%:The backup archive does not appear to be a valid gzip file.%></div> - <% end %> - </div> - - <% local mtds = require("luci.sys").mtds(); if #mtds > 0 then -%> - <h3><%:Save mtdblock contents%></h3> - <div class="cbi-section-descr"><%:Click "Save mtdblock" to download specified mtdblock file. (NOTE: THIS FEATURE IS FOR PROFESSIONALS! )%></div> - <div class="cbi-section-node"> - <form class="inline" method="post" action="<%=url('admin/system/flashops/backupmtdblock')%>"> - <input type="hidden" name="token" value="<%=token%>" /> - <div class="cbi-value"> - <label class="cbi-value-title" for="mtdblockname"><%:Choose mtdblock%></label> - <div class="cbi-value-field"> - <select class="cbi-input-select" data-update="change" name="mtdblockname" id="mtdblockname"> - <% for i, key in ipairs(mtds) do - if key and key.name ~= "rootfs_data" then -%> - <option<%= - attr("id", "mtdblockname-" .. key.name) .. - attr("value", key.name .. '/'.. key.size .. '/' .. i - 1) .. - attr("data-index", i) .. - ifattr(key.name == "linux" or key.name == "firmware", "selected", "selected") - %>><%=pcdata(key.name)%></option> - <% end - end -%> - </select> - </div> - </div> - <div class="cbi-value cbi-value-last<% if reset_avail then %> cbi-value-error<% end %>"> - <label class="cbi-value-title" for="image"><%:Download mtdblock%></label> - <div class="cbi-value-field"> - <input type="submit" class="cbi-button cbi-button-action important" value="<%:Save mtdblock%>" /> - </div> - </div> - </form> - </div> - <% end %> - -</div> - -<div class="cbi-section"> - <h3><%:Flash new firmware image%></h3> - <% if upgrade_avail then %> - <form method="post" action="<%=url('admin/system/flashops/sysupgrade')%>" enctype="multipart/form-data"> - <input type="hidden" name="token" value="<%=token%>" /> - <div class="cbi-section-descr"><%:Upload a sysupgrade-compatible image here to replace the running firmware. Check "Keep settings" to retain the current configuration (requires a compatible firmware image).%></div> - <div class="cbi-section-node"> - <div class="cbi-value"> - <label class="cbi-value-title" for="keep"><%:Keep settings%></label> - <div class="cbi-value-field"> - <input type="checkbox" name="keep" id="keep" checked="checked" /> - </div> - </div> - <% if image_invalid then %> - <div class="cbi-value"> - <label class="cbi-value-title" for="force"><%:Force upgrade%></label> - <div class="cbi-value-field"> - <input type="checkbox" name="force" id="force" /> - </div> - <div class="cbi-section-error"> - <%:The uploaded image file does not contain a supported format. Make sure that you choose the generic image format for your platform. %> - <%:Select 'Force upgrade' to flash the image even if the image format check fails. Use only if you are sure that the firmware is correct and meant for your device! %> - </div> - </div> - <% end %> - <div class="cbi-value cbi-value-last<% if image_invalid then %> cbi-value-error<% end %>"> - <label class="cbi-value-title" for="image"><%:Image%></label> - <div class="cbi-value-field"> - <input type="file" name="image" id="image" /> - <input type="submit" class="cbi-button cbi-button-action important" value="<%:Flash image...%>" /> - </div> - </div> - </div> - </form> - <% else %> - <div class="cbi-section-descr"><%:Sorry, there is no sysupgrade support present; a new firmware image must be flashed manually. Please refer to the wiki for device specific install instructions.%></div> - <% end %> -</div> - -<%+footer%> diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_system/ipkg.htm b/modules/luci-mod-admin-full/luasrc/view/admin_system/ipkg.htm deleted file mode 100644 index a7ff4e50bd..0000000000 --- a/modules/luci-mod-admin-full/luasrc/view/admin_system/ipkg.htm +++ /dev/null @@ -1,10 +0,0 @@ -<%# - Copyright 2008 Steven Barth <steven@midlink.org> - Copyright 2008 Jo-Philipp Wich <jow@openwrt.org> - Licensed to the public under the Apache License 2.0. --%> - -<ul class="cbi-tabmenu"> - <li class="cbi-tab-disabled"><a href="<%=url("admin/system/packages")%>"><%:Actions%></a></li> - <li class="cbi-tab"><a href="#"><%:Configuration%></a></li> -</ul> diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_system/packages.htm b/modules/luci-mod-admin-full/luasrc/view/admin_system/packages.htm deleted file mode 100644 index 280eabb8ea..0000000000 --- a/modules/luci-mod-admin-full/luasrc/view/admin_system/packages.htm +++ /dev/null @@ -1,213 +0,0 @@ -<%# - Copyright 2008 Steven Barth <steven@midlink.org> - Copyright 2008-2010 Jo-Philipp Wich <jow@openwrt.org> - Licensed to the public under the Apache License 2.0. --%> - -<%- -local opkg = require "luci.model.ipkg" -local fs = require "nixio.fs" -local wa = require "luci.tools.webadmin" -local rowcnt = 1 - -function rowstyle() - rowcnt = rowcnt + 1 - return (rowcnt % 2) + 1 -end - -local fstat = fs.statvfs(opkg.overlay_root()) -local space_total = fstat and fstat.blocks or 0 -local space_free = fstat and fstat.bfree or 0 -local space_used = space_total - space_free - -local used_perc = math.floor(0.5 + ((space_total > 0) and ((100 / space_total) * space_used) or 100)) -local free_byte = space_free * fstat.frsize - -local filter = { } - - -local opkg_list = luci.model.ipkg.list_all -local querypat -if query and #query > 0 then - querypat = '*%s*' % query - opkg_list = luci.model.ipkg.find -end - -local letterpat -if letter == 35 then - letterpat = "[^a-z]*" -else - letterpat = string.char(letter, 42) -- 'A' '*' -end - --%> - -<%+header%> - - -<h2 name="content"><%:Software%></h2> - -<div class="cbi-map"> - - <ul class="cbi-tabmenu"> - <li class="cbi-tab"><a href="#"><%:Actions%></a></li> - <li class="cbi-tab-disabled"><a href="<%=REQUEST_URI%>/ipkg"><%:Configuration%></a></li> - </ul> - - <form method="post" action="<%=REQUEST_URI%>"> - <input type="hidden" name="exec" value="1" /> - <input type="hidden" name="token" value="<%=token%>" /> - - <div class="cbi-section"> - <div class="cbi-section-node"> - <% if (install and next(install)) or (remove and next(remove)) or update or upgrade then %> - <div class="cbi-value"> - <% if #stdout > 0 then %><pre><%=pcdata(stdout)%></pre><% end %> - <% if #stderr > 0 then %><pre class="error"><%=pcdata(stderr)%></pre><% end %> - </div> - <% end %> - - <% if querypat then %> - <div class="cbi-value"> - <%:Displaying only packages containing%> <strong>"<%=pcdata(query)%>"</strong> - <input type="button" onclick="location.href='?display=<%=luci.http.urlencode(display)%>'" href="#" class="cbi-button cbi-button-reset" style="margin-left:1em" value="<%:Reset%>" /> - <br style="clear:both" /> - </div> - <% end %> - - <% if no_lists or old_lists then %> - <div class="cbi-value"> - <% if old_lists then %> - <%:Package lists are older than 24 hours%> - <% else %> - <%:No package lists available%> - <% end %> - <input type="submit" name="update" href="#" class="cbi-button cbi-button-apply" style="margin-left:3em" value="<%:Update lists%>" /> - </div> - <% end %> - - <div class="cbi-value cbi-value-last"> - <%:Free space%>: <strong><%=(100-used_perc)%>%</strong> (<strong><%=wa.byte_format(free_byte)%></strong>) - <div style="margin:3px 0; width:300px; height:10px; border:1px solid #000000; background-color:#80C080"> - <div style="background-color:#F08080; border-right:1px solid #000000; height:100%; width:<%=used_perc%>%"> </div> - </div> - </div> - </div> - - <br /> - - <div class="cbi-section-node"> - <input type="hidden" name="display" value="<%=pcdata(display)%>" /> - - <div class="cbi-value"> - <label class="cbi-value-title"><%:Download and install package%>:</label> - <div class="cbi-value-field"> - <span><input type="text" name="url" size="30" value="" /></span> - <input class="cbi-button cbi-button-save" type="submit" name="go" value="<%:OK%>" /> - </div> - </div> - - <div class="cbi-value cbi-value-last"> - <label class="cbi-value-title"><%:Filter%>:</label> - <div class="cbi-value-field"> - <span><input type="text" name="query" size="20" value="<%=pcdata(query)%>" /></span> - <input type="submit" class="cbi-button cbi-button-action" name="search" value="<%:Find package%>" /> - </div> - </div> - </div> - </div> - </form> - - - <h3><%:Status%></h3> - - - <ul class="cbi-tabmenu"> - <li class="cbi-tab<% if display ~= "available" then %>-disabled<% end %>"><a href="?display=available&query=<%=pcdata(query)%>"><%:Available packages%><% if query then %> (<%=pcdata(query)%>)<% end %></a></li> - <li class="cbi-tab<% if display ~= "installed" then %>-disabled<% end %>"><a href="?display=installed&query=<%=pcdata(query)%>"><%:Installed packages%><% if query then %> (<%=pcdata(query)%>)<% end %></a></li> - </ul> - - <% if display ~= "available" then %> - <div class="cbi-section"> - <div class="cbi-section-node"> - <div class="table"> - <div class="tr cbi-section-table-titles"> - <div class="th left"><%:Package name%></div> - <div class="th left"><%:Version%></div> - <div class="th cbi-section-actions"> </div> - </div> - <% local empty = true; luci.model.ipkg.list_installed(querypat, function(n, v, s, d) empty = false; filter[n] = true %> - <div class="tr cbi-rowstyle-<%=rowstyle()%>"> - <div class="td left"><%=luci.util.pcdata(n)%></div> - <div class="td left"><%=luci.util.pcdata(v)%></div> - <div class="td cbi-section-actions"> - <form method="post" class="inline" action="<%=REQUEST_URI%>"> - <input type="hidden" name="exec" value="1" /> - <input type="hidden" name="token" value="<%=token%>" /> - <input type="hidden" name="remove" value="<%=pcdata(n)%>" /> - <input class="cbi-button cbi-button-remove" type="submit" onclick="window.confirm('<%:Remove%> "<%=luci.util.pcdata(n)%>" ?') && this.parentNode.submit(); return false" value="<%:Remove%>" /> - </form> - </div> - </div> - <% end) %> - <% if empty then %> - <div class="tr cbi-section-table-row"> - <div class="td left"> </div> - <div class="td left"><em><%:none%></em></div> - <div class="td left"><em><%:none%></em></div> - </div> - <% end %> - </div> - </div> - </div> - <% else %> - <div class="cbi-section"> - <% if not querypat then %> - <ul class="cbi-tabmenu" style="flex-wrap:wrap"> - <% local i; for i = 65, 90 do %> - <li class="cbi-tab<% if letter ~= i then %>-disabled<% end %>"><a href="?display=available&letter=<%=string.char(i)%>"><%=string.char(i)%></a></li> - <% end %> - <li class="cbi-tab<% if letter ~= 35 then %>-disabled<% end %>"><a href="?display=available&letter=%23">#</a></li> - </ul> - <% end %> - <div class="cbi-section-node cbi-section-node-tabbed"> - <div class="table"> - <div class="tr cbi-section-table-titles"> - <div class="th col-2 left"><%:Package name%></div> - <div class="th col-2 left"><%:Version%></div> - <div class="th col-1 center"><%:Size (.ipk)%></div> - <div class="th col-10 left"><%:Description%></div> - <div class="th cbi-section-actions"> </div> - </div> - <% local empty = true; opkg_list(querypat or letterpat, function(n, v, s, d) if filter[n] then return end; empty = false %> - <div class="tr cbi-rowstyle-<%=rowstyle()%>"> - <div class="td col-2 left"><%=luci.util.pcdata(n)%></div> - <div class="td col-2 left"><%=luci.util.pcdata(v)%></div> - <div class="td col-1 center"><%=luci.util.pcdata(s)%></div> - <div class="td col-10 left"><%=luci.util.pcdata(d)%></div> - <div class="td cbi-section-actions"> - <form method="post" class="inline" action="<%=REQUEST_URI%>"> - <input type="hidden" name="exec" value="1" /> - <input type="hidden" name="token" value="<%=token%>" /> - <input type="hidden" name="install" value="<%=pcdata(n)%>" /> - <input class="cbi-button cbi-button-apply" type="submit" onclick="window.confirm('<%:Install%> "<%=luci.util.pcdata(n)%>" ?') && this.parentNode.submit(); return false" value="<%:Install%>" /> - </form> - </div> - </div> - <% end) %> - <% if empty then %> - <div class="tr"> - <div class="td left"> </div> - <div class="td left"><em><%:none%></em></div> - <div class="td left"><em><%:none%></em></div> - <div class="td right"><em><%:none%></em></div> - <div class="td left"><em><%:none%></em></div> - </div> - <% end %> - </div> - </div> - </div> - <% end %> -</div> - -<%+footer%> diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_system/reboot.htm b/modules/luci-mod-admin-full/luasrc/view/admin_system/reboot.htm deleted file mode 100644 index d23664adac..0000000000 --- a/modules/luci-mod-admin-full/luasrc/view/admin_system/reboot.htm +++ /dev/null @@ -1,62 +0,0 @@ -<%# - Copyright 2008 Steven Barth <steven@midlink.org> - Copyright 2008-2015 Jo-Philipp Wich <jow@openwrt.org> - Licensed to the public under the Apache License 2.0. --%> - -<%+header%> - -<h2 name="content"><%:Reboot%></h2> - -<p><%:Reboots the operating system of your device%></p> - -<%- local c = require("luci.model.uci").cursor():changes(); if c and next(c) then -%> - <p class="alert-message warning"><%:Warning: There are unsaved changes that will get lost on reboot!%></p> -<%- end -%> - -<hr /> - -<input class="cbi-button cbi-button-action important" type="button" value="<%:Perform reboot%>" onclick="reboot(this)" /> - -<p class="alert-message notice reboot-message" style="display:none"> - <img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle" /> - <span><%:Device is rebooting...%></span> -</p> - -<script type="text/javascript">//<![CDATA[ - var tries = 0, - message = document.querySelector('p.reboot-message'), - label = message.querySelector('span'); - - function ok() { - window.location = '<%=url("admin")%>'; - } - - function check() { - window.setTimeout(ping, 5000); - } - - function ping() { - var img = document.createElement('img'); - - img.onload = ok; - img.onerror = check; - img.src = '<%=resource%>/icons/loading.gif?' + Math.random(); - - if (tries++ >= 30) { - message.classList.remove('notice'); - message.classList.add('warning'); - label.innerHTML = '<%:Device unreachable! Still waiting for device...%>'; - } - } - - function reboot(button) { - button.style.display = 'none'; - message.style.display = ''; - label.innerHTML = '<%:Waiting for device...%>'; - - (new XHR()).post('<%=url("admin/system/reboot/call")%>', { token: '<%=token%>' }, check); - } -//]]></script> - -<%+footer%> diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_system/upgrade.htm b/modules/luci-mod-admin-full/luasrc/view/admin_system/upgrade.htm deleted file mode 100644 index 597ddfd6bf..0000000000 --- a/modules/luci-mod-admin-full/luasrc/view/admin_system/upgrade.htm +++ /dev/null @@ -1,65 +0,0 @@ -<%# - Copyright 2008 Steven Barth <steven@midlink.org> - Copyright 2008-2009 Jo-Philipp Wich <jow@openwrt.org> - Licensed to the public under the Apache License 2.0. --%> - -<%+header%> - -<h2 name="content"><%:Flash Firmware%> - <%:Verify%></h2> -<p> - <%_ The flash image was uploaded. - Below is the checksum and file size listed, - compare them with the original file to ensure data integrity.<br /> - Click "Proceed" below to start the flash procedure. %> - - <% if storage > 0 and size > storage then %> - <br /><br /> - <div class="error"><%:It appears that you are trying to - flash an image that does not fit into the flash memory, please verify - the image file! %></div> - <% end %> - -</p> - -<div class="cbi-section"> - <ul> - <li><%:Checksum%><br /> - <%:MD5%>: <code><%=checksum%></code><br /> - <%:SHA256%>: <code><%=sha256ch%></code></li> - <li><%:Size%>: <% - local w = require "luci.tools.webadmin" - write(w.byte_format(size)) - - if storage > 0 then - write(luci.i18n.translatef( - " (%s available)", - w.byte_format(storage) - )) - end - %></li> - <li><% if keep then %> - <%:Configuration files will be kept%> - <% else %> - <%:Caution: Configuration files will be erased%> - <% end %></li> - <% if force then %> - <li> - <%:Caution: System upgrade will be forced%> - </li> - <% end %> - </ul> -</div> - -<div class="cbi-page-actions right"> - <form class="inline" action="<%=REQUEST_URI%>" method="post"> - <input type="hidden" name="token" value="<%=token%>" /> - <input type="hidden" name="step" value="2" /> - <input type="hidden" name="keep" value="<%=keep and "1" or ""%>" /> - <input type="hidden" name="force" value="<%=force and "1" or ""%>" /> - <input class="cbi-button cbi-button-reset" name="cancel" type="submit" value="<%:Cancel%>" /> - <input class="cbi-button cbi-button-apply" type="submit" value="<%:Proceed%>" /> - </form> -</div> - -<%+footer%> diff --git a/modules/luci-mod-admin-full/luasrc/view/cbi/wireless_modefreq.htm b/modules/luci-mod-admin-full/luasrc/view/cbi/wireless_modefreq.htm deleted file mode 100644 index ebb02e489b..0000000000 --- a/modules/luci-mod-admin-full/luasrc/view/cbi/wireless_modefreq.htm +++ /dev/null @@ -1,168 +0,0 @@ -<%+cbi/valueheader%> - -<script type="text/javascript">//<![CDATA[ - var freqlist = <%= luci.http.write_json(self.iwinfo.freqlist) %>; - var hwmodes = <%= luci.http.write_json(self.iwinfo.hwmodelist or {}) %>; - var htmodes = <%= luci.http.write_json(self.iwinfo.htmodelist) %>; - - var channels = { - '11g': [ - 'auto', 'auto', true - ], - '11a': [ - 'auto', 'auto', true - ] - }; - - for (var i = 0; i < freqlist.length; i++) - channels[(freqlist[i].mhz > 2484) ? '11a' : '11g'].push( - freqlist[i].channel, - '%d (%d MHz)'.format(freqlist[i].channel, freqlist[i].mhz), - !freqlist[i].restricted - ); - - var modes = [ - '', 'Legacy', true, - 'n', 'N', hwmodes.n, - 'ac', 'AC', hwmodes.ac - ]; - - var htmodes = { - '': [ - '', '-', true - ], - 'n': [ - 'HT20', '20 MHz', htmodes.HT20, - 'HT40', '40 MHz', htmodes.HT40 - ], - 'ac': [ - 'VHT20', '20 MHz', htmodes.VHT20, - 'VHT40', '40 MHz', htmodes.VHT40, - 'VHT80', '80 MHz', htmodes.VHT80, - 'VHT160', '160 MHz', htmodes.VHT160 - ] - }; - - var bands = { - '': [ - '11g', '2.4 GHz', (channels['11g'].length > 3), - '11a', '5 GHz', (channels['11a'].length > 3) - ], - 'n': [ - '11g', '2.4 GHz', (channels['11g'].length > 3), - '11a', '5 GHz', (channels['11a'].length > 3) - ], - 'ac': [ - '11a', '5 GHz', true - ] - }; - - function cbi_set_values(sel, vals) - { - if (sel.vals) - sel.vals.selected = sel.selectedIndex; - - while (sel.options[0]) - sel.remove(0); - - for (var i = 0; vals && i < vals.length; i += 3) - { - if (!vals[i+2]) - continue; - - var opt = document.createElement('option'); - opt.value = vals[i+0]; - opt.text = vals[i+1]; - - sel.add(opt); - } - - if (!isNaN(vals.selected)) - sel.selectedIndex = vals.selected; - - sel.parentNode.style.display = (sel.options.length <= 1) ? 'none' : ''; - sel.vals = vals; - } - - function cbi_toggle_wifi_mode(id) - { - cbi_toggle_wifi_htmode(id); - cbi_toggle_wifi_band(id); - } - - function cbi_toggle_wifi_htmode(id) - { - var mode = document.getElementById(id + '.mode'); - var bwdt = document.getElementById(id + '.htmode'); - - cbi_set_values(bwdt, htmodes[mode.value]); - } - - function cbi_toggle_wifi_band(id) - { - var mode = document.getElementById(id + '.mode'); - var band = document.getElementById(id + '.band'); - - cbi_set_values(band, bands[mode.value]); - cbi_toggle_wifi_channel(id); - } - - function cbi_toggle_wifi_channel(id) - { - var band = document.getElementById(id + '.band'); - var chan = document.getElementById(id + '.channel'); - - cbi_set_values(chan, channels[band.value]); - } - - function cbi_init_wifi(id) - { - var mode = document.getElementById(id + '.mode'); - var band = document.getElementById(id + '.band'); - var chan = document.getElementById(id + '.channel'); - var bwdt = document.getElementById(id + '.htmode'); - - cbi_set_values(mode, modes); - - if (/VHT20|VHT40|VHT80|VHT160/.test(<%= luci.http.write_json(self.map:get(section, "htmode")) %>)) - mode.value = 'ac'; - else if (/HT20|HT40/.test(<%= luci.http.write_json(self.map:get(section, "htmode")) %>)) - mode.value = 'n'; - else - mode.value = ''; - - cbi_toggle_wifi_mode(id); - - if (/a/.test(<%= luci.http.write_json(self.map:get(section, "hwmode")) %>)) - band.value = '11a'; - else - band.value = '11g'; - - cbi_toggle_wifi_band(id); - - bwdt.value = <%= luci.http.write_json(self.map:get(section, "htmode")) %>; - chan.value = <%= luci.http.write_json(self.map:get(section, "channel")) %>; - } -//]]></script> - -<label style="float:left; margin-right:3px"> - <%:Mode%><br /> - <select style="width:auto" id="<%= cbid %>.mode" name="<%= cbid %>.mode" onchange="cbi_toggle_wifi_mode('<%= cbid %>')"></select> -</label> -<label style="float:left; margin-right:3px"> - <%:Band%><br /> - <select style="width:auto" id="<%= cbid %>.band" name="<%= cbid %>.band" onchange="cbi_toggle_wifi_band('<%= cbid %>')"></select> -</label> -<label style="float:left; margin-right:3px"> - <%:Channel%><br /> - <select style="width:auto" id="<%= cbid %>.channel" name="<%= cbid %>.channel"></select> -</label> -<label style="float:left; margin-right:3px"> - <%:Width%><br /> - <select style="width:auto" id="<%= cbid %>.htmode" name="<%= cbid %>.htmode"></select> -</label> -<br style="clear:left" /> - -<script type="text/javascript">cbi_init_wifi('<%= cbid %>');</script> - -<%+cbi/valuefooter%> |