blob: b08f1d138a270dc1e692a9f2805189c3bea526e9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
<%#
Copyright 2014 Aedan Renner <chipdankly@gmail.com>
Copyright 2018 Florian Eckert <fe@dev.tdt.de>
Licensed to the public under the GNU General Public License v2.
-%>
<%+header%>
<ul class="cbi-tabmenu">
<li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/status/mwan/overview")%>"><%:Interface%></a></li>
<li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/status/mwan/detail")%>"><%:Detail%></a></li>
<li class="cbi-tab"><a href="<%=luci.dispatcher.build_url("admin/status/mwan/diagnostics")%>"><%:Diagnostics%></a></li>
<li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/status/mwan/troubleshooting")%>"><%:Troubleshooting%></a></li>
</ul>
<%
local uci = require "luci.model.uci"
local iface = {}
uci.cursor():foreach("mwan3", "interface",
function (section)
table.insert(iface, section[".name"])
end
)
%>
<script type="text/javascript">//<![CDATA[
var stxhr = new XHR();
function update_status(iface, task)
{
var output = document.getElementById('diag-rc-output');
output.innerHTML =
'<img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align: middle;" />' +
"<%:Waiting for command to complete...%>"
;
output.parentNode.style.display = 'block';
output.style.display = 'inline';
stxhr.post('<%=url('admin/status/mwan')%>/diagnostics_display' + '/' + iface + '/' + task, { token: '<%=token%>' },
function(x)
{
output.innerHTML = String.format('<pre>%h</pre>', x.responseText);
}
);
}
//]]></script>
<form method="post" action="<%=url('admin/network/diagnostics')%>">
<div class="cbi-map">
<h2 name="content"><%:MWAN Status - Diagnostics%></h2>
<%if not require("luci.sys").init.enabled("mwan3") then%>
<div><strong><%:INFO: MWAN not running%></strong></div>
<%end%>
<div class="cbi-section">
<div class="cbi-section-node">
<div class="cbi-value">
<label class="cbi-value-title"><%:Interface%></label>
<div class="cbi-value-field">
<select class="cbi-input-select" name="iface">
<% for _, z in ipairs(iface) do -%><option value="<%=z%>"><%=z%></option><%- end %>
</select>
</div>
</div>
</div>
<div class="cbi-section-node">
<div class="cbi-value">
<label class="cbi-value-title"><%:Task%></label>
<div class="cbi-value-field">
<select class="cbi-input-select" name="task">
<option value="ping_gateway"><%:Ping default gateway%></option>
<option value="ping_trackips"><%:Ping tracking IP%></option>
<option value="check_rules"><%:Check IP rules%></option>
<option value="check_routes"><%:Check routing table%></option>
<option value="hotplug_ifup"><%:Hotplug ifup%></option>
<option value="hotplug_ifdown"><%:Hotplug ifdown%></option>
</select>
</div>
</div>
</div>
</div>
<div class="cbi-section-create">
<input type="button" value="<%:Execute%>" class="btn cbi-button cbi-button-apply" onclick="update_status(this.form.iface.value, this.form.task.value)"/>
</div>
<div class="cbi-section" style="display:none">
<span id="diag-rc-output"></span>
</div>
</div>
</form>
<%+footer%>
|