summaryrefslogtreecommitdiffhomepage
path: root/modules/admin-full/luasrc/view
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2012-11-01 20:03:36 +0000
committerJo-Philipp Wich <jow@openwrt.org>2012-11-01 20:03:36 +0000
commit36f88887c19d2b0098ae1965b6725845705efc51 (patch)
tree4b73eab4ac1485ce96417803167e47a696b39c7a /modules/admin-full/luasrc/view
parent59af400346d15250af5873db66e420592a5b9ff9 (diff)
modules/admin-core, modules/admin-full: fix switch port status for devices with multiple switches
Diffstat (limited to 'modules/admin-full/luasrc/view')
-rw-r--r--modules/admin-full/luasrc/view/admin_network/switch_status.htm37
1 files changed, 17 insertions, 20 deletions
diff --git a/modules/admin-full/luasrc/view/admin_network/switch_status.htm b/modules/admin-full/luasrc/view/admin_network/switch_status.htm
index 0b284833e7..b299575e2f 100644
--- a/modules/admin-full/luasrc/view/admin_network/switch_status.htm
+++ b/modules/admin-full/luasrc/view/admin_network/switch_status.htm
@@ -1,31 +1,28 @@
<script type="text/javascript">//<![CDATA[
- var tb;
- var ths = document.getElementsByTagName('th');
- for (var i = 0; i < ths.length; i++)
- if (ths[i].className = 'cbi-section-table-cell' && !ths[i].innerHTML)
+ var switches = [ '<%=table.concat(self.switches, "', '")%>' ];
+ XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "network", "switch_status")%>/' + switches.join(','), null,
+ function(x, st)
{
- ths[i].innerHTML = '<%:Port status:%>';
- tb = ths[i].parentNode;
- break;
- }
-
- if (tb)
- {
- XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "network", "switch_status", self.switch)%>', null,
- function(x, st)
+ for (var i = 0; i < switches.length; i++)
{
- if (st && st.length)
+ var ports = st[switches[i]];
+ var th0 = document.getElementById('portstatus-' + switches[i]);
+
+ if (th0 && ports && ports.length)
{
- for (var i = 0; i < st.length; i++)
+ if (!th0.innerHTML)
+ th0.innerHTML = '<%:Port status:%>';
+
+ for (var j = 0; j < ports.length; j++)
{
- var th = tb.childNodes[i+1];
+ var th = th0.parentNode.parentNode.childNodes[j+1];
- if (st[i].link)
+ if (ports[j].link)
{
th.innerHTML = String.format(
'<small><img src="<%=resource%>/icons/port_up.png" />' +
'<br />%d<%:baseT%><br />%s</small>',
- st[i].speed, st[i].duplex
+ ports[j].speed, ports[j].duplex
? '<%:full-duplex%>' : '<%:half-duplex%>'
);
}
@@ -39,6 +36,6 @@
}
}
}
- );
- }
+ }
+ );
//]]></script>