diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2011-10-02 10:23:32 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2011-10-02 10:23:32 +0000 |
commit | 31ea36f7ab8319313317f9420b47f29812977850 (patch) | |
tree | 3e468abd6432caa937225aabf6fc1ad82948799d /applications/luci-multiwan/luasrc/view | |
parent | 86f63627b66a8ef73f079eda30db2d87772da9b6 (diff) |
applications/luci-multiwan: add status indicators, patch by Etienne Champetier <etienne.champetier@free.fr> (#260)
Diffstat (limited to 'applications/luci-multiwan/luasrc/view')
-rw-r--r-- | applications/luci-multiwan/luasrc/view/admin_status/index/multiwan.htm | 1 | ||||
-rw-r--r-- | applications/luci-multiwan/luasrc/view/multiwan_status.htm | 71 |
2 files changed, 72 insertions, 0 deletions
diff --git a/applications/luci-multiwan/luasrc/view/admin_status/index/multiwan.htm b/applications/luci-multiwan/luasrc/view/admin_status/index/multiwan.htm new file mode 100644 index 0000000000..79c04539ff --- /dev/null +++ b/applications/luci-multiwan/luasrc/view/admin_status/index/multiwan.htm @@ -0,0 +1 @@ +<%+multiwan_status%> diff --git a/applications/luci-multiwan/luasrc/view/multiwan_status.htm b/applications/luci-multiwan/luasrc/view/multiwan_status.htm new file mode 100644 index 0000000000..8c4127b237 --- /dev/null +++ b/applications/luci-multiwan/luasrc/view/multiwan_status.htm @@ -0,0 +1,71 @@ +<script type="text/javascript">//<![CDATA[ + XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "network", "multiwan", "status")%>', null, + function(x, st) + { + var tx = document.getElementById('multiwan_status_text'); + if (tx) + { + if (st && st.wans) + { + var temp = ''; + + for( var i = 0; i < st.wans.length; i++ ) + { + var stat = '<%:Unknown%>'; + var cssc = ''; + + switch (st.wans[i].status) + { + case 'ok': + stat = '<%:OK%>'; + cssc = 'wanok'; + break; + + case 'ko': + stat = '<%:KO%>'; + cssc = 'wanko'; + break; + + case 'recovering': + stat = String.format('<%:Recovering%>(%d)', st.wans[i].count); + cssc = 'wanrecov'; + break; + + case 'failing': + stat = String.format('<%:Failing%>(%d)', st.wans[i].count); + cssc = 'wanfail'; + break; + } + + temp += String.format( + '<span class="%s"><strong>%s (<a href="%q">%s</a>) :</strong> %s</span>', + cssc, st.wans[i].name, st.wans[i].link, st.wans[i].ifname, stat + ); + } + + tx.innerHTML = temp; + } + else + { + tx.innerHTML = ''; + } + } + } + ); +//]]></script> + +<style type="text/css"> + .wanok { background-color: rgb(144, 240, 144); } + .wanko { background-color: rgb(240, 144, 144); } + .wanrecov { background-color: rgb(240, 240, 0); } + .wanfail { background-color: rgb(255, 165, 0); } + .wanko, .wanok, .wanrecov, .wanfail { + padding: 0.4em; + margin: 0.4em; + } +</style> + +<fieldset class="cbi-section"> + <legend><%:Multi-WAN Status%></legend> + <div id="multiwan_status_text" style="text-align:center;"><em><%:Collecting data...%></em></div> +</fieldset> |