luci-app-mwan3: update entry naming
[project/luci.git] / applications / luci-app-mwan3 / luasrc / view / mwan / advanced_diagnostics.htm
1 <%+header%>
2
3 <ul class="cbi-tabmenu">
4         <li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/status/mwan/overview")%>"><%:Interface Status%></a></li>
5         <li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/status/mwan/detail")%>"><%:Detailed Status%></a></li>
6         <li class="cbi-tab"><a href="<%=luci.dispatcher.build_url("admin/status/mwan/diagnostics")%>"><%:Diagnostics%></a></li>
7         <li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/status/mwan/troubleshooting")%>"><%:Troubleshooting%></a></li>
8 </ul>
9
10 <%
11         local uci = require "luci.model.uci"
12
13         interfaceNames = ""
14         uci.cursor():foreach("mwan3", "interface",
15                 function (section)
16                         interfaceNames = interfaceNames .. section[".name"] .. " "
17                 end
18         )
19 %>
20
21 <script type="text/javascript" src="<%=resource%>/cbi.js"></script>
22 <script type="text/javascript">//<![CDATA[
23         var stxhr = new XHR();
24
25         function update_status(tool, task, task_name)
26         {
27                 var iface = document.getElementById('mwaniface').value;
28                 var output = document.getElementById('diag_output');
29
30                 if (tool == "service")
31                         {
32                                 output.innerHTML =
33                                         '<img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="padding: 20px; vertical-align: middle;" /> ' +
34                                         String.format("<%:Waiting for MWAN to %s...%>", task_name)
35                                 ;
36                         }
37                         else
38                         {
39                                 output.innerHTML =
40                                         '<img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="padding: 20px; vertical-align: middle;" /> ' +
41                                         "<%:Waiting for diagnostic results...%>"
42                                 ;
43                         }
44
45                 output.parentNode.style.display = 'block';
46                 output.style.display = 'inline';
47
48                 stxhr.get('<%=luci.dispatcher.build_url("admin", "status", "mwan")%>/diagnostics_display' + '/' + iface + '/' + tool + '/' + task, null,
49                         function(x, mArray)
50                         {
51                                 if (mArray.diagnostics)
52                                 {
53                                         output.innerHTML = String.format('<pre id="diag_output_css">%h</pre>', mArray.diagnostics[0]);
54                                 }
55                                 else
56                                 {
57                                         output.innerHTML = '<pre id="diag_output_css"><strong><%:No diagnostic results returned%></strong></pre>';
58                                 }
59                         }
60                 );
61         }
62 //]]></script>
63
64 <div id="mwan_diagnostics" class="cbi-map">
65         <fieldset id="diag_select" class="cbi-section">
66                 <legend><%:MWAN Interface Diagnostics%></legend>
67                 <select id="mwaniface">
68                         <% for z in interfaceNames:gmatch("[^ ]+") do -%><option value="<%=z%>"><%=z%></option><%- end %>
69                 </select>
70                 <div id="buttoncss">
71                         <input type="button" value="<%:Ping default gateway%>" class="cbi-button cbi-button-apply" onclick="update_status('ping', 'gateway', null)" />
72                         <input type="button" value="<%:Ping tracking IP%>" class="cbi-button cbi-button-apply" onclick="update_status('ping', 'track_ip', null)" />
73                         <input type="button" value="<%:Check IP rules%>" class="cbi-button cbi-button-apply" onclick="update_status('rulechk', null, null)" />
74                         <input type="button" value="<%:Check routing table%>" class="cbi-button cbi-button-apply" onclick="update_status('routechk', null, null)" />
75                         <input type="button" value="<%:Hotplug ifup%>" class="cbi-button cbi-button-apply" onclick="update_status('hotplug', 'ifup', null)" />
76                         <input type="button" value="<%:Hotplug ifdown%>" class="cbi-button cbi-button-apply" onclick="update_status('hotplug', 'ifdown', null)" />
77                 </div>
78         </fieldset>
79         <fieldset id="diag_select" class="cbi-section">
80                 <legend><%:MWAN Service Control%></legend>
81                 <div id="buttoncss">
82                         <input type="button" value="<%:Restart MWAN%>" class="cbi-button cbi-button-apply" onclick="update_status('service', 'restart', '<%:restart%>')" />
83                         <input type="button" value="<%:Stop MWAN%>" class="cbi-button cbi-button-apply" onclick="update_status('service', 'stop', '<%:stop%>')" />
84                         <input type="button" value="<%:Start MWAN%>" class="cbi-button cbi-button-apply" onclick="update_status('service', 'start', '<%:start%>')" />
85                 </div>
86         </fieldset>
87         <fieldset class="cbi-section" style="display:none">
88                 <legend><%:Diagnostic Results%></legend>
89                 <div id="diag_output"></div>
90         </fieldset>
91 </div>
92
93 <style type="text/css">
94   #mwaniface {
95         float: left;
96         margin: 8px 20px 0px 0px;
97   }
98   #buttoncss {
99         display: table;
100         float: left;
101         text-align: left;
102   }
103   .cbi-button {
104         margin: 8px 20px 0px 0px;
105         min-width: 153px;
106   }
107   #diag_output_css {
108         padding: 20px;
109         text-align: left;
110   }
111 </style>
112
113 <%+footer%>