diff options
-rw-r--r-- | modules/luci-mod-network/htdocs/luci-static/resources/view/network/diagnostics.js | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/diagnostics.js b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/diagnostics.js index af61390220..5855ee96af 100644 --- a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/diagnostics.js +++ b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/diagnostics.js @@ -4,6 +4,7 @@ 'require fs'; 'require ui'; 'require uci'; +'require network'; return view.extend({ handleCommand: function(exec, args) { @@ -50,7 +51,7 @@ return view.extend({ handleArpScan: function(ev, cmd) { var addr = ev.currentTarget.parentNode.previousSibling.value; - return this.handleCommand('arp-scan', [ '-l', '-I', addr]); + return this.handleCommand('arp-scan', [ '-l', '-I', addr ]); }, load: function() { @@ -60,6 +61,7 @@ return view.extend({ L.resolveDefault(fs.stat('/bin/traceroute6'), {}), L.resolveDefault(fs.stat('/usr/bin/traceroute6'), {}), L.resolveDefault(fs.stat('/usr/bin/arp-scan'), {}), + network.getDevices(), uci.load('luci') ]); }, @@ -68,6 +70,7 @@ return view.extend({ var has_ping6 = res[0].path || res[1].path, has_traceroute6 = res[2].path || res[3].path, has_arpscan = res[4].path, + devices = res[5], dns_host = uci.get('luci', 'diag', 'dns') || 'openwrt.org', ping_host = uci.get('luci', 'diag', 'ping') || 'openwrt.org', route_host = uci.get('luci', 'diag', 'route') || 'openwrt.org'; @@ -76,7 +79,7 @@ return view.extend({ E('h2', {}, [ _('Network Utilities') ]), E('table', { 'class': 'table' }, [ E('tr', { 'class': 'tr' }, [ - E('td', { 'class': 'td left', 'width': '25%' }, [ + E('td', { 'class': 'td left' }, [ E('input', { 'style': 'margin:5px 0', 'type': 'text', @@ -99,7 +102,7 @@ return view.extend({ ]) ]), - E('td', { 'class': 'td left', 'width': '25%' }, [ + E('td', { 'class': 'td left' }, [ E('input', { 'style': 'margin:5px 0', 'type': 'text', @@ -122,7 +125,7 @@ return view.extend({ ]) ]), - E('td', { 'class': 'td left', 'width': '25%' }, [ + E('td', { 'class': 'td left' }, [ E('input', { 'style': 'margin:5px 0', 'type': 'text', @@ -136,24 +139,23 @@ return view.extend({ ]) ]), - E('td', { 'class': 'td left', 'width': '25%' }, has_arpscan ? [ - E('input', { + has_arpscan ? E('td', { 'class': 'td left' }, [ + E('select', { 'style': 'margin:5px 0', - 'type': 'text', - 'value': 'br-lan' - }), + 'type': 'text' + }, devices.map(function(device) { + if (!device.isUp()) + return E([]); + + return E('option', { 'value': device.getName() }, [ device.getI18n() ]); + })), E('span', { 'class': 'diag-action' }, [ E('button', { 'class': 'cbi-button cbi-button-action', 'click': ui.createHandlerFn(this, 'handleArpScan') }, [ _('Arp-scan') ]) - ])] : E('p', {}, [ - E('em', _('Missing ARP scan')), E('br'), - E('a', { - href: L.url('admin/system/opkg') + '?query=arp-scan' - }, _('Install `arp-scan`...')) ]) - ), + ]) : E([]), ]) ]), E('pre', { 'class': 'command-output', 'style': 'display:none' }) |