diff options
Diffstat (limited to 'modules/luci-mod-network')
4 files changed, 0 insertions, 287 deletions
diff --git a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/iface_status.js b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/iface_status.js deleted file mode 100644 index 88f48d189a..0000000000 --- a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/iface_status.js +++ /dev/null @@ -1,42 +0,0 @@ -requestAnimationFrame(function() { - document.querySelectorAll('[data-iface-status]').forEach(function(container) { - var network = container.getAttribute('data-iface-status'), - icon = container.querySelector('img'), - info = container.querySelector('span'); - - L.poll(5, L.url('admin/network/iface_status', network), null, function(xhr, ifaces) { - var ifc = Array.isArray(ifaces) ? ifaces[0] : null; - if (!ifc) - return; - - L.itemlist(info, [ - _('Device'), ifc.ifname, - _('Uptime'), ifc.is_up ? '%t'.format(ifc.uptime) : null, - _('MAC'), ifc.ifname ? ifc.macaddr : null, - _('RX'), ifc.ifname ? '%.2mB (%d %s)'.format(ifc.rx_bytes, ifc.rx_packets, _('Pkts.')) : null, - _('TX'), ifc.ifname ? '%.2mB (%d %s)'.format(ifc.tx_bytes, ifc.tx_packets, _('Pkts.')) : null, - _('IPv4'), ifc.ipaddrs ? ifc.ipaddrs[0] : null, - _('IPv4'), ifc.ipaddrs ? ifc.ipaddrs[1] : null, - _('IPv4'), ifc.ipaddrs ? ifc.ipaddrs[2] : null, - _('IPv4'), ifc.ipaddrs ? ifc.ipaddrs[3] : null, - _('IPv4'), ifc.ipaddrs ? ifc.ipaddrs[4] : null, - _('IPv6'), ifc.ip6addrs ? ifc.ip6addrs[0] : null, - _('IPv6'), ifc.ip6addrs ? ifc.ip6addrs[1] : null, - _('IPv6'), ifc.ip6addrs ? ifc.ip6addrs[2] : null, - _('IPv6'), ifc.ip6addrs ? ifc.ip6addrs[3] : null, - _('IPv6'), ifc.ip6addrs ? ifc.ip6addrs[4] : null, - _('IPv6'), ifc.ip6addrs ? ifc.ip6addrs[5] : null, - _('IPv6'), ifc.ip6addrs ? ifc.ip6addrs[6] : null, - _('IPv6'), ifc.ip6addrs ? ifc.ip6addrs[7] : null, - _('IPv6'), ifc.ip6addrs ? ifc.ip6addrs[8] : null, - _('IPv6'), ifc.ip6addrs ? ifc.ip6addrs[9] : null, - _('IPv6-PD'), ifc.ip6prefix, - null, ifc.ifname ? null : E('em', _('Interface not present or not connected yet.')) - ]); - - icon.src = L.resource('icons/%s%s.png').format(ifc.type, ifc.is_up ? '' : '_disabled'); - }); - - L.run(); - }); -}); diff --git a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/network.js b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/network.js deleted file mode 100644 index bab23cc3c7..0000000000 --- a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/network.js +++ /dev/null @@ -1,136 +0,0 @@ -function iface_reconnect(id) { - L.halt(); - L.dom.content(document.getElementById(id + '-ifc-description'), E('em', _('Interface is reconnecting...'))); - L.post(L.url('admin/network/iface_reconnect', id), null, L.run); -} - -function iface_delete(ev) { - if (!confirm(_('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': L.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': L.resource('icons/%s%s.png').format( - ifc.type, ifc.is_up ? '' : '_disabled') }), - L.itemlist(E('span', { 'class': 'left' }), [ - _('Type'), ifc.typename, - _('Device'), ifc.ifname, - _('Connected'), ifc.is_up ? _('yes') : _('no'), - _('MAC'), ifc.macaddr, - _('RX'), '%.2mB (%d %s)'.format(ifc.rx_bytes, ifc.rx_packets, _('Pkts.')), - _('TX'), '%.2mB (%d %s)'.format(ifc.tx_bytes, ifc.tx_packets, _('Pkts.')) - ]) - ]) - ]); -} - -L.poll(5, L.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 s = document.getElementById(ifc.id + '-ifc-devices'); - if (s) { - var c = [ 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(')'); - - c.push(E('span', {}, sifs)); - } - - c.push(E('br')); - c.push(E('small', {}, ifc.is_alias ? _('Alias of "%s"').format(ifc.is_alias) : ifc.name)); - - L.dom.content(s, c); - } - - var d = document.getElementById(ifc.id + '-ifc-description'); - if (d && ifc.proto && ifc.ifname) { - var desc = null, c = []; - - 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; - - L.itemlist(d, [ - _('Protocol'), desc || '?', - _('Uptime'), ifc.is_up ? '%t'.format(ifc.uptime) : null, - _('MAC'), (!ifc.is_dynamic && !ifc.is_alias && ifc.macaddr) ? ifc.macaddr : null, - _('RX'), (!ifc.is_dynamic && !ifc.is_alias) ? '%.2mB (%d %s)'.format(ifc.rx_bytes, ifc.rx_packets, _('Pkts.')) : null, - _('TX'), (!ifc.is_dynamic && !ifc.is_alias) ? '%.2mB (%d %s)'.format(ifc.tx_bytes, ifc.tx_packets, _('Pkts.')) : null, - _('IPv4'), ifc.ipaddrs ? ifc.ipaddrs[0] : null, - _('IPv4'), ifc.ipaddrs ? ifc.ipaddrs[1] : null, - _('IPv4'), ifc.ipaddrs ? ifc.ipaddrs[2] : null, - _('IPv4'), ifc.ipaddrs ? ifc.ipaddrs[3] : null, - _('IPv4'), ifc.ipaddrs ? ifc.ipaddrs[4] : null, - _('IPv6'), ifc.ip6addrs ? ifc.ip6addrs[0] : null, - _('IPv6'), ifc.ip6addrs ? ifc.ip6addrs[1] : null, - _('IPv6'), ifc.ip6addrs ? ifc.ip6addrs[2] : null, - _('IPv6'), ifc.ip6addrs ? ifc.ip6addrs[3] : null, - _('IPv6'), ifc.ip6addrs ? ifc.ip6addrs[4] : null, - _('IPv6'), ifc.ip6addrs ? ifc.ip6addrs[5] : null, - _('IPv6'), ifc.ip6addrs ? ifc.ip6addrs[6] : null, - _('IPv6'), ifc.ip6addrs ? ifc.ip6addrs[7] : null, - _('IPv6'), ifc.ip6addrs ? ifc.ip6addrs[8] : null, - _('IPv6'), ifc.ip6addrs ? ifc.ip6addrs[9] : null, - _('IPv6-PD'), ifc.ip6prefix, - _('Information'), ifc.is_auto ? null : _('Not started on boot'), - _('Error'), ifc.errors ? ifc.errors[0] : null, - _('Error'), ifc.errors ? ifc.errors[1] : null, - _('Error'), ifc.errors ? ifc.errors[2] : null, - _('Error'), ifc.errors ? ifc.errors[3] : null, - _('Error'), ifc.errors ? ifc.errors[4] : null, - ]); - } - else if (d && !ifc.proto) { - var e = document.getElementById(ifc.id + '-ifc-edit'); - if (e) e.disabled = true; - - var link = L.url('admin/system/opkg') + '?query=luci-proto'; - L.dom.content(d, [ - E('em', _('Unsupported protocol type.')), E('br'), - E('a', { href: link }, _('Install protocol extensions...')) - ]); - } - else if (d && !ifc.ifname) { - var link = L.url('admin/network/network', ifc.name) + '?tab.network.%s=physical'.format(ifc.name); - L.dom.content(d, [ - E('em', _('Network without interfaces.')), E('br'), - E('a', { href: link }, _('Assign interfaces...')) - ]); - } - else if (d) { - L.dom.content(d, E('em' ,_('Interface not present or not connected yet.'))); - } - } - } - } -); diff --git a/modules/luci-mod-network/luasrc/controller/admin/network.lua b/modules/luci-mod-network/luasrc/controller/admin/network.lua index f8623be93e..662fe8cf88 100644 --- a/modules/luci-mod-network/luasrc/controller/admin/network.lua +++ b/modules/luci-mod-network/luasrc/controller/admin/network.lua @@ -31,9 +31,6 @@ function index() end) if has_wifi then - page = entry({"admin", "network", "wireless_status"}, call("wifi_status"), nil) - page.leaf = true - page = entry({"admin", "network", "wireless_reconnect"}, post("wifi_reconnect"), nil) page.leaf = true @@ -42,9 +39,6 @@ function index() end - page = entry({"admin", "network", "iface_status"}, call("iface_status"), nil) - page.leaf = true - page = entry({"admin", "network", "iface_reconnect"}, post("iface_reconnect"), nil) page.leaf = true @@ -95,77 +89,6 @@ function index() -- end end -function iface_status(ifaces) - local netm = require "luci.model.network".init() - local rv = { } - - local iface - for iface in ifaces:gmatch("[%w%.%-_]+") do - local net = netm:get_network(iface) - local device = net and net:get_interface() - if device then - local data = { - id = iface, - desc = net:get_i18n(), - proto = net:proto(), - uptime = net:uptime(), - gwaddr = net:gwaddr(), - ipaddrs = net:ipaddrs(), - ip6addrs = net:ip6addrs(), - dnsaddrs = net:dnsaddrs(), - ip6prefix = net:ip6prefix(), - errors = net:errors(), - name = device:shortname(), - type = device:type(), - typename = device:get_type_i18n(), - ifname = device:name(), - macaddr = device:mac(), - is_up = net:is_up() and device:is_up(), - is_alias = net:is_alias(), - is_dynamic = net:is_dynamic(), - is_auto = net:is_auto(), - rx_bytes = device:rx_bytes(), - tx_bytes = device:tx_bytes(), - rx_packets = device:rx_packets(), - tx_packets = device:tx_packets(), - - subdevices = { } - } - - for _, device in ipairs(net:get_interfaces() or {}) do - data.subdevices[#data.subdevices+1] = { - name = device:shortname(), - type = device:type(), - typename = device:get_type_i18n(), - ifname = device:name(), - macaddr = device:mac(), - is_up = device:is_up(), - rx_bytes = device:rx_bytes(), - tx_bytes = device:tx_bytes(), - rx_packets = device:rx_packets(), - tx_packets = device:tx_packets(), - } - end - - rv[#rv+1] = data - else - rv[#rv+1] = { - id = iface, - name = iface, - type = "ethernet" - } - end - end - - if #rv > 0 then - luci.http.prepare_content("application/json") - luci.http.write_json(rv) - return - end - - luci.http.status(404, "No such device") -end - function iface_reconnect(iface) local netmd = require "luci.model.network".init() local net = netmd:get_network(iface) @@ -235,26 +158,6 @@ function iface_down(iface, force) luci.http.status(404, "No such interface") end -function wifi_status(devs) - local s = require "luci.tools.status" - local rv = { } - - if type(devs) == "string" then - local dev - for dev in devs:gmatch("[%w%.%-]+") do - rv[#rv+1] = s.wifi_network(dev) - end - end - - if #rv > 0 then - luci.http.prepare_content("application/json") - luci.http.write_json(rv) - return - end - - luci.http.status(404, "No such device") -end - function wifi_reconnect(radio) local rc = luci.sys.call("env -i /sbin/wifi up %s >/dev/null" % luci.util.shellquote(radio)) diff --git a/modules/luci-mod-network/luasrc/view/admin_network/iface_status.htm b/modules/luci-mod-network/luasrc/view/admin_network/iface_status.htm deleted file mode 100644 index a75b2755cd..0000000000 --- a/modules/luci-mod-network/luasrc/view/admin_network/iface_status.htm +++ /dev/null @@ -1,12 +0,0 @@ -<%+cbi/valueheader%> - -<span class="ifacebadge large"<%=attr("data-iface-status", self.network)%>> - <img src="<%=resource%>/icons/ethernet_disabled.png" /> - <span> - <em class="spinning"><%:Collecting data...%></em> - </span> -</span> - -<script type="text/javascript" src="<%=resource%>/view/network/iface_status.js"></script> - -<%+cbi/valuefooter%> |