<%+cbi/valueheader%>
-<script type="text/javascript"><![CDATA[
+<script type="text/javascript">//<![CDATA[
var iwxhr = new XHR();
- (function() {
+ var update_status = function() {
iwxhr.get('<%=luci.dispatcher.build_url("admin", "network", "iface_status", self.network)%>', null,
- function(x)
+ function(x, ifc)
{
- var ifc = x.responseText ? eval('(' + x.responseText + ')') : { };
if (ifc && (ifc = ifc[0]))
{
var is_up = (ifc.flags && ifc.flags.up);
var rxp = ifc.stats ? ifc.stats["rx_packets"] : 0;
var txp = ifc.stats ? ifc.stats["tx_packets"] : 0;
var mac = ifc.macaddr ? ifc.macaddr : '00:00:00:00:00:00';
+ var upt = '-';
var icon;
if (is_up)
+ {
+ if (ifc.uptime)
+ upt = String.format('%t', ifc.uptime);
+
icon = "<%=resource%>/icons/ethernet.png";
+ }
else
+ {
icon = "<%=resource%>/icons/ethernet_disabled.png";
+ }
var s = document.getElementById('<%=self.option%>-ifc-signal');
if (s)
if (d && ifc.ifname)
{
d.innerHTML = String.format(
+ '<strong><%:Uptime%>:</strong> %s<br />' +
'<strong><%:MAC Address%>:</strong> %s<br />' +
'<strong><%:RX%></strong>: %.2f <%:KB%> (%d <%:Pkts.%>)<br />' +
'<strong><%:TX%></strong>: %.2f <%:KB%> (%d <%:Pkts.%>)<br />',
- mac, rxb, rxp, txb, txp
+ upt, mac, rxb, rxp, txb, txp
);
if (ifc.ipaddrs && ifc.ipaddrs.length)
d.innerHTML += String.format(
'%s%s/%d',
i ? ', ' : '',
- ifc.ip6addrs[i].addr,
+ ifc.ip6addrs[i].addr.toUpperCase(),
ifc.ip6addrs[i].prefix
);
else if (d)
d.innerHTML = '<%:Interface not present or not connected yet.%>';
}
+
+ window.setTimeout(update_status, 5000);
}
)
+ };
- window.setTimeout(arguments.callee, 5000);
- })();
-]]></script>
+ update_status();
+//]]></script>
<table>
<tr class="cbi-section-table">
<td></td>
- <td class="cbi-value-field" style="width:16px; padding:3px; text-align:center" id="<%=self.option%>-ifc-signal">
+ <td class="cbi-value-field" style="min-width:16px; padding:3px; text-align:center" id="<%=self.option%>-ifc-signal">
<img src="<%=resource%>/icons/ethernet_disabled.png" style="width:16px; height:16px" /><br />
<small>?</small>
</td>