multiwan_status.htm 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <script type="text/javascript">//<![CDATA[
  2. XHR.poll(5, '<%=url('admin/network/multiwan/status')%>', null,
  3. function(x, st)
  4. {
  5. var tx = document.getElementById('multiwan_status_text');
  6. if (tx)
  7. {
  8. if (st && st.wans)
  9. {
  10. var temp = '';
  11. for( var i = 0; i < st.wans.length; i++ )
  12. {
  13. var stat = '<%:Unknown%>';
  14. var cssc = '';
  15. switch (st.wans[i].status)
  16. {
  17. case 'ok':
  18. stat = '<%:OK%>';
  19. cssc = 'wanok';
  20. break;
  21. case 'ko':
  22. stat = '<%:KO%>';
  23. cssc = 'wanko';
  24. break;
  25. case 'recovering':
  26. stat = String.format('<%:Recovering%>(%d)', st.wans[i].count);
  27. cssc = 'wanrecov';
  28. break;
  29. case 'failing':
  30. stat = String.format('<%:Failing%>(%d)', st.wans[i].count);
  31. cssc = 'wanfail';
  32. break;
  33. }
  34. temp += String.format(
  35. '<span class="%s"><strong>%s (<a href="%q">%s</a>) :</strong> %s</span>',
  36. cssc, st.wans[i].name, st.wans[i].link, st.wans[i].ifname, stat
  37. );
  38. }
  39. tx.innerHTML = temp;
  40. }
  41. else
  42. {
  43. tx.innerHTML = '';
  44. }
  45. }
  46. }
  47. );
  48. //]]></script>
  49. <style type="text/css">
  50. .wanok { background-color: rgb(144, 240, 144); }
  51. .wanko { background-color: rgb(240, 144, 144); }
  52. .wanrecov { background-color: rgb(240, 240, 0); }
  53. .wanfail { background-color: rgb(255, 165, 0); }
  54. .wanko, .wanok, .wanrecov, .wanfail {
  55. padding: 0.4em;
  56. margin: 0.4em;
  57. }
  58. </style>
  59. <fieldset class="cbi-section">
  60. <legend><%:Multi-WAN Status%></legend>
  61. <div id="multiwan_status_text" style="text-align:center;"><em><%:Collecting data...%></em></div>
  62. </fieldset>