3 <script type=
"text/javascript">//<![CDATA[
5 var update_status = function() {
6 iwxhr.get('<%=luci.dispatcher.build_url(
"admin",
"network",
"iface_status", self.network)%
>', null,
9 if (ifc && (ifc = ifc[
0]))
11 var is_up = (ifc.flags && ifc.flags.up);
12 var rxb = ifc.stats ? (ifc.stats[
"rx_bytes"] /
1024) :
0;
13 var txb = ifc.stats ? (ifc.stats[
"tx_bytes"] /
1024) :
0;
14 var rxp = ifc.stats ? ifc.stats[
"rx_packets"] :
0;
15 var txp = ifc.stats ? ifc.stats[
"tx_packets"] :
0;
16 var mac = ifc.macaddr ? ifc.macaddr : '
00:
00:
00:
00:
00:
00';
23 upt = String.format('%t', ifc.uptime);
25 icon =
"<%=resource%>/icons/ethernet.png";
29 icon =
"<%=resource%>/icons/ethernet_disabled.png";
32 var s = document.getElementById('<%=self.option%
>-ifc-signal');
34 s.innerHTML = String.format(
35 '
<img src=
"%s" style=
"width:16px; height:16px" /><br />' +
36 '
<small>%s
</small>', icon, ifc.ifname ? ifc.ifname : '?'
39 var d = document.getElementById('<%=self.option%
>-ifc-description');
42 d.innerHTML = String.format(
43 '
<strong><%:Uptime%
>:
</strong> %s
<br />' +
44 '
<strong><%:MAC Address%
>:
</strong> %s
<br />' +
45 '
<strong><%:RX%
></strong>: %
.2f <%:KB%
> (%d <%:Pkts.%
>)
<br />' +
46 '
<strong><%:TX%
></strong>: %
.2f <%:KB%
> (%d <%:Pkts.%
>)
<br />',
47 upt, mac, rxb, rxp, txb, txp
50 if (ifc.ipaddrs && ifc.ipaddrs.length)
52 d.innerHTML += '
<strong><%:IPv4%
>:
</strong>';
54 for (var i =
0; i < ifc.ipaddrs.length; i++)
55 d.innerHTML += String.format(
62 d.innerHTML += '
<br />';
65 if (ifc.ip6addrs && ifc.ip6addrs.length)
67 d.innerHTML += '
<strong><%:IPv6%
>:
</strong>';
69 for (var i =
0; i < ifc.ip6addrs.length; i++)
70 d.innerHTML += String.format(
73 ifc.ip6addrs[i].addr.toUpperCase(),
74 ifc.ip6addrs[i].prefix
77 d.innerHTML += '
<br />';
81 d.innerHTML = '<%:Interface not present or not connected yet.%
>';
84 window.setTimeout(update_status,
5000);
93 <tr class=
"cbi-section-table">
95 <td class=
"cbi-value-field" style=
"min-width:16px; padding:3px; text-align:center" id=
"<%=self.option%>-ifc-signal">
96 <img src=
"<%=resource%>/icons/ethernet_disabled.png" style=
"width:16px; height:16px" /><br />
99 <td class=
"cbi-value-field" style=
"vertical-align:middle; text-align:left; padding:3px" id=
"<%=self.option%>-ifc-description">
100 <em><%:Collecting data...%
></em>