You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

92 lines
2.1 KiB

  1. <script type="text/javascript">//<![CDATA[
  2. XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "network", "mwan3", "overview", "iface_status")%>', null,
  3. function(x, st)
  4. {
  5. var tx = document.getElementById('mwan3_status_text');
  6. if (st.wans)
  7. {
  8. var temp = '';
  9. for( var i = 0; i < st.wans.length; i++ )
  10. {
  11. var stat = '';
  12. var cssc = '';
  13. switch (st.wans[i].status)
  14. {
  15. case 'on':
  16. stat = 'Online (tracking active)';
  17. cssc = 'wanon';
  18. break;
  19. case 'nm':
  20. stat = 'Online (tracking off)';
  21. cssc = 'wanon';
  22. break;
  23. case 'off':
  24. stat = 'Offline';
  25. cssc = 'wanoff';
  26. break;
  27. case 'ne':
  28. stat = 'Disabled';
  29. cssc = 'wanoff';
  30. break;
  31. }
  32. temp += String.format(
  33. '<span class="%s"><strong>%s (<a href="%q">%s</a>)</strong><br />%s</span>',
  34. cssc, st.wans[i].name, st.wans[i].link, st.wans[i].ifname, stat
  35. );
  36. }
  37. tx.innerHTML = temp;
  38. }
  39. else
  40. {
  41. var temp = '';
  42. var ncint = 'No MWAN3 interfaces found';
  43. temp += String.format('<strong>%s</strong>', ncint );
  44. tx.innerHTML = temp;
  45. }
  46. }
  47. );
  48. //]]></script>
  49. <fieldset id="interface_field" class="cbi-section">
  50. <legend><%:MWAN3 Multi-WAN Interface Live Status%></legend>
  51. <div id="mwan3_status_text"><img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle" /> Collecting data...</div>
  52. </fieldset>
  53. <style type="text/css">
  54. .container { /*container for entire page. fixes bootstrap theme's ridiculously small page width*/
  55. max-width: 1044px;
  56. }
  57. #interface_field {
  58. padding: 12px 20px 20px 20px;
  59. }
  60. #mwan3_status_text {
  61. display: table;
  62. font-size: 14px;
  63. margin: auto;
  64. max-width: 1044px;
  65. min-width: 246px;
  66. width: 100%;
  67. }
  68. .wanon {
  69. background-color: rgb(144, 240, 144);
  70. }
  71. .wanoff {
  72. background-color: rgb(240, 144, 144);
  73. }
  74. .wanon, .wanoff {
  75. border-radius: 60px;
  76. box-shadow: 0px 2px 5px -3px;
  77. float: left;
  78. margin: 8px 3px 0px 3px;
  79. min-height: 30px;
  80. min-width: 235px;
  81. padding: 5px 10px 8px 10px;
  82. text-align: center;
  83. }
  84. </style>