luci-app-mwan3: remove css from javascript in overview_status_interface
[project/luci.git] / applications / luci-app-mwan3 / luasrc / view / mwan / overview_status_interface.htm
index 335c95c..86b5ac6 100644 (file)
@@ -1,80 +1,57 @@
+<%#
+ Copyright 2014 Aedan Renner <chipdankly@gmail.com>
+ Copyright 2018 Florian Eckert <fe@dev.tdt.de>
+ Licensed to the public under the GNU General Public License v2.
+-%>
+
 <script type="text/javascript">//<![CDATA[
-       XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "status", "mwan", "interface_status")%>', null,
-               function(x, mArray)
+XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "status", "mwan", "interface_status")%>', null,
+               function(x, status)
                {
-                       var status = document.getElementById('mwan_status_text');
-                       if (mArray.wans)
+                       var statusDiv = document.getElementById('mwan_status_text');
+                       if (status.interfaces)
                        {
-                               var temp = '';
-                               for ( var i = 0; i < mArray.wans.length; i++ )
+                               var statusview = '';
+                               for ( var iface in status.interfaces)
                                {
-                                       var stat = '';
-                                       var cssc = '';
-                                       switch (mArray.wans[i].status)
+                                       var state = '';
+                                       switch (status.interfaces[iface].status)
                                        {
                                                case 'online':
-                                                       stat = '<%:Online (tracking active)%>';
-                                                       cssc = 'wanon';
+                                                       state = '<%:Online (tracking active)%>';
                                                        break;
                                                case 'notMonitored':
-                                                       stat = '<%:Online (tracking off)%>';
-                                                       cssc = 'wanon';
+                                                       state = '<%:Online (tracking off)%>';
                                                        break;
                                                case 'offline':
-                                                       stat = '<%:Offline%>';
-                                                       cssc = 'wanoff';
+                                                       state = '<%:Offline%>';
                                                        break;
-                                               case 'notEnabled':
-                                                       stat = '<%:Disabled%>';
-                                                       cssc = 'wanoff';
+                                               default:
+                                                       state = '<%:Disabled%>';
                                                        break;
                                        }
-                                       temp += String.format(
-                                               '<span class="%s"><strong>%s (<a href="%q">%s</a>)</strong><br />%s</span>',
-                                               cssc, mArray.wans[i].name, mArray.wans[i].link, mArray.wans[i].ifname, stat
+                                       statusview += String.format(
+                                               '<div><strong>Interface: </strong>%s</div>',
+                                               iface
+                                       );
+                                       statusview += String.format(
+                                               '<div><strong>Status: </strong>%s</div></br></br>',
+                                               state
                                        );
                                }
-                               status.innerHTML = temp;
+                               statusDiv.innerHTML = statusview;
                        }
                        else
                        {
-                               status.innerHTML = '<strong><%:No MWAN interfaces found%></strong>';
+                               statusDiv.innerHTML = '<strong><%:No MWAN interfaces found%></strong>';
                        }
                }
        );
 //]]></script>
 
 <fieldset id="interface_field" class="cbi-section">
-       <legend><%:MWAN Interface Live Status%></legend>
-       <div id="mwan_status_text"><img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle" /><%:Collecting data...%></div>
+       <legend><%:MWAN Interfaces%></legend>
+       <div id="mwan_status_text">
+               <img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle" /><%:Collecting data...%>
+       </div>
 </fieldset>
-
-<style type="text/css">
-  .container { /* container for entire page. fixes bootstrap theme's ridiculously small page width */
-       max-width: 1044px;
-  }
-  #mwan_status_text {
-       display: table;
-       font-size: 14px;
-       margin: auto;
-       max-width: 1044px;
-       min-width: 246px;
-       width: 100%;
-  }
-  .wanon {
-       background-color: rgb(144, 240, 144);
-  }
-  .wanoff {
-       background-color: rgb(240, 144, 144);
-  }
-  .wanon, .wanoff {
-       border-radius: 60px;
-       box-shadow: 0px 2px 5px -3px;
-       float: left;
-       margin: 8px 3px 0px 3px;
-       min-height: 30px;
-       min-width: 235px;
-       padding: 5px 10px 8px 10px;
-       text-align: center;
-  }
-</style>