luci-app-mwan3: remove duplicated code section
authorFlorian Eckert <fe@dev.tdt.de>
Thu, 1 Mar 2018 07:56:43 +0000 (08:56 +0100)
committerFlorian Eckert <fe@dev.tdt.de>
Thu, 1 Mar 2018 09:47:47 +0000 (10:47 +0100)
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
applications/luci-app-mwan3/luasrc/view/mwan/status_interface.htm

index ae28df1..cb47696 100644 (file)
 </ul>
 
 <script type="text/javascript" src="<%=resource%>/cbi.js"></script>
 </ul>
 
 <script type="text/javascript" src="<%=resource%>/cbi.js"></script>
-<script type="text/javascript">//<![CDATA[
-       XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "status", "mwan", "interface_status")%>', null,
-               function(x, status)
-               {
-                       var legend = document.getElementById('diag-rc-legend');
-                       var statusDiv = document.getElementById('diag-rc-output');
-                       legend.style.display = 'none';
-                       if (status.interfaces)
-                       {
-                               var statusview = '';
-                               for ( var iface in status.interfaces)
-                               {
-                                       var state = '';
-                                       var css = '';
-                                       switch (status.interfaces[iface].status)
-                                       {
-                                               case 'online':
-                                                       state = '<%:Online (tracking active)%>';
-                                                       css = 'wanon';
-                                                       break;
-                                               case 'notMonitored':
-                                                       state = '<%:Online (tracking off)%>';
-                                                       css = 'wanon';
-                                                       break;
-                                               case 'offline':
-                                                       state = '<%:Offline%>';
-                                                       css = 'wanoff';
-                                                       break;
-                                               default:
-                                                       state = '<%:Disabled%>';
-                                                       css = 'wanoff';
-                                                       break;
-                                       }
-                                       statusview += String.format(
-                                               '<span class="%s"><strong>%s</strong><br />%s</span>',
-                                               css,
-                                               iface,
-                                               state
-                                       );
-                               }
-                               statusDiv.innerHTML = statusview;
-                       }
-                       else
-                       {
-                               statusDiv.innerHTML = '<strong><%:No MWAN interfaces found%></strong>';
-                       }
-               }
-       );
-//]]></script>
 
 
-<div class="cbi-map">
-       <h2 name="content"><%:MWAN Status - Interface%></h2>
-       <%if not require("luci.sys").init.enabled("mwan3") then%>
-       <div><strong><%:INFO: MWAN not running%></strong></div>
-       <%end%>
-       <fieldset class="cbi-section">
-               <legend id="diag-rc-legend"><%:Collecting data...%></legend>
-               <span id="diag-rc-output">
-                       <img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align: middle;" />
-               </span>
-       </fieldset>
-</div>
+<%+mwan/overview_status_interface%>
 
 <%+footer%>
 
 <%+footer%>