luci-app-mwan3: update look and feel interface status page
[project/luci.git] / applications / luci-app-mwan3 / luasrc / view / mwan / 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 <%+header%>
8
9 <ul class="cbi-tabmenu">
10         <li class="cbi-tab"><a href="<%=luci.dispatcher.build_url("admin/status/mwan/overview")%>"><%:Interface%></a></li>
11         <li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/status/mwan/detail")%>"><%:Detail%></a></li>
12         <li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/status/mwan/diagnostics")%>"><%:Diagnostics%></a></li>
13         <li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/status/mwan/troubleshooting")%>"><%:Troubleshooting%></a></li>
14 </ul>
15
16 <script type="text/javascript" src="<%=resource%>/cbi.js"></script>
17 <script type="text/javascript">//<![CDATA[
18         XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "status", "mwan", "interface_status")%>', null,
19                 function(x, status)
20                 {
21                         var legend = document.getElementById('diag-rc-legend');
22                         var statusDiv = document.getElementById('diag-rc-output');
23                         legend.style.display = 'none';
24                         if (status.interfaces)
25                         {
26                                 var statusview = '';
27                                 for ( var iface in status.interfaces)
28                                 {
29                                         var state = '';
30                                         var css = '';
31                                         switch (status.interfaces[iface].status)
32                                         {
33                                                 case 'online':
34                                                         state = '<%:Online (tracking active)%>';
35                                                         css = 'wanon';
36                                                         break;
37                                                 case 'notMonitored':
38                                                         state = '<%:Online (tracking off)%>';
39                                                         css = 'wanon';
40                                                         break;
41                                                 case 'offline':
42                                                         state = '<%:Offline%>';
43                                                         css = 'wanoff';
44                                                         break;
45                                                 default:
46                                                         state = '<%:Disabled%>';
47                                                         css = 'wanoff';
48                                                         break;
49                                         }
50                                         statusview += String.format(
51                                                 '<span class="%s"><strong>%s</strong><br />%s</span>',
52                                                 css,
53                                                 iface,
54                                                 state
55                                         );
56                                 }
57                                 statusDiv.innerHTML = statusview;
58                         }
59                         else
60                         {
61                                 statusDiv.innerHTML = '<strong><%:No MWAN interfaces found%></strong>';
62                         }
63                 }
64         );
65 //]]></script>
66
67 <div class="cbi-map">
68         <h2 name="content"><%:MWAN Status - Interface%></h2>
69         <fieldset class="cbi-section">
70                 <legend id="diag-rc-legend"><%:Collecting data...%></legend>
71                 <span id="diag-rc-output">
72                         <img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align: middle;" />
73                 </span>
74         </fieldset>
75 </div>
76
77 <style type="text/css">
78   #mwan_status_text {
79         display: table;
80         font-size: 14px;
81         margin: auto;
82         max-width: 1044px;
83         min-width: 246px;
84         width: 100%;
85   }
86   .wanon {
87         background-color: rgb(144, 240, 144);
88   }
89   .wanoff {
90         background-color: rgb(240, 144, 144);
91   }
92   .wanon, .wanoff {
93         border-radius: 60px;
94         box-shadow: 0px 2px 5px -3px;
95         float: left;
96         margin: 8px 3px 0px 3px;
97         min-height: 30px;
98         min-width: 235px;
99         padding: 5px 10px 8px 10px;
100         text-align: center;
101   }
102   #mwan_statuslog_text {
103         padding: 20px;
104         text-align: left;
105   }
106 </style>
107
108 <%+footer%>