3 <script type="text/javascript">//<![CDATA[
6 function iface_shutdown(id, reconnect) {
7 if (!reconnect && !confirm(String.format('<%_Really shutdown network ?\nYou might lose access to this router if you are connected via this interface.%>', id)))
10 var a = document.getElementById(id + '-ifc-addrs');
13 a.innerHTML = reconnect
14 ? '<em><%:Interface is reconnecting...%></em>'
15 : '<em><%:Interface is shutting down...%></em>';
18 var s = document.getElementById('ifc-rc-status');
21 s.parentNode.style.display = 'block';
22 s.innerHTML = '<%:Waiting for router...%>';
25 var rcxhr = new XHR();
26 rcxhr.get('<%=luci.dispatcher.build_url("admin", "network")%>/iface_' + (reconnect ? 'reconnect' : 'shutdown') + '/' + id, null,
31 s.innerHTML = reconnect
32 ? '<%:Interface reconnected%>'
33 : '<%:Interface shut down%>';
35 window.setTimeout(function() {
36 s.parentNode.style.display = 'none';
45 var func = arguments.callee;
47 iwxhr.get('<%=luci.dispatcher.build_url("admin", "network", "iface_status", self.network)%>', null,
50 if (ifc && (ifc = ifc[0]))
54 var s = document.getElementById('<%=self.option%>-ifc-signal');
56 s.innerHTML = String.format(
57 '<img src="%s" style="width:16px; height:16px" />' +
58 '<br /><small>%s</small>',
59 String.format(icon, ifc.type),
60 ifc.ifname ? ifc.ifname : '?'
63 var d = document.getElementById('<%=self.option%>-ifc-description');
64 if (d && ifc.ifname && ifc.macaddr != '00:00:00:00:00:00')
68 html += String.format('<strong><%:Uptime%>:</strong> %t<br />', ifc.uptime);
71 if (ifc.type != 'tunnel')
73 html += String.format('<strong><%:MAC Address%>:</strong> %s<br />', ifc.macaddr);
76 html += String.format(
77 '<strong><%:RX%></strong>: %.2mB (%d <%:Pkts.%>)<br />' +
78 '<strong><%:TX%></strong>: %.2mB (%d <%:Pkts.%>)<br />',
79 ifc.rx_bytes, ifc.rx_packets,
80 ifc.tx_bytes, ifc.tx_packets
83 if (ifc.ipaddrs && ifc.ipaddrs.length)
85 html += '<strong><%:IPv4%>: </strong>';
87 for (var i = 0; i < ifc.ipaddrs.length; i++)
88 html += String.format(
98 if (ifc.ip6addrs && ifc.ip6addrs.length)
100 html += '<strong><%:IPv6%>: </strong>';
102 for (var i = 0; i < ifc.ip6addrs.length; i++)
103 html += String.format(
106 ifc.ip6addrs[i].addr.toUpperCase(),
107 ifc.ip6addrs[i].prefix
117 d.innerHTML = '<em><%:Interface not present or not connected yet.%></em>';
121 window.setTimeout(func, 5000);
128 <tr class="cbi-section-table">
130 <td class="cbi-value-field" style="min-width:16px; padding:3px; text-align:center" id="<%=self.option%>-ifc-signal">
131 <img src="<%=resource%>/icons/ethernet_disabled.png" style="width:16px; height:16px" /><br />
134 <td class="cbi-value-field" style="vertical-align:middle; text-align:left; padding:3px" id="<%=self.option%>-ifc-description">
135 <em><%:Collecting data...%></em>