86b5ac696bab89f9aeaa5ac5550dd72f048e7c38
[project/luci.git] / applications / luci-app-mwan3 / luasrc / view / mwan / overview_status_interface.htm
1 <%#
2  Copyright 2014 Aedan Renner <chipdankly@gmail.com>
3  Copyright 2018 Florian Eckert <fe@dev.tdt.de>
4  Licensed to the public under the GNU General Public License v2.
5 -%>
6
7 <script type="text/javascript">//<![CDATA[
8 XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "status", "mwan", "interface_status")%>', null,
9                 function(x, status)
10                 {
11                         var statusDiv = document.getElementById('mwan_status_text');
12                         if (status.interfaces)
13                         {
14                                 var statusview = '';
15                                 for ( var iface in status.interfaces)
16                                 {
17                                         var state = '';
18                                         switch (status.interfaces[iface].status)
19                                         {
20                                                 case 'online':
21                                                         state = '<%:Online (tracking active)%>';
22                                                         break;
23                                                 case 'notMonitored':
24                                                         state = '<%:Online (tracking off)%>';
25                                                         break;
26                                                 case 'offline':
27                                                         state = '<%:Offline%>';
28                                                         break;
29                                                 default:
30                                                         state = '<%:Disabled%>';
31                                                         break;
32                                         }
33                                         statusview += String.format(
34                                                 '<div><strong>Interface: </strong>%s</div>',
35                                                 iface
36                                         );
37                                         statusview += String.format(
38                                                 '<div><strong>Status: </strong>%s</div></br></br>',
39                                                 state
40                                         );
41                                 }
42                                 statusDiv.innerHTML = statusview;
43                         }
44                         else
45                         {
46                                 statusDiv.innerHTML = '<strong><%:No MWAN interfaces found%></strong>';
47                         }
48                 }
49         );
50 //]]></script>
51
52 <fieldset id="interface_field" class="cbi-section">
53         <legend><%:MWAN Interfaces%></legend>
54         <div id="mwan_status_text">
55                 <img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle" /><%:Collecting data...%>
56         </div>
57 </fieldset>