luci-mod-network: remove debug code from iface_status.js
[project/luci.git] / modules / luci-mod-network / htdocs / luci-static / resources / view / network / iface_status.js
1 requestAnimationFrame(function() {
2 document.querySelectorAll('[data-iface-status]').forEach(function(container) {
3 var network = container.getAttribute('data-iface-status'),
4 icon = container.querySelector('img'),
5 info = container.querySelector('span');
6
7 L.poll(5, L.url('admin/network/iface_status', network), null, function(xhr, ifaces) {
8 var ifc = Array.isArray(ifaces) ? ifaces[0] : null;
9 if (!ifc)
10 return;
11
12 L.itemlist(info, [
13 _('Device'), ifc.ifname,
14 _('Uptime'), ifc.is_up ? '%t'.format(ifc.uptime) : null,
15 _('MAC'), ifc.ifname ? ifc.macaddr : null,
16 _('RX'), ifc.ifname ? '%.2mB (%d %s)'.format(ifc.rx_bytes, ifc.rx_packets, _('Pkts.')) : null,
17 _('TX'), ifc.ifname ? '%.2mB (%d %s)'.format(ifc.tx_bytes, ifc.tx_packets, _('Pkts.')) : null,
18 _('IPv4'), ifc.ipaddrs ? ifc.ipaddrs[0] : null,
19 _('IPv4'), ifc.ipaddrs ? ifc.ipaddrs[1] : null,
20 _('IPv4'), ifc.ipaddrs ? ifc.ipaddrs[2] : null,
21 _('IPv4'), ifc.ipaddrs ? ifc.ipaddrs[3] : null,
22 _('IPv4'), ifc.ipaddrs ? ifc.ipaddrs[4] : null,
23 _('IPv6'), ifc.ip6addrs ? ifc.ip6addrs[0] : null,
24 _('IPv6'), ifc.ip6addrs ? ifc.ip6addrs[1] : null,
25 _('IPv6'), ifc.ip6addrs ? ifc.ip6addrs[2] : null,
26 _('IPv6'), ifc.ip6addrs ? ifc.ip6addrs[3] : null,
27 _('IPv6'), ifc.ip6addrs ? ifc.ip6addrs[4] : null,
28 _('IPv6'), ifc.ip6addrs ? ifc.ip6addrs[5] : null,
29 _('IPv6'), ifc.ip6addrs ? ifc.ip6addrs[6] : null,
30 _('IPv6'), ifc.ip6addrs ? ifc.ip6addrs[7] : null,
31 _('IPv6'), ifc.ip6addrs ? ifc.ip6addrs[8] : null,
32 _('IPv6'), ifc.ip6addrs ? ifc.ip6addrs[9] : null,
33 _('IPv6-PD'), ifc.ip6prefix,
34 null, ifc.ifname ? null : E('em', _('Interface not present or not connected yet.'))
35 ]);
36
37 icon.src = L.resource('icons/%s%s.png').format(ifc.type, ifc.is_up ? '' : '_disabled');
38 });
39
40 L.run();
41 });
42 });