luci-app-mwan3: use mwan3 ubus call for status information
[project/luci.git] / applications / luci-app-mwan3 / luasrc / view / mwan / overview_status_interface.htm
1 <script type="text/javascript">//<![CDATA[
2 XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "status", "mwan", "interface_status")%>', null,
3                 function(x, status)
4                 {
5                         var statusDiv = document.getElementById('mwan_status_text');
6                         if (status.interfaces)
7                         {
8                                 var statusview = '';
9                                 for ( var iface in status.interfaces)
10                                 {
11                                         var state = '';
12                                         var css = '';
13                                         switch (status.interfaces[iface].status)
14                                         {
15                                                 case 'online':
16                                                         state = '<%:Online (tracking active)%>';
17                                                         css = 'wanon';
18                                                         break;
19                                                 case 'notMonitored':
20                                                         state = '<%:Online (tracking off)%>';
21                                                         css = 'wanon';
22                                                         break;
23                                                 case 'offline':
24                                                         state = '<%:Offline%>';
25                                                         css = 'wanoff';
26                                                         break;
27                                                 default:
28                                                         state = '<%:Disabled%>';
29                                                         css = 'wanoff';
30                                                         break;
31                                         }
32                                         statusview += String.format(
33                                                 '<span class="%s"><strong>%s</strong><br />%s</span>',
34                                                 css,
35                                                 iface,
36                                                 state
37                                         );
38                                 }
39                                 statusDiv.innerHTML = statusview;
40                         }
41                         else
42                         {
43                                 statusDiv.innerHTML = '<strong><%:No MWAN interfaces found%></strong>';
44                         }
45                 }
46         );
47 //]]></script>
48
49 <fieldset id="interface_field" class="cbi-section">
50         <legend><%:MWAN Interface Live Status%></legend>
51         <div id="mwan_status_text"><img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle" /><%:Collecting data...%></div>
52 </fieldset>
53
54 <style type="text/css">
55   .container {  /* container for entire page. fixes bootstrap theme's ridiculously small page width */
56         max-width: 1044px;
57   }
58   #mwan_status_text {
59         display: table;
60         font-size: 14px;
61         margin: auto;
62         max-width: 1044px;
63         min-width: 246px;
64         width: 100%;
65   }
66   .wanon {
67         background-color: rgb(144, 240, 144);
68   }
69   .wanoff {
70         background-color: rgb(240, 144, 144);
71   }
72   .wanon, .wanoff {
73         border-radius: 60px;
74         box-shadow: 0px 2px 5px -3px;
75         float: left;
76         margin: 8px 3px 0px 3px;
77         min-height: 30px;
78         min-width: 235px;
79         padding: 5px 10px 8px 10px;
80         text-align: center;
81   }
82 </style>