eabdf293afd03dfc62a5beba14a4c233785a43ee
[project/luci.git] / applications / luci-app-mwan3 / luasrc / view / mwan / overview_interface.htm
1 <%+header%>
2
3 <ul class="cbi-tabmenu">
4         <li class="cbi-tab"><a href="<%=luci.dispatcher.build_url("admin/status/mwan/overview_interface")%>"><%:Interface Status%></a></li>
5         <li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/status/mwan/overview_detailed")%>"><%:Detailed Status%></a></li>
6 </ul>
7
8 <script type="text/javascript" src="<%=resource%>/cbi.js"></script>
9 <script type="text/javascript">//<![CDATA[
10         XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "status", "mwan", "interface_status")%>', null,
11                 function(x, mArray)
12                 {
13                         var statusDiv = document.getElementById('mwan_status_text');
14                         if (mArray.wans)
15                         {
16                                 var interfaceStatus = '';
17                                 for ( var i = 0; i < mArray.wans.length; i++ )
18                                 {
19                                         var status = '';
20                                         var css = '';
21                                         switch (mArray.wans[i].status)
22                                         {
23                                                 case 'online':
24                                                         status = '<%:Online (tracking active)%>';
25                                                         css = 'wanon';
26                                                         break;
27                                                 case 'notMonitored':
28                                                         status = '<%:Online (tracking off)%>';
29                                                         css = 'wanon';
30                                                         break;
31                                                 case 'offline':
32                                                         status = '<%:Offline%>';
33                                                         css = 'wanoff';
34                                                         break;
35                                                 case 'notEnabled':
36                                                         status = '<%:Disabled%>';
37                                                         css = 'wanoff';
38                                                         break;
39                                         }
40                                         interfaceStatus += String.format(
41                                                 '<span class="%s"><strong>%s (<a href="%q">%s</a>)</strong><br />%s</span>',
42                                                 css, mArray.wans[i].name, mArray.wans[i].link, mArray.wans[i].ifname, status
43                                         );
44                                 }
45                                 statusDiv.innerHTML = interfaceStatus;
46                         }
47                         else
48                         {
49                                 statusDiv.innerHTML = '<strong><%:No MWAN interfaces found%></strong>';
50                         }
51
52                         var logs = document.getElementById('mwan_statuslog_text');
53                         if (mArray.mwanlog)
54                         {
55                                 var mwanLog = '<%:Last 50 MWAN systemlog entries. Newest entries sorted at the top :%>';
56                                 logs.innerHTML = String.format('<pre>%s<br /><br />%s</pre>', mwanLog, mArray.mwanlog[0]);
57                         }
58                         else
59                         {
60                                 logs.innerHTML = '<strong><%:No MWAN systemlog history found%></strong>';
61                         }
62                 }
63         );
64 //]]></script>
65
66 <div id="mwan_interface_status">
67         <fieldset id="interface_field" class="cbi-section">
68                 <legend><%:MWAN Interface Live Status%></legend>
69                 <div id="mwan_status_text"><img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle" /><%:Collecting data...%></div>
70         </fieldset>
71         <fieldset class="cbi-section">
72                 <legend><%:MWAN Interface Systemlog%></legend>
73                 <div id="mwan_statuslog_text"><img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle" /><%:Collecting data...%></div>
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%>