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';
20 icon = "<%=resource%>/icons/ethernet.png";
22 icon = "<%=resource%>/icons/ethernet_disabled.png";
24 var s = document.getElementById('<%=self.option%>-ifc-signal');
26 s.innerHTML = String.format(
27 '<img src="%s" style="width:16px; height:16px" /><br />' +
28 '<small>%s</small>', icon, ifc.ifname ? ifc.ifname : '?'
31 var d = document.getElementById('<%=self.option%>-ifc-description');
34 d.innerHTML = String.format(
35 '<strong><%:MAC Address%>:</strong> %s<br />' +
36 '<strong><%:RX%></strong>: %.2f <%:KB%> (%d <%:Pkts.%>)<br />' +
37 '<strong><%:TX%></strong>: %.2f <%:KB%> (%d <%:Pkts.%>)<br />',
38 mac, rxb, rxp, txb, txp
41 if (ifc.ipaddrs && ifc.ipaddrs.length)
43 d.innerHTML += '<strong><%:IPv4%>: </strong>';
45 for (var i = 0; i < ifc.ipaddrs.length; i++)
46 d.innerHTML += String.format(
53 d.innerHTML += '<br />';
56 if (ifc.ip6addrs && ifc.ip6addrs.length)
58 d.innerHTML += '<strong><%:IPv6%>: </strong>';
60 for (var i = 0; i < ifc.ip6addrs.length; i++)
61 d.innerHTML += String.format(
64 ifc.ip6addrs[i].addr.toUpperCase(),
65 ifc.ip6addrs[i].prefix
68 d.innerHTML += '<br />';
72 d.innerHTML = '<%:Interface not present or not connected yet.%>';
75 window.setTimeout(update_status, 5000);
84 <tr class="cbi-section-table">
86 <td class="cbi-value-field" style="width:16px; padding:3px; text-align:center" id="<%=self.option%>-ifc-signal">
87 <img src="<%=resource%>/icons/ethernet_disabled.png" style="width:16px; height:16px" /><br />
90 <td class="cbi-value-field" style="vertical-align:middle; text-align:left; padding:3px" id="<%=self.option%>-ifc-description">
91 <em><%:Collecting data...%></em>