diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2012-09-11 14:18:28 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2012-09-11 14:18:28 +0000 |
commit | 57e51eba60cd95b82b11c5857651861decf8dcbe (patch) | |
tree | eca82dc0108f5675f09e76f4a3743c9b8a0f1509 /modules/admin-full/luasrc/view | |
parent | 1aa81b4ae095cea55119e8bc4142fbfb61cf40ff (diff) |
modules/admin-full, modules/admin-core, themes/base: add port status indicators to switch config page
Diffstat (limited to 'modules/admin-full/luasrc/view')
-rw-r--r-- | modules/admin-full/luasrc/view/admin_network/switch_status.htm | 44 |
1 files changed, 44 insertions, 0 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 new file mode 100644 index 000000000..31da264dc --- /dev/null +++ b/modules/admin-full/luasrc/view/admin_network/switch_status.htm @@ -0,0 +1,44 @@ +<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) + { + 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) + { + if (st && st.length) + { + for (var i = 0; i < st.length; i++) + { + var th = tb.childNodes[i+1]; + + if (st[i].link) + { + th.innerHTML = String.format( + '<small><img src="<%=resource%>/icons/port_up.png" />' + + '<br />%d<%:baseT%> %s</small>', + st[i].speed, st[i].duplex + ? '<%:full-duplex%>' : '<%:half-duplex%>' + ); + } + else + { + th.innerHTML = String.format( + '<small><img src="<%=resource%>/icons/port_down.png" />' + + '<br /><%:no link%></small>' + ); + } + } + } + } + ); + } +//]]></script> |