123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- <%+header%>
- <ul class="cbi-tabmenu">
- <li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan/advanced/hotplugscript")%>"><%:Hotplug Script%></a></li>
- <li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan/advanced/mwanconfig")%>"><%:MWAN Config%></a></li>
- <li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan/advanced/networkconfig")%>"><%:Network Config%></a></li>
- <li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan/advanced/wirelessconfig")%>"><%:Wireless Config%></a></li>
- <li class="cbi-tab"><a href="<%=luci.dispatcher.build_url("admin/network/mwan/advanced/diagnostics")%>"><%:Diagnostics%></a></li>
- <li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan/advanced/troubleshooting")%>"><%:Troubleshooting%></a></li>
- </ul>
- <%
- local uci = require "luci.model.uci"
- interfaceNames = ""
- uci.cursor():foreach("mwan3", "interface",
- function (section)
- interfaceNames = interfaceNames .. section[".name"] .. " "
- end
- )
- %>
- <script type="text/javascript" src="<%=resource%>/cbi.js"></script>
- <script type="text/javascript">//<![CDATA[
- var stxhr = new XHR();
- function update_status(tool, task, task_name)
- {
- var iface = document.getElementById('mwaniface').value;
- var output = document.getElementById('diag_output');
- if (tool == "service")
- {
- output.innerHTML =
- '<img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="padding: 20px; vertical-align: middle;" /> ' +
- String.format("<%:Waiting for MWAN to %s...%>", task_name)
- ;
- }
- else
- {
- output.innerHTML =
- '<img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="padding: 20px; vertical-align: middle;" /> ' +
- "<%:Waiting for diagnostic results...%>"
- ;
- }
- output.parentNode.style.display = 'block';
- output.style.display = 'inline';
- stxhr.get('<%=luci.dispatcher.build_url("admin", "network", "mwan", "advanced")%>/diagnostics_display' + '/' + iface + '/' + tool + '/' + task, null,
- function(x, mArray)
- {
- if (mArray.diagnostics)
- {
- output.innerHTML = String.format('<pre id="diag_output_css">%h</pre>', mArray.diagnostics[0]);
- }
- else
- {
- output.innerHTML = '<pre id="diag_output_css"><strong><%:No diagnostic results returned%></strong></pre>';
- }
- }
- );
- }
- //]]></script>
- <div id="mwan_diagnostics" class="cbi-map">
- <fieldset id="diag_select" class="cbi-section">
- <legend><%:MWAN Interface Diagnostics%></legend>
- <select id="mwaniface">
- <% for z in interfaceNames:gmatch("[^ ]+") do -%><option value="<%=z%>"><%=z%></option><%- end %>
- </select>
- <div id="buttoncss">
- <input type="button" value="<%:Ping default gateway%>" class="cbi-button cbi-button-apply" onclick="update_status('ping', 'gateway', null)" />
- <input type="button" value="<%:Ping tracking IP%>" class="cbi-button cbi-button-apply" onclick="update_status('ping', 'track_ip', null)" />
- <input type="button" value="<%:Check IP rules%>" class="cbi-button cbi-button-apply" onclick="update_status('rulechk', null, null)" />
- <input type="button" value="<%:Check routing table%>" class="cbi-button cbi-button-apply" onclick="update_status('routechk', null, null)" />
- <input type="button" value="<%:Hotplug ifup%>" class="cbi-button cbi-button-apply" onclick="update_status('hotplug', 'ifup', null)" />
- <input type="button" value="<%:Hotplug ifdown%>" class="cbi-button cbi-button-apply" onclick="update_status('hotplug', 'ifdown', null)" />
- </div>
- </fieldset>
- <fieldset id="diag_select" class="cbi-section">
- <legend><%:MWAN Service Control%></legend>
- <div id="buttoncss">
- <input type="button" value="<%:Restart MWAN%>" class="cbi-button cbi-button-apply" onclick="update_status('service', 'restart', '<%:restart%>')" />
- <input type="button" value="<%:Stop MWAN%>" class="cbi-button cbi-button-apply" onclick="update_status('service', 'stop', '<%:stop%>')" />
- <input type="button" value="<%:Start MWAN%>" class="cbi-button cbi-button-apply" onclick="update_status('service', 'start', '<%:start%>')" />
- </div>
- </fieldset>
- <fieldset class="cbi-section" style="display:none">
- <legend><%:Diagnostic Results%></legend>
- <div id="diag_output"></div>
- </fieldset>
- </div>
- <style type="text/css">
- #mwaniface {
- float: left;
- margin: 8px 20px 0px 0px;
- }
- #buttoncss {
- display: table;
- float: left;
- text-align: left;
- }
- .cbi-button {
- margin: 8px 20px 0px 0px;
- min-width: 153px;
- }
- #diag_output_css {
- padding: 20px;
- text-align: left;
- }
- </style>
- <%+footer%>
|