diff options
author | Manuel Munz <freifunk@somakoma.de> | 2012-11-11 12:20:56 +0000 |
---|---|---|
committer | Manuel Munz <freifunk@somakoma.de> | 2012-11-11 12:20:56 +0000 |
commit | 69dbc27ce0517c0bd414bbfb9cdff53fa968a3cd (patch) | |
tree | e7a136b4b36438d69151d8546f58fdeae7aff480 /modules/admin-full/luasrc/view | |
parent | d19eba5bc342723b17ca1315730d815cea2ec878 (diff) |
admin-full/diagnostics: Allow to use ping6 and traceroute6 when available, #487
Diffstat (limited to 'modules/admin-full/luasrc/view')
-rw-r--r-- | modules/admin-full/luasrc/view/admin_network/diagnostics.htm | 41 |
1 files changed, 34 insertions, 7 deletions
diff --git a/modules/admin-full/luasrc/view/admin_network/diagnostics.htm b/modules/admin-full/luasrc/view/admin_network/diagnostics.htm index a991f9a48f..abbc906234 100644 --- a/modules/admin-full/luasrc/view/admin_network/diagnostics.htm +++ b/modules/admin-full/luasrc/view/admin_network/diagnostics.htm @@ -14,18 +14,33 @@ $Id$ <%+header%> +<% +local fs = require "nixio.fs" +local has_ping6 = fs.access("/bin/ping6") or fs.access("/usr/bin/ping6") +local has_traceroute6 = fs.access("/usr/bin/traceroute6") +%> + <script type="text/javascript" src="<%=resource%>/cbi.js"></script> <script type="text/javascript">//<![CDATA[ var stxhr = new XHR(); - function update_status(field) + function update_status(field,proto) { var tool = field.name; var addr = field.value; + var protocol = "" var legend = document.getElementById('diag-rc-legend'); var output = document.getElementById('diag-rc-output'); + if (typeof proto != 'undefined') { + for(var i = 0; i < proto.length; i++) { + if(proto[i].checked) { + protocol = proto[i].value; + } + } + } + if (legend && output) { output.innerHTML = @@ -36,7 +51,7 @@ $Id$ legend.parentNode.style.display = 'block'; legend.style.display = 'inline'; - stxhr.get('<%=luci.dispatcher.build_url("admin", "network")%>/diag_' + tool + '/' + addr, null, + stxhr.get('<%=luci.dispatcher.build_url("admin", "network")%>/diag_' + tool + protocol + '/' + addr, null, function(x) { if (x.responseText) @@ -64,17 +79,29 @@ $Id$ <br /> - <div style="width:30%; float:left; text-align:center"> + <div style="width:30%; float:left"> <input style="width: 50%" type="text" value="openwrt.org" name="ping" /> - <input type="button" value="<%:Ping%>" class="cbi-button cbi-button-apply" onclick="update_status(this.form.ping)" /> + <input type="button" value="<%:Ping%>" class="cbi-button cbi-button-apply" onclick="update_status(this.form.ping,this.form.proto)" /> + <% if has_ping6 then %> + <div style="width:100%; margin-top: 10px;"> + <input type="radio" name="proto" value="" checked> <%:IPv4%> + <input type="radio" name="proto" value="6"> <%:IPv6%> + </div> + <%end%> </div> - <div style="width:30%; float:left; text-align:center"> + <div style="width:33%; float:left"> <input style="width: 50%" type="text" value="openwrt.org" name="traceroute" /> - <input type="button" value="<%:Traceroute%>" class="cbi-button cbi-button-apply" onclick="update_status(this.form.traceroute)" /> + <input type="button" value="<%:Traceroute%>" class="cbi-button cbi-button-apply" onclick="update_status(this.form.traceroute,this.form.trproto)" /> + <% if has_traceroute6 then %> + <div style="width:100%; margin-top: 10px;"> + <input type="radio" name="trproto" value="" checked> <%:IPv4%> + <input type="radio" name="trproto" value="6"> <%:IPv6%> + </div> + <%end%> </div> - <div style="width:30%; float:left; text-align:center"> + <div style="width:33%; float:left;"> <input style="width: 50%" type="text" value="openwrt.org" name="nslookup" /> <input type="button" value="<%:Nslookup%>" class="cbi-button cbi-button-apply" onclick="update_status(this.form.nslookup)" /> </div> |