2 title
: L
.tr('Diagnostics'),
4 runPing
: L
.rpc
.declare({
5 object
: 'luci2.network',
8 expect
: { '': { code
: -1 } }
11 runPing6
: L
.rpc
.declare({
12 object
: 'luci2.network',
15 expect
: { '': { code
: -1 } }
18 runTraceroute
: L
.rpc
.declare({
19 object
: 'luci2.network',
22 expect
: { '': { code
: -1 } }
25 runTraceroute6
: L
.rpc
.declare({
26 object
: 'luci2.network',
27 method
: 'traceroute6',
29 expect
: { '': { code
: -1 } }
32 runNslookup
: L
.rpc
.declare({
33 object
: 'luci2.network',
36 expect
: { '': { code
: -1 } }
44 self
.runPing('?').then(function(rv
) {
45 if (rv
.code
!= -1) tools
.push(['runPing', L
.tr('IPv4 Ping')]);
47 self
.runPing6('?').then(function(rv
) {
48 if (rv
.code
!= -1) tools
.push(['runPing6', L
.tr('IPv6 Ping')]);
50 self
.runTraceroute('?').then(function(rv
) {
51 if (rv
.code
!= -1) tools
.push(['runTraceroute', L
.tr('IPv4 Traceroute')]);
53 self
.runTraceroute6('?').then(function(rv
) {
54 if (rv
.code
!= -1) tools
.push(['runTraceroute6', L
.tr('IPv6 Tracroute')]);
56 self
.runNslookup('?').then(function(rv
) {
57 if (rv
.code
!= -1) tools
.push(['runNslookup', L
.tr('DNS Lookup')]);
60 tools
.sort(function(a
, b
) {
69 for (var i
= 0; i
< tools
.length
; i
++)
70 $('#tool').append($('<option />').attr('value', tools
[i
][0]).text(tools
[i
][1]));
72 $('#tool').val('runPing');
74 $('#run').click(function() {
76 self
[$('#tool').val()]($('#host').val()).then(function(rv
) {
77 $('#output').empty().show();
80 $('#output').text(rv
.stdout
);
83 $('#output').append($('<span />').css('color', 'red').text(rv
.stderr
));