4ec0edf049931c883eb7599fde6034e90c038f2c
[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                                         var css = ''
19                                         switch (status.interfaces[iface].status)
20                                         {
21                                                 case 'online':
22                                                         state = '<%:Online (tracking active)%>';
23                                                         css = 'success';
24                                                         break;
25                                                 case 'offline':
26                                                         state = '<%:Offline%>';
27                                                         css = 'danger';
28                                                         break;
29                                                 default:
30                                                         state = '<%:Disabled%>';
31                                                         css = 'warning';
32                                                         break;
33                                         }
34                                         statusview += String.format(
35                                                 '<div class="alert-message %s">',
36                                                 css
37                                         );
38                                         statusview += String.format(
39                                                 '<div><strong>Interface: </strong>%s</div>',
40                                                 iface
41                                         );
42                                         statusview += String.format(
43                                                 '<div><strong>Status: </strong>%s</div>',
44                                                 state
45                                         );
46                                         statusview += '</div>'
47                                 }
48                                 statusDiv.innerHTML = statusview;
49                         }
50                         else
51                         {
52                                 statusDiv.innerHTML = '<strong><%:No MWAN interfaces found%></strong>';
53                         }
54                 }
55         );
56 //]]></script>
57
58 <style type="text/css">
59         #mwan_status_text > div {
60                 display: inline-block;
61                 margin: 1rem;
62                 padding: 1rem;
63                 width: 10rem;
64                 float: left;
65                 line-height: 125%;
66         }
67 </style>
68
69 <fieldset id="interface_field" class="cbi-section">
70         <legend><%:MWAN Interfaces%></legend>
71         <div id="mwan_status_text">
72                 <img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle" /><%:Collecting data...%>
73         </div>
74 </fieldset>