summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-mod-admin-full/luasrc/view/admin_network
diff options
context:
space:
mode:
authorDaniel F. Dickinson <cshored@thecshore.com>2018-08-03 12:36:51 -0400
committerJo-Philipp Wich <jo@mein.io>2018-09-19 20:08:19 +0200
commit58d97b5e271bc0d7507eab5b9bd2902181864e02 (patch)
tree80e250346ad33c79b3f821daf7b7d9be90d99240 /modules/luci-mod-admin-full/luasrc/view/admin_network
parent6ec0353201435e0d0d7d32820d8ba600b4ca7b5b (diff)
modules: Split luci-mod-full
Move some common elements to luci-base, and otherwise make three packages out of status, system, and network. They were mostly separated already, but there were some shared elements between status and network that are now in luci-base. Signed-off-by: Daniel F. Dickinson <cshored@thecshore.com>
Diffstat (limited to 'modules/luci-mod-admin-full/luasrc/view/admin_network')
-rw-r--r--modules/luci-mod-admin-full/luasrc/view/admin_network/diagnostics.htm117
-rw-r--r--modules/luci-mod-admin-full/luasrc/view/admin_network/iface_overview_status.htm183
-rw-r--r--modules/luci-mod-admin-full/luasrc/view/admin_network/iface_status.htm66
-rw-r--r--modules/luci-mod-admin-full/luasrc/view/admin_network/lease_status.htm95
-rw-r--r--modules/luci-mod-admin-full/luasrc/view/admin_network/switch_status.htm62
-rw-r--r--modules/luci-mod-admin-full/luasrc/view/admin_network/wifi_assoclist.htm82
-rw-r--r--modules/luci-mod-admin-full/luasrc/view/admin_network/wifi_join.htm224
-rw-r--r--modules/luci-mod-admin-full/luasrc/view/admin_network/wifi_overview_status.htm127
-rw-r--r--modules/luci-mod-admin-full/luasrc/view/admin_network/wifi_status.htm77
9 files changed, 0 insertions, 1033 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>&#160;</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>&#160;(%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">&#160;</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%>" />&#160;<br />%d%%&#160;',
- 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%>" />&#160;
- </small>
- <span>
- <em><%:Collecting data...%></em>
- </span>
-</span>
-
-<%+cbi/valuefooter%>