3 <script type="text/javascript">//<![CDATA[
6 function iface_shutdown(id, reconnect) {
7 if (!reconnect && !confirm(String.format('<%_Really shutdown network ?\nYou might loose 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]))
52 var rxb = ifc.rx_bytes || 0;
53 var txb = ifc.tx_bytes || 0;
54 var rxp = ifc.rx_packets || 0;
55 var txp = ifc.tx_packets || 0;
56 var mac = ifc.macaddr;
64 upt = String.format('%t', ifc.uptime);
66 icon = "<%=resource%>/icons/%s.png";
70 icon = "<%=resource%>/icons/%s_disabled.png";
73 var s = document.getElementById('<%=self.option%>-ifc-signal');
75 s.innerHTML = String.format(
76 '<img src="%s" style="width:16px; height:16px" />' +
77 '<br /><small>%s</small>',
78 String.format(icon, ifc.type),
79 ifc.ifname ? ifc.ifname : '?'
82 var d = document.getElementById('<%=self.option%>-ifc-description');
83 if (d && ifc.ifname && mac != '00:00:00:00:00:00')
87 html += String.format('<strong><%:Uptime%>:</strong> %s<br />', upt);
90 if (ifc.type != 'tunnel')
92 html += String.format('<strong><%:MAC Address%>:</strong> %s<br />', mac);
95 html += String.format(
96 '<strong><%:RX%></strong>: %.2mB (%d <%:Pkts.%>)<br />' +
97 '<strong><%:TX%></strong>: %.2mB (%d <%:Pkts.%>)<br />',
101 if (ifc.ipaddrs && ifc.ipaddrs.length)
103 html += '<strong><%:IPv4%>: </strong>';
105 for (var i = 0; i < ifc.ipaddrs.length; i++)
106 html += String.format(
110 ifc.ipaddrs[i].prefix
116 if (ifc.ip6addrs && ifc.ip6addrs.length)
118 html += '<strong><%:IPv6%>: </strong>';
120 for (var i = 0; i < ifc.ip6addrs.length; i++)
121 html += String.format(
124 ifc.ip6addrs[i].addr.toUpperCase(),
125 ifc.ip6addrs[i].prefix
135 d.innerHTML = '<em><%:Interface not present or not connected yet.%></em>';
139 window.setTimeout(func, 5000);
146 <tr class="cbi-section-table">
148 <td class="cbi-value-field" style="min-width:16px; padding:3px; text-align:center" id="<%=self.option%>-ifc-signal">
149 <img src="<%=resource%>/icons/ethernet_disabled.png" style="width:16px; height:16px" /><br />
152 <td class="cbi-value-field" style="vertical-align:middle; text-align:left; padding:3px" id="<%=self.option%>-ifc-description">
153 <em><%:Collecting data...%></em>