X-Git-Url: https://git.archive.openwrt.org/?a=blobdiff_plain;f=modules%2Fadmin-full%2Fluasrc%2Fview%2Fadmin_network%2Fiface_overview.htm;h=67d5a377f138f8c5f384ecdae342f4716e6bbe12;hb=6047aea3c49b7da0d1f00bfcd7b3301bed23fb55;hp=c1a6b8f40ce9e3301ed11fe432157904fe62956c;hpb=2dae492a362f7b1771d76b5a0be6bbb927a06c11;p=project%2Fluci.git
diff --git a/modules/admin-full/luasrc/view/admin_network/iface_overview.htm b/modules/admin-full/luasrc/view/admin_network/iface_overview.htm
index c1a6b8f40..67d5a377f 100644
--- a/modules/admin-full/luasrc/view/admin_network/iface_overview.htm
+++ b/modules/admin-full/luasrc/view/admin_network/iface_overview.htm
@@ -14,6 +14,7 @@ $Id$
<%-
local ntm = require "luci.model.network".init()
+ local fwm = require "luci.model.firewall".init()
local net
local netlist = { }
@@ -30,9 +31,9 @@ $Id$
if (!reconnect && !confirm(String.format('<%_Really shutdown interface "%s" ?\nYou might lose access to this router if you are connected via this interface.%>', id)))
return;
- var a = document.getElementById(id + '-ifc-addrs');
- if (a)
- a.innerHTML = reconnect
+ var d = document.getElementById(id + '-ifc-description');
+ if (d)
+ d.innerHTML = reconnect
? '<%:Interface is reconnecting...%>'
: '<%:Interface is shutting down...%>';
@@ -66,7 +67,8 @@ $Id$
var wifidevs = <%=luci.http.write_json(netdevs)%>;
var arptable = <%=luci.http.write_json(arpcache)%>;
- var update_status = function() {
+ (function() {
+ var func = arguments.callee;
iwxhr.get('<%=luci.dispatcher.build_url("admin", "network", "iface_status", table.concat(netlist, ","))%>', null,
function(x, ifcs)
{
@@ -75,113 +77,126 @@ $Id$
for (var i = 0; i < ifcs.length; i++)
{
var ifc = ifcs[i];
- var is_up = (ifc.flags && ifc.flags.up);
- var rxb = ifc.stats ? ifc.stats["rx_bytes"] : 0;
- var txb = ifc.stats ? ifc.stats["tx_bytes"] : 0;
- 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 rxb = ifc.rx_bytes || 0;
+ var txb = ifc.tx_bytes || 0;
+ var rxp = ifc.rx_packets || 0;
+ var txp = ifc.tx_packets || 0;
+ var mac = ifc.macaddr;
+ var upt = null;
+
+ var html = '';
var icon;
- if (is_up)
+ if (ifc.is_up)
{
if (ifc.uptime)
upt = String.format('%t', ifc.uptime);
- icon = "<%=resource%>/icons/ethernet.png";
+ icon = "<%=resource%>/icons/%s.png";
}
else
{
- icon = "<%=resource%>/icons/ethernet_disabled.png";
+ icon = "<%=resource%>/icons/%s_disabled.png";
}
- var s = document.getElementById(ifc.id + '-ifc-signal');
+ var s = document.getElementById(ifc.id + '-ifc-devices');
if (s)
{
- s.innerHTML = String.format(
- '
' +
- '%s',
- icon, ifc.ifname ? ifc.ifname : '?'
+ var stat = String.format(
+ '',
+ ifc.type,
+ ifc.is_up ? '' : '_disabled'
);
- }
- var u = document.getElementById(ifc.id + '-ifc-uptime');
- if (u)
- {
- u.innerHTML = upt;
- }
+ if (ifc.subdevices && ifc.subdevices.length)
+ {
+ stat += ' (';
- var m = document.getElementById(ifc.id + '-ifc-mac');
- if (m)
- {
- m.innerHTML = mac.toUpperCase();
+ for (var j = 0; j < ifc.subdevices.length; j++)
+ {
+ var sif = ifc.subdevices[j];
+
+ stat += String.format(
+ '',
+ sif.type,
+ sif.is_up ? '' : '_disabled',
+ sif.name
+ );
+ }
+
+ stat += ')';
+ }
+
+ stat += String.format(
+ '
%s',
+ ifc.name
+ );
+
+ s.innerHTML = stat;
}
- var a = document.getElementById(ifc.id + '-ifc-addrs');
- if (a)
+ var d = document.getElementById(ifc.id + '-ifc-description');
+ if (d && ifc.ifname)
{
- if (ifc.ifname)
+ if (upt)
{
- a.innerHTML = '';
-
- if (ifc.ipaddrs && ifc.ipaddrs.length)
- {
- a.innerHTML += '<%:IPv4%>: ';
-
- for (var j = 0; j < ifc.ipaddrs.length; j++)
- a.innerHTML += String.format(
- '%s%s/%d',
- j ? ', ' : '',
- ifc.ipaddrs[j].addr,
- ifc.ipaddrs[j].prefix
- );
+ html += String.format('<%:Uptime%>: %s
', upt);
+ }
- a.innerHTML += '
';
- }
+ if (ifc.type != 'tunnel')
+ {
+ html += String.format('<%:MAC Address%>: %s
', mac);
+ }
- if (ifc.ip6addrs && ifc.ip6addrs.length)
- {
- a.innerHTML += '<%:IPv6%>: ';
+ html += String.format(
+ '<%:RX%>: %.2mB (%d <%:Pkts.%>)
' +
+ '<%:TX%>: %.2mB (%d <%:Pkts.%>)
',
+ rxb, rxp, txb, txp
+ );
- for (var j = 0; j < ifc.ip6addrs.length; j++)
- a.innerHTML += String.format(
- '%s%s/%d',
- j ? ', ' : '',
- ifc.ip6addrs[j].addr.toUpperCase(),
- ifc.ip6addrs[j].prefix
- );
+ if (ifc.ipaddrs && ifc.ipaddrs.length)
+ {
+ html += '<%:IPv4%>: ';
- a.innerHTML += '
';
- }
+ for (var i = 0; i < ifc.ipaddrs.length; i++)
+ html += String.format(
+ '%s%s/%d',
+ i ? ', ' : '',
+ ifc.ipaddrs[i].addr,
+ ifc.ipaddrs[i].prefix
+ );
- if (!a.innerHTML)
- a.innerHTML = '<%:No address configured on this interface.%>'
+ html += '
';
}
- else
+
+ if (ifc.ip6addrs && ifc.ip6addrs.length)
{
- a.innerHTML = '<%:Interface not present or not connected yet.%>';
+ html += '<%:IPv6%>: ';
+
+ for (var i = 0; i < ifc.ip6addrs.length; i++)
+ html += String.format(
+ '%s%s/%d',
+ i ? ', ' : '',
+ ifc.ip6addrs[i].addr.toUpperCase(),
+ ifc.ip6addrs[i].prefix
+ );
+
+ html += '
';
}
- }
- var t = document.getElementById(ifc.id + '-ifc-transfer');
- if (t)
+ d.innerHTML = html;
+ }
+ else if (d)
{
- t.innerHTML = String.format(
- '<%:RX%>: %1024.2mB (%d <%:Pkts.%>)
' +
- '<%:TX%>: %1024.2mB (%d <%:Pkts.%>)
',
- rxb, rxp, txb, txp
- );
+ d.innerHTML = '<%:Interface not present or not connected yet.%>';
}
}
}
- window.setTimeout(update_status, 5000);
+ window.setTimeout(func, 5000);
}
)
- };
-
- update_status();
+ })();
//]]>