diff options
Diffstat (limited to 'modules/luci-mod-status/htdocs')
16 files changed, 99 insertions, 56 deletions
diff --git a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/bandwidth.js b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/bandwidth.js index 0d89ae8ae..edb934ed9 100644 --- a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/bandwidth.js +++ b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/bandwidth.js @@ -1,4 +1,8 @@ 'use strict'; +'require view'; +'require dom'; +'require poll'; +'require request'; 'require ui'; 'require rpc'; 'require network'; @@ -20,7 +24,7 @@ function rate(n, br) { return [ '%1024.2mbit/s'.format(n * 8), br ? E('br') : ' ', '(%1024.2mB/s)'.format(n) ] } -return L.view.extend({ +return view.extend({ load: function() { return Promise.all([ this.loadSVG(L.resource('bandwidth.svg')), @@ -95,7 +99,7 @@ return L.view.extend({ }, pollData: function() { - L.Poll.add(L.bind(function() { + poll.add(L.bind(function() { var tasks = []; for (var i = 0; i < graphPolls.length; i++) { @@ -227,7 +231,7 @@ return L.view.extend({ }, loadSVG: function(src) { - return L.Request.get(src).then(function(response) { + return request.get(src).then(function(response) { if (!response.ok) throw new Error(response.statusText); @@ -289,13 +293,13 @@ return L.view.extend({ tab.querySelector('#scale').firstChild.data = _('(%d minute window, %d second interval)').format(info.timeframe, info.interval); - L.dom.content(tab.querySelector('#rx_bw_cur'), rate(info.line_current[0], true)); - L.dom.content(tab.querySelector('#rx_bw_avg'), rate(info.line_average[0], true)); - L.dom.content(tab.querySelector('#rx_bw_peak'), rate(info.line_peak[0], true)); + dom.content(tab.querySelector('#rx_bw_cur'), rate(info.line_current[0], true)); + dom.content(tab.querySelector('#rx_bw_avg'), rate(info.line_average[0], true)); + dom.content(tab.querySelector('#rx_bw_peak'), rate(info.line_peak[0], true)); - L.dom.content(tab.querySelector('#tx_bw_cur'), rate(info.line_current[1], true)); - L.dom.content(tab.querySelector('#tx_bw_avg'), rate(info.line_average[1], true)); - L.dom.content(tab.querySelector('#tx_bw_peak'), rate(info.line_peak[1], true)); + dom.content(tab.querySelector('#tx_bw_cur'), rate(info.line_current[1], true)); + dom.content(tab.querySelector('#tx_bw_avg'), rate(info.line_average[1], true)); + dom.content(tab.querySelector('#tx_bw_peak'), rate(info.line_peak[1], true)); }); } diff --git a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/connections.js b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/connections.js index 458437ede..4c1b097f2 100644 --- a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/connections.js +++ b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/connections.js @@ -1,4 +1,7 @@ 'use strict'; +'require view'; +'require poll'; +'require request'; 'require rpc'; var callLuciRealtimeStats = rpc.declare({ @@ -30,7 +33,7 @@ var recheck_lookup_queue = {}; Math.log2 = Math.log2 || function(x) { return Math.log(x) * Math.LOG2E; }; -return L.view.extend({ +return view.extend({ load: function() { return Promise.all([ this.loadSVG(L.resource('connections.svg')) @@ -177,7 +180,7 @@ return L.view.extend({ }, pollData: function() { - L.Poll.add(L.bind(function() { + poll.add(L.bind(function() { var tasks = [ L.resolveDefault(callLuciConntrackList(), []) ]; @@ -300,7 +303,7 @@ return L.view.extend({ }, loadSVG: function(src) { - return L.Request.get(src).then(function(response) { + return request.get(src).then(function(response) { if (!response.ok) throw new Error(response.statusText); diff --git a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/dmesg.js b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/dmesg.js index 3b9428eaf..f3ee539bd 100644 --- a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/dmesg.js +++ b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/dmesg.js @@ -1,8 +1,9 @@ 'use strict'; +'require view'; 'require fs'; 'require ui'; -return L.view.extend({ +return view.extend({ load: function() { return fs.exec_direct('/bin/dmesg', [ '-r' ]).catch(function(err) { ui.addNotification(null, E('p', {}, _('Unable to load log data: ' + err.message))); diff --git a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/10_system.js b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/10_system.js index 4a3517529..942b2dd56 100644 --- a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/10_system.js +++ b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/10_system.js @@ -1,4 +1,5 @@ 'use strict'; +'require baseclass'; 'require fs'; 'require rpc'; @@ -12,7 +13,7 @@ var callSystemInfo = rpc.declare({ method: 'info' }); -return L.Class.extend({ +return baseclass.extend({ title: _('System'), load: function() { diff --git a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/20_memory.js b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/20_memory.js index 4219a8797..ceb13b56f 100644 --- a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/20_memory.js +++ b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/20_memory.js @@ -1,4 +1,5 @@ 'use strict'; +'require baseclass'; 'require rpc'; var callSystemInfo = rpc.declare({ @@ -19,7 +20,7 @@ function progressbar(value, max, byte) { }, E('div', { 'style': 'width:%.2f%%'.format(pc) })); } -return L.Class.extend({ +return baseclass.extend({ title: _('Memory'), load: function() { diff --git a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/30_network.js b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/30_network.js index 0a7b00e21..d52840823 100644 --- a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/30_network.js +++ b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/30_network.js @@ -1,4 +1,5 @@ 'use strict'; +'require baseclass'; 'require fs'; 'require network'; @@ -58,7 +59,7 @@ function renderbox(ifc, ipv6) { ]); } -return L.Class.extend({ +return baseclass.extend({ title: _('Network'), load: function() { diff --git a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/40_dhcp.js b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/40_dhcp.js index 9975a648f..f839a180c 100644 --- a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/40_dhcp.js +++ b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/40_dhcp.js @@ -1,4 +1,5 @@ 'use strict'; +'require baseclass'; 'require rpc'; 'require network'; @@ -8,7 +9,7 @@ var callLuciDHCPLeases = rpc.declare({ expect: { '': {} } }); -return L.Class.extend({ +return baseclass.extend({ title: '', load: function() { @@ -23,7 +24,7 @@ return L.Class.extend({ leases6 = Array.isArray(data[0].dhcp6_leases) ? data[0].dhcp6_leases : [], machints = data[1].getMACHints(false); - var table = E('div', { 'class': 'table' }, [ + var table = E('div', { 'class': 'table lases' }, [ E('div', { 'class': 'tr table-titles' }, [ E('div', { 'class': 'th' }, _('Hostname')), E('div', { 'class': 'th' }, _('IPv4-Address')), @@ -50,7 +51,7 @@ return L.Class.extend({ ]; }), E('em', _('There are no active leases'))); - var table6 = E('div', { 'class': 'table' }, [ + var table6 = E('div', { 'class': 'table leases6' }, [ E('div', { 'class': 'tr table-titles' }, [ E('div', { 'class': 'th' }, _('Host')), E('div', { 'class': 'th' }, _('IPv6-Address')), diff --git a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/50_dsl.js b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/50_dsl.js index 5a3d64e7a..cafd554f9 100644 --- a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/50_dsl.js +++ b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/50_dsl.js @@ -1,4 +1,5 @@ 'use strict'; +'require baseclass'; 'require rpc'; var callLuciDSLStatus = rpc.declare({ @@ -40,7 +41,7 @@ function renderbox(dsl) { ]); } -return L.Class.extend({ +return baseclass.extend({ title: _('DSL'), load: function() { diff --git a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/60_wifi.js b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/60_wifi.js index 86468c718..115fe9909 100644 --- a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/60_wifi.js +++ b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/60_wifi.js @@ -1,4 +1,6 @@ 'use strict'; +'require baseclass'; +'require dom'; 'require network'; function renderbox(radio, networks) { @@ -58,26 +60,26 @@ function renderbox(radio, networks) { } function wifirate(rt) { - var s = '%.1f %s, %d%s'.format(rt.rate / 1000, _('Mbit/s'), rt.mhz, _('MHz')), + var s = '%.1f\xa0%s, %d\xa0%s'.format(rt.rate / 1000, _('Mbit/s'), rt.mhz, _('MHz')), ht = rt.ht, vht = rt.vht, mhz = rt.mhz, nss = rt.nss, mcs = rt.mcs, sgi = rt.short_gi; if (ht || vht) { - if (vht) s += ', VHT-MCS %d'.format(mcs); - if (nss) s += ', VHT-NSS %d'.format(nss); - if (ht) s += ', MCS %s'.format(mcs); - if (sgi) s += ', ' + _('Short GI'); + if (vht) s += ', VHT-MCS\xa0%d'.format(mcs); + if (nss) s += ', VHT-NSS\xa0%d'.format(nss); + if (ht) s += ', MCS\xa0%s'.format(mcs); + if (sgi) s += ', ' + _('Short GI').replace(/ /g, '\xa0'); } return s; } -return L.Class.extend({ +return baseclass.extend({ title: _('Wireless'), handleDelClient: function(wifinet, mac, ev) { - L.dom.parent(ev.currentTarget, '.tr').style.opacity = 0.5; + dom.parent(ev.currentTarget, '.tr').style.opacity = 0.5; ev.currentTarget.classList.add('spinning'); ev.currentTarget.disabled = true; ev.currentTarget.blur(); @@ -119,13 +121,13 @@ return L.Class.extend({ if (!table.lastElementChild) return null; - var assoclist = E('div', { 'class': 'table' }, [ + var assoclist = E('div', { 'class': 'table assoclist' }, [ E('div', { 'class': 'tr table-titles' }, [ E('div', { 'class': 'th nowrap' }, _('Network')), E('div', { 'class': 'th hide-xs' }, _('MAC-Address')), E('div', { 'class': 'th' }, _('Host')), - E('div', { 'class': 'th nowrap' }, '%s / %s'.format(_('Signal'), _('Noise'))), - E('div', { 'class': 'th nowrap' }, '%s / %s'.format(_('RX Rate'), _('TX Rate'))) + E('div', { 'class': 'th' }, '%s / %s'.format(_('Signal'), _('Noise'))), + E('div', { 'class': 'th' }, '%s / %s'.format(_('RX Rate'), _('TX Rate'))) ]) ]); @@ -154,37 +156,51 @@ return L.Class.extend({ var sig_title, sig_value; if (bss.noise) { - sig_value = '%d / %d %s'.format(bss.signal, bss.noise, _('dBm')); + sig_value = '%d/%d\xa0%s'.format(bss.signal, bss.noise, _('dBm')); sig_title = '%s: %d %s / %s: %d %s / %s %d'.format( _('Signal'), bss.signal, _('dBm'), _('Noise'), bss.noise, _('dBm'), _('SNR'), bss.signal - bss.noise); } else { - sig_value = '%d %s'.format(bss.signal, _('dBm')); + sig_value = '%d\xa0%s'.format(bss.signal, _('dBm')); sig_title = '%s: %d %s'.format(_('Signal'), bss.signal, _('dBm')); } var hint; if (name && ipv4 && ipv6) - hint = '%s (%s, %s)'.format(name, ipv4, ipv6); + hint = '%s <span class="hide-xs">(%s, %s)</span>'.format(name, ipv4, ipv6); else if (name && (ipv4 || ipv6)) - hint = '%s (%s)'.format(name, ipv4 || ipv6); + hint = '%s <span class="hide-xs">(%s)</span>'.format(name, ipv4 || ipv6); else hint = name || ipv4 || ipv6 || '?'; var row = [ - E('span', { 'class': 'ifacebadge', 'title': networks[i].getI18n() }, [ + E('span', { + 'class': 'ifacebadge', + 'title': networks[i].getI18n(), + 'data-ifname': networks[i].getIfname(), + 'data-ssid': networks[i].getActiveSSID() + }, [ E('img', { 'src': L.resource('icons/wifi.png') }), - ' ', networks[i].getShortName(), - E('small', {}, [ ' (', networks[i].getIfname(), ')' ]) + E('span', {}, [ + ' ', networks[i].getShortName(), + E('small', {}, [ ' (', networks[i].getIfname(), ')' ]) + ]) ]), bss.mac, hint, - E('span', { 'class': 'ifacebadge', 'title': sig_title }, [ + E('span', { + 'class': 'ifacebadge', + 'title': sig_title, + 'data-signal': bss.signal, + 'data-noise': bss.noise + }, [ E('img', { 'src': icon }), - ' ', sig_value + E('span', {}, [ + ' ', sig_value + ]) ]), E('span', {}, [ E('span', wifirate(bss.rx)), @@ -195,7 +211,7 @@ return L.Class.extend({ if (networks[i].isClientDisconnectSupported()) { if (assoclist.firstElementChild.childNodes.length < 6) - assoclist.firstElementChild.appendChild(E('div', { 'class': 'th nowrap right' }, [ _('Disconnect') ])); + assoclist.firstElementChild.appendChild(E('div', { 'class': 'th cbi-section-actions' })); row.push(E('button', { 'class': 'cbi-button cbi-button-remove', diff --git a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/index.js b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/index.js index 01a8e1835..15dcbe638 100644 --- a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/index.js +++ b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/index.js @@ -1,4 +1,7 @@ 'use strict'; +'require view'; +'require dom'; +'require poll'; 'require fs'; 'require network'; @@ -35,7 +38,7 @@ function startPolling(includes, containers) { containers[i].parentNode.style.display = ''; containers[i].parentNode.classList.add('fade-in'); - L.dom.content(containers[i], content); + dom.content(containers[i], content); } } @@ -48,11 +51,11 @@ function startPolling(includes, containers) { }; return step().then(function() { - L.Poll.add(step); + poll.add(step); }); } -return L.view.extend({ +return view.extend({ load: function() { return L.resolveDefault(fs.list('/www' + L.resource('view/status/include')), []).then(function(entries) { return Promise.all(entries.filter(function(e) { diff --git a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/iptables.js b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/iptables.js index fc7c7cdd1..84d2b1055 100644 --- a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/iptables.js +++ b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/iptables.js @@ -1,10 +1,12 @@ 'use strict'; +'require view'; +'require poll'; 'require fs'; 'require ui'; var table_names = [ 'Filter', 'NAT', 'Mangle', 'Raw' ]; -return L.view.extend({ +return view.extend({ load: function() { return L.resolveDefault(fs.stat('/usr/sbin/ip6tables')); }, @@ -215,7 +217,7 @@ return L.view.extend({ if (has_ip6tables) cmds.push('/usr/sbin/ip6tables'); - L.Poll.add(L.bind(function() { + poll.add(L.bind(function() { var tasks = []; for (var i = 0; i < cmds.length; i++) { diff --git a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/load.js b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/load.js index 646d256d6..3b302dc50 100644 --- a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/load.js +++ b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/load.js @@ -1,4 +1,7 @@ 'use strict'; +'require view'; +'require poll'; +'require request'; 'require rpc'; var callLuciRealtimeStats = rpc.declare({ @@ -13,7 +16,7 @@ var graphPolls = [], Math.log2 = Math.log2 || function(x) { return Math.log(x) * Math.LOG2E; }; -return L.view.extend({ +return view.extend({ load: function() { return Promise.all([ this.loadSVG(L.resource('load.svg')) @@ -86,7 +89,7 @@ return L.view.extend({ }, pollData: function() { - L.Poll.add(L.bind(function() { + poll.add(L.bind(function() { var tasks = []; for (var i = 0; i < graphPolls.length; i++) { @@ -205,7 +208,7 @@ return L.view.extend({ }, loadSVG: function(src) { - return L.Request.get(src).then(function(response) { + return request.get(src).then(function(response) { if (!response.ok) throw new Error(response.statusText); diff --git a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/processes.js b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/processes.js index b996b78ce..8a77306e5 100644 --- a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/processes.js +++ b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/processes.js @@ -1,4 +1,5 @@ 'use strict'; +'require view'; 'require fs'; 'require ui'; 'require rpc'; @@ -9,7 +10,7 @@ var callLuciProcessList = rpc.declare({ expect: { result: [] } }); -return L.view.extend({ +return view.extend({ load: function() { return callLuciProcessList(); }, @@ -38,7 +39,7 @@ return L.view.extend({ proc.COMMAND, proc['%CPU'], proc['%MEM'], - E('div', { 'class': 'nowrap' }, [ + E('div', {}, [ E('button', { 'class': 'btn cbi-button-action', 'click': ui.createHandlerFn(this, 'handleSignal', 1, proc.PID) @@ -70,7 +71,7 @@ return L.view.extend({ E('div', { 'class': 'th' }, _('Command')), E('div', { 'class': 'th' }, _('CPU usage (%)')), E('div', { 'class': 'th' }, _('Memory usage (%)')), - E('div', { 'class': 'th center' }, _('Actions')) + E('div', { 'class': 'th center nowrap cbi-section-actions' }) ]) ]) ]); diff --git a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/routes.js b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/routes.js index 90cf2dd53..5da5d403b 100644 --- a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/routes.js +++ b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/routes.js @@ -1,4 +1,5 @@ 'use strict'; +'require view'; 'require fs'; 'require rpc'; 'require validation'; @@ -25,7 +26,7 @@ function applyMask(addr, mask, v6) { v6 ? '%x:%x:%x:%x:%x:%x:%x:%x' : '%d.%d.%d.%d', words); } -return L.view.extend({ +return view.extend({ load: function() { return Promise.all([ callNetworkInterfaceDump(), diff --git a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/syslog.js b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/syslog.js index 69694bcfb..145a632e6 100644 --- a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/syslog.js +++ b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/syslog.js @@ -1,8 +1,9 @@ 'use strict'; +'require view'; 'require fs'; 'require ui'; -return L.view.extend({ +return view.extend({ load: function() { return fs.exec_direct('/sbin/logread', [ '-e', '^' ]).catch(function(err) { ui.addNotification(null, E('p', {}, _('Unable to load log data: ' + err.message))); diff --git a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/wireless.js b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/wireless.js index cd8cff133..171899262 100644 --- a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/wireless.js +++ b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/wireless.js @@ -1,4 +1,7 @@ 'use strict'; +'require view'; +'require poll'; +'require request'; 'require ui'; 'require rpc'; 'require network'; @@ -15,7 +18,7 @@ var graphPolls = [], Math.log2 = Math.log2 || function(x) { return Math.log(x) * Math.LOG2E; }; -return L.view.extend({ +return view.extend({ load: function() { return Promise.all([ this.loadSVG(L.resource('wireless.svg')), @@ -102,7 +105,7 @@ return L.view.extend({ }, pollData: function() { - L.Poll.add(L.bind(function() { + poll.add(L.bind(function() { var tasks = []; for (var i = 0; i < graphPolls.length; i++) { @@ -221,7 +224,7 @@ return L.view.extend({ }, loadSVG: function(src) { - return L.Request.get(src).then(function(response) { + return request.get(src).then(function(response) { if (!response.ok) throw new Error(response.statusText); |