1
0

overview_interface.htm 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <%+header%>
  2. <ul class="cbi-tabmenu">
  3. <li class="cbi-tab"><a href="<%=luci.dispatcher.build_url("admin/network/mwan/overview")%>"><%:Interface Status%></a></li>
  4. <li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan/overview/overview_detailed")%>"><%:Detailed Status%></a></li>
  5. </ul>
  6. <script type="text/javascript" src="<%=resource%>/cbi.js"></script>
  7. <script type="text/javascript">//<![CDATA[
  8. XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "network", "mwan", "overview", "interface_status")%>', null,
  9. function(x, mArray)
  10. {
  11. var statusDiv = document.getElementById('mwan_status_text');
  12. if (mArray.wans)
  13. {
  14. var interfaceStatus = '';
  15. for ( var i = 0; i < mArray.wans.length; i++ )
  16. {
  17. var status = '';
  18. var css = '';
  19. switch (mArray.wans[i].status)
  20. {
  21. case 'online':
  22. status = '<%:Online (tracking active)%>';
  23. css = 'wanon';
  24. break;
  25. case 'notMonitored':
  26. status = '<%:Online (tracking off)%>';
  27. css = 'wanon';
  28. break;
  29. case 'offline':
  30. status = '<%:Offline%>';
  31. css = 'wanoff';
  32. break;
  33. case 'notEnabled':
  34. status = '<%:Disabled%>';
  35. css = 'wanoff';
  36. break;
  37. }
  38. interfaceStatus += String.format(
  39. '<span class="%s"><strong>%s (<a href="%q">%s</a>)</strong><br />%s</span>',
  40. css, mArray.wans[i].name, mArray.wans[i].link, mArray.wans[i].ifname, status
  41. );
  42. }
  43. statusDiv.innerHTML = interfaceStatus;
  44. }
  45. else
  46. {
  47. statusDiv.innerHTML = '<strong><%:No MWAN interfaces found%></strong>';
  48. }
  49. var logs = document.getElementById('mwan_statuslog_text');
  50. if (mArray.mwanlog)
  51. {
  52. var mwanLog = '<%:Last 50 MWAN systemlog entries. Newest entries sorted at the top :%>';
  53. logs.innerHTML = String.format('<pre>%s<br /><br />%s</pre>', mwanLog, mArray.mwanlog[0]);
  54. }
  55. else
  56. {
  57. logs.innerHTML = '<strong><%:No MWAN systemlog history found%></strong>';
  58. }
  59. }
  60. );
  61. //]]></script>
  62. <div id="mwan_interface_status">
  63. <fieldset id="interface_field" class="cbi-section">
  64. <legend><%:MWAN Interface Live Status%></legend>
  65. <div id="mwan_status_text"><img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle" /><%:Collecting data...%></div>
  66. </fieldset>
  67. <fieldset class="cbi-section">
  68. <legend><%:MWAN Interface Systemlog%></legend>
  69. <div id="mwan_statuslog_text"><img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle" /><%:Collecting data...%></div>
  70. </fieldset>
  71. </div>
  72. <style type="text/css">
  73. #mwan_status_text {
  74. display: table;
  75. font-size: 14px;
  76. margin: auto;
  77. max-width: 1044px;
  78. min-width: 246px;
  79. width: 100%;
  80. }
  81. .wanon {
  82. background-color: rgb(144, 240, 144);
  83. }
  84. .wanoff {
  85. background-color: rgb(240, 144, 144);
  86. }
  87. .wanon, .wanoff {
  88. border-radius: 60px;
  89. box-shadow: 0px 2px 5px -3px;
  90. float: left;
  91. margin: 8px 3px 0px 3px;
  92. min-height: 30px;
  93. min-width: 235px;
  94. padding: 5px 10px 8px 10px;
  95. text-align: center;
  96. }
  97. #mwan_statuslog_text {
  98. padding: 20px;
  99. text-align: left;
  100. }
  101. </style>
  102. <%+footer%>