luci-app-wman3: show info if mwan3 is not global enabled
[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         <%if not require("luci.sys").init.enabled("mwan3") then%>
70         <div><strong><%:INFO: MWAN not running%></strong></div>
71         <%end%>
72         <fieldset class="cbi-section">
73                 <legend id="diag-rc-legend"><%:Collecting data...%></legend>
74                 <span id="diag-rc-output">
75                         <img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align: middle;" />
76                 </span>
77         </fieldset>
78 </div>
79
80 <style type="text/css">
81   #mwan_status_text {
82         display: table;
83         font-size: 14px;
84         margin: auto;
85         max-width: 1044px;
86         min-width: 246px;
87         width: 100%;
88   }
89   .wanon {
90         background-color: rgb(144, 240, 144);
91   }
92   .wanoff {
93         background-color: rgb(240, 144, 144);
94   }
95   .wanon, .wanoff {
96         border-radius: 60px;
97         box-shadow: 0px 2px 5px -3px;
98         float: left;
99         margin: 8px 3px 0px 3px;
100         min-height: 30px;
101         min-width: 235px;
102         padding: 5px 10px 8px 10px;
103         text-align: center;
104   }
105   #mwan_statuslog_text {
106         padding: 20px;
107         text-align: left;
108   }
109 </style>
110
111 <%+footer%>