diff options
author | Jo-Philipp Wich <jo@mein.io> | 2019-10-31 16:43:48 +0100 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2019-11-01 12:03:33 +0100 |
commit | 650d7f64d5b1b76d58b6c719e9efe15270468cc8 (patch) | |
tree | 9a2fb7b5148227e0c9d62ba20616852c91900799 /modules/luci-mod-network/htdocs/luci-static/resources | |
parent | c85af3d7618b55c499ce4bf58e3896068bd413ae (diff) |
luci-base: remove unused Lua code
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'modules/luci-mod-network/htdocs/luci-static/resources')
-rw-r--r-- | modules/luci-mod-network/htdocs/luci-static/resources/view/network/iface_status.js | 42 | ||||
-rw-r--r-- | modules/luci-mod-network/htdocs/luci-static/resources/view/network/network.js | 136 |
2 files changed, 0 insertions, 178 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.'))); - } - } - } - } -); |