diff options
Diffstat (limited to 'modules/luci-mod-status')
13 files changed, 142 insertions, 68 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 cb7cf8c23d..0fbe49c12c 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 @@ -209,6 +209,8 @@ return view.extend({ y = ctx.height - Math.floor(values[i][j] * data_scale); //y -= Math.floor(y % (1 / data_scale)); + y = isNaN(y) ? ctx.height : y; + pt += ' ' + x + ',' + y; } diff --git a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/channel_analysis.js b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/channel_analysis.js index 5f838108ef..0c8cff8c0e 100644 --- a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/channel_analysis.js +++ b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/channel_analysis.js @@ -196,7 +196,7 @@ return view.extend({ scanCache[local_wifi.bssid].data = local_wifi; - if (chan_analysis.offset_tbl[local_wifi.channel] != null) { + if (chan_analysis.offset_tbl[local_wifi.channel] != null && local_wifi.center_chan1) { var center_channels = [local_wifi.center_chan1], chan_width_text = local_wifi.htmode.replace(/(V)*HT/,''), chan_width = parseInt(chan_width_text)/10; @@ -369,14 +369,14 @@ return view.extend({ continue; var csvg = svg.cloneNode(true), - table = E('div', { 'class': 'table' }, [ - E('div', { 'class': 'tr table-titles' }, [ - E('div', { 'class': 'th col-2 middle center' }, _('Signal')), - E('div', { 'class': 'th col-4 middle left' }, _('SSID')), - E('div', { 'class': 'th col-2 middle center hide-xs' }, _('Channel')), - E('div', { 'class': 'th col-3 middle left' }, _('Channel Width')), - E('div', { 'class': 'th col-2 middle left hide-xs' }, _('Mode')), - E('div', { 'class': 'th col-3 middle left hide-xs' }, _('BSSID')) + table = E('table', { 'class': 'table' }, [ + E('tr', { 'class': 'tr table-titles' }, [ + E('th', { 'class': 'th col-2 middle center' }, _('Signal')), + E('th', { 'class': 'th col-4 middle left' }, _('SSID')), + E('th', { 'class': 'th col-2 middle center hide-xs' }, _('Channel')), + E('th', { 'class': 'th col-3 middle left' }, _('Channel Width')), + E('th', { 'class': 'th col-2 middle left hide-xs' }, _('Mode')), + E('th', { 'class': 'th col-3 middle left hide-xs' }, _('BSSID')) ]) ]), tab = E('div', { 'data-tab': ifname+freq, 'data-tab-title': ifname+' ('+freq+')' }, 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 9d97569d22..168bfefdf8 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 @@ -133,8 +133,8 @@ return view.extend({ rows.push([ c.layer3.toUpperCase(), c.layer4.toUpperCase(), - c.hasOwnProperty('sport') ? (src + ':' + c.sport) : src, - c.hasOwnProperty('dport') ? (dst + ':' + c.dport) : dst, + '%h'.format(c.hasOwnProperty('sport') ? (src + ':' + c.sport) : src), + '%h'.format(c.hasOwnProperty('dport') ? (dst + ':' + c.dport) : dst), '%1024.2mB (%d %s)'.format(c.bytes, c.packets, _('Pkts.')) ]); } @@ -281,6 +281,8 @@ return view.extend({ y = ctx.height - Math.floor(values[i][j] * data_scale); //y -= Math.floor(y % (1 / data_scale)); + y = isNaN(y) ? ctx.height : y; + pt += ' ' + x + ',' + y; } 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 3e89578002..0a885c01c9 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 @@ -34,9 +34,11 @@ return baseclass.extend({ var fields = [ _('Total Available'), (mem.available) ? mem.available : (mem.total && mem.free && mem.buffered) ? mem.free + mem.buffered : null, mem.total, _('Used'), (mem.total && mem.free) ? (mem.total - mem.free) : null, mem.total, - _('Buffered'), (mem.total && mem.buffered) ? mem.buffered : null, mem.total ]; + if (mem.buffered) + fields.push(_('Buffered'), mem.buffered, mem.total); + if (mem.cached) fields.push(_('Cached'), mem.cached, mem.total); 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 3359ca82cc..1a0f7037f9 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 @@ -53,7 +53,7 @@ function renderbox(ifc, ipv6) { E('div', {}, renderBadge( L.resource('icons/%s.png').format(dev ? dev.getType() : 'ethernet_disabled'), null, _('Device'), dev ? dev.getI18n() : '-', - _('MAC-Address'), dev.getMAC()) + _('MAC address'), dev.getMAC()) ) ]) ]); 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 e06b555e83..b93f26875d 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 @@ -21,7 +21,7 @@ return baseclass.extend({ return Promise.all([ callLuciDHCPLeases(), network.getHostHints(), - uci.load('dhcp') + L.resolveDefault(uci.load('dhcp')) ]); }, @@ -31,7 +31,7 @@ return baseclass.extend({ ev.currentTarget.blur(); var cfg = uci.add('dhcp', 'host'); - uci.set('dhcp', cfg, 'name', lease.hostname || '-'); + uci.set('dhcp', cfg, 'name', lease.hostname); uci.set('dhcp', cfg, 'ip', lease.ipaddr); uci.set('dhcp', cfg, 'mac', lease.macaddr.toUpperCase()); @@ -48,7 +48,7 @@ return baseclass.extend({ var cfg = uci.add('dhcp', 'host'), ip6arr = lease.ip6addrs[0] ? validation.parseIPv6(lease.ip6addrs[0]) : null; - uci.set('dhcp', cfg, 'name', lease.hostname || '-'); + uci.set('dhcp', cfg, 'name', lease.hostname); uci.set('dhcp', cfg, 'duid', lease.duid.toUpperCase()); uci.set('dhcp', cfg, 'mac', lease.macaddr); if (ip6arr) @@ -63,7 +63,8 @@ return baseclass.extend({ var leases = Array.isArray(data[0].dhcp_leases) ? data[0].dhcp_leases : [], leases6 = Array.isArray(data[0].dhcp6_leases) ? data[0].dhcp6_leases : [], machints = data[1].getMACHints(false), - hosts = uci.sections('dhcp', 'host'); + hosts = uci.sections('dhcp', 'host'), + isReadonlyView = !L.hasViewPermission(); for (var i = 0; i < hosts.length; i++) { var host = hosts[i]; @@ -84,10 +85,10 @@ return baseclass.extend({ var table = E('table', { 'class': 'table lases' }, [ E('tr', { 'class': 'tr table-titles' }, [ E('th', { 'class': 'th' }, _('Hostname')), - E('th', { 'class': 'th' }, _('IPv4-Address')), - E('th', { 'class': 'th' }, _('MAC-Address')), + E('th', { 'class': 'th' }, _('IPv4 address')), + E('th', { 'class': 'th' }, _('MAC address')), E('th', { 'class': 'th' }, _('Lease time remaining')), - E('th', { 'class': 'th cbi-section-actions' }, _('Static Lease')) + isReadonlyView ? E([]) : E('th', { 'class': 'th cbi-section-actions' }, _('Static Lease')) ]) ]); @@ -108,7 +109,7 @@ return baseclass.extend({ exp ]; - if (lease.macaddr != null) { + if (!isReadonlyView && lease.macaddr != null) { var mac = lease.macaddr.toUpperCase(); rows.push(E('button', { 'class': 'cbi-button cbi-button-apply', @@ -123,10 +124,10 @@ return baseclass.extend({ var table6 = E('table', { 'class': 'table leases6' }, [ E('tr', { 'class': 'tr table-titles' }, [ E('th', { 'class': 'th' }, _('Host')), - E('th', { 'class': 'th' }, _('IPv6-Address')), + E('th', { 'class': 'th' }, _('IPv6 address')), E('th', { 'class': 'th' }, _('DUID')), E('th', { 'class': 'th' }, _('Lease time remaining')), - E('th', { 'class': 'th cbi-section-actions' }, _('Static Lease')) + isReadonlyView ? E([]) : E('th', { 'class': 'th cbi-section-actions' }, _('Static Lease')) ]) ]); @@ -157,7 +158,7 @@ return baseclass.extend({ exp ]; - if (lease.duid != null) { + if (!isReadonlyView && lease.duid != null) { var duid = lease.duid.toUpperCase(); rows.push(E('button', { 'class': 'cbi-button cbi-button-apply', 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 18172aae94..7cb3e78e7a 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 @@ -226,7 +226,7 @@ return baseclass.extend({ var assoclist = E('table', { 'class': 'table assoclist' }, [ E('tr', { 'class': 'tr table-titles' }, [ E('th', { 'class': 'th nowrap' }, _('Network')), - E('th', { 'class': 'th hide-xs' }, _('MAC-Address')), + E('th', { 'class': 'th hide-xs' }, _('MAC address')), E('th', { 'class': 'th' }, _('Host')), E('th', { 'class': 'th' }, '%s / %s'.format(_('Signal'), _('Noise'))), E('th', { 'class': 'th' }, '%s / %s'.format(_('RX Rate'), _('TX Rate'))) 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 be45f78a7e..951c31218d 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 @@ -348,7 +348,7 @@ return view.extend({ }, [ _('Restart Firewall') ]) ]), E('div', {}, [ - E('div', { 'data-tab': 'iptables', 'data-tab-title': has_ip6tables ? _('IPv4 Firewall') : null }, [ + E('div', { 'data-tab': 'iptables', 'data-tab-title': has_ip6tables ? _('IPv4 Firewall') : null, 'data-tab-active': has_ip6tables ? null : true }, [ E('p', {}, E('em', { 'class': 'spinning' }, [ _('Collecting data...') ])) ]), has_ip6tables ? E('div', { 'data-tab': 'ip6tables', 'data-tab-title': _('IPv6 Firewall') }, [ 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 2766f5d1b5..633e43e6c3 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 @@ -186,6 +186,8 @@ return view.extend({ y = ctx.height - Math.floor(values[i][j] * data_scale); //y -= Math.floor(y % (1 / data_scale)); + y = isNaN(y) ? ctx.height : y; + pt += ' ' + x + ',' + y; } 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 ac512bb849..27a5bdf90d 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 @@ -3,6 +3,7 @@ 'require fs'; 'require rpc'; 'require validation'; +'require ui'; var callNetworkInterfaceDump = rpc.declare({ object: 'network.interface', @@ -32,8 +33,10 @@ return view.extend({ callNetworkInterfaceDump(), L.resolveDefault(fs.exec('/sbin/ip', [ '-4', 'neigh', 'show' ]), {}), L.resolveDefault(fs.exec('/sbin/ip', [ '-4', 'route', 'show', 'table', 'all' ]), {}), + L.resolveDefault(fs.exec('/sbin/ip', [ '-4', 'rule', 'show' ]), {}), L.resolveDefault(fs.exec('/sbin/ip', [ '-6', 'neigh', 'show' ]), {}), - L.resolveDefault(fs.exec('/sbin/ip', [ '-6', 'route', 'show', 'table', 'all' ]), {}) + L.resolveDefault(fs.exec('/sbin/ip', [ '-6', 'route', 'show', 'table', 'all' ]), {}), + L.resolveDefault(fs.exec('/sbin/ip', [ '-6', 'rule', 'show' ]), {}) ]); }, @@ -143,17 +146,37 @@ return view.extend({ return res; }, + parseRule: function(s) { + var lines = s.trim().split(/\n/), + res = []; + + for (var i = 0; i < lines.length; i++) { + var m = lines[i].match(/^(\d+):\s+(.+)$/), + prio = m ? m[1] : null, + rule = m ? m[2] : null; + + res.push([ + prio, + rule + ]); + } + + return res; + }, + render: function(data) { var networks = data[0], ip4neigh = data[1].stdout || '', ip4route = data[2].stdout || '', - ip6neigh = data[3].stdout || '', - ip6route = data[4].stdout || ''; + ip4rule = data[3].stdout || '', + ip6neigh = data[4].stdout || '', + ip6route = data[5].stdout || '', + ip6rule = data[6].stdout || ''; var neigh4tbl = E('table', { 'class': 'table' }, [ E('tr', { 'class': 'tr table-titles' }, [ - E('th', { 'class': 'th' }, [ _('IPv4-Address') ]), - E('th', { 'class': 'th' }, [ _('MAC-Address') ]), + E('th', { 'class': 'th' }, [ _('IP address') ]), + E('th', { 'class': 'th' }, [ _('MAC address') ]), E('th', { 'class': 'th' }, [ _('Interface') ]) ]) ]); @@ -162,17 +185,24 @@ return view.extend({ E('tr', { 'class': 'tr table-titles' }, [ E('th', { 'class': 'th' }, [ _('Network') ]), E('th', { 'class': 'th' }, [ _('Target') ]), - E('th', { 'class': 'th' }, [ _('IPv4-Gateway') ]), + E('th', { 'class': 'th' }, [ _('Gateway') ]), E('th', { 'class': 'th' }, [ _('Metric') ]), E('th', { 'class': 'th' }, [ _('Table') ]), - E('th', { 'class': 'th' }, [ _('Protocol') ]), + E('th', { 'class': 'th' }, [ _('Protocol') ]) + ]) + ]); + + var rule4tbl = E('table', { 'class': 'table' }, [ + E('tr', { 'class': 'tr table-titles' }, [ + E('th', { 'class': 'th' }, [ _('Priority') ]), + E('th', { 'class': 'th' }, [ _('Rule') ]) ]) ]); var neigh6tbl = E('table', { 'class': 'table' }, [ E('tr', { 'class': 'tr table-titles' }, [ - E('th', { 'class': 'th' }, [ _('IPv6-Address') ]), - E('th', { 'class': 'th' }, [ _('MAC-Address') ]), + E('th', { 'class': 'th' }, [ _('IP address') ]), + E('th', { 'class': 'th' }, [ _('MAC address') ]), E('th', { 'class': 'th' }, [ _('Interface') ]) ]) ]); @@ -184,31 +214,54 @@ return view.extend({ E('th', { 'class': 'th' }, [ _('Source') ]), E('th', { 'class': 'th' }, [ _('Metric') ]), E('th', { 'class': 'th' }, [ _('Table') ]), - E('th', { 'class': 'th' }, [ _('Protocol') ]), + E('th', { 'class': 'th' }, [ _('Protocol') ]) + ]) + ]); + + var rule6tbl = E('table', { 'class': 'table' }, [ + E('tr', { 'class': 'tr table-titles' }, [ + E('th', { 'class': 'th' }, [ _('Priority') ]), + E('th', { 'class': 'th' }, [ _('Rule') ]) ]) ]); cbi_update_table(neigh4tbl, this.parseNeigh(ip4neigh, networks, false)); cbi_update_table(route4tbl, this.parseRoute(ip4route, networks, false)); + cbi_update_table(rule4tbl, this.parseRule(ip4rule, networks, false)); cbi_update_table(neigh6tbl, this.parseNeigh(ip6neigh, networks, true)); cbi_update_table(route6tbl, this.parseRoute(ip6route, networks, true)); + cbi_update_table(rule6tbl, this.parseRule(ip6rule, networks, false)); - return E([], [ - E('h2', {}, [ _('Routes') ]), + var view = E([], [ + E('h2', {}, [ _('Routing') ]), E('p', {}, [ _('The following rules are currently active on this system.') ]), + E('div', {}, [ + E('div', { 'data-tab': 'ipv4routing', 'data-tab-title': _('IPv4 Routing') }, [ + E('h3', {}, [ _('IPv4 Neighbours') ]), + neigh4tbl, + + E('h3', {}, [ _('Active IPv4 Routes') ]), + route4tbl, + + E('h3', {}, [ _('Active IPv4 Rules') ]), + rule4tbl + ]), + E('div', { 'data-tab': 'ipv6routing', 'data-tab-title': _('IPv6 Routing') }, [ + E('h3', {}, [ _('IPv6 Neighbours') ]), + neigh6tbl, + + E('h3', {}, [ _('Active IPv6 Routes') ]), + route6tbl, + + E('h3', {}, [ _('Active IPv6 Rules') ]), + rule6tbl + ]) + ]) + ]); - E('h3', {}, [ _('ARP') ]), - neigh4tbl, - - E('h3', {}, _('Active <abbr title="Internet Protocol Version 4">IPv4</abbr>-Routes')), - route4tbl, - - E('h3', {}, [ _('IPv6 Neighbours') ]), - neigh6tbl, + ui.tabs.initTabGroup(view.lastElementChild.childNodes); - E('h3', {}, _('Active <abbr title="Internet Protocol Version 6">IPv6</abbr>-Routes')), - route6tbl - ]); + return view; }, handleSaveApply: null, 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 0fdd3d56e7..8848143c98 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 @@ -202,6 +202,8 @@ return view.extend({ y = ctx.height - Math.floor(values[i][j] * data_scale); //y -= Math.floor(y % (1 / data_scale)); + y = isNaN(y) ? ctx.height : y; + pt += ' ' + x + ',' + y; } diff --git a/modules/luci-mod-status/root/usr/share/luci/menu.d/luci-mod-status.json b/modules/luci-mod-status/root/usr/share/luci/menu.d/luci-mod-status.json index 0f066e67ad..e726c56b27 100644 --- a/modules/luci-mod-status/root/usr/share/luci/menu.d/luci-mod-status.json +++ b/modules/luci-mod-status/root/usr/share/luci/menu.d/luci-mod-status.json @@ -11,51 +11,57 @@ } }, - "admin/status/iptables": { - "title": "Firewall", + "admin/status/routes": { + "title": "Routing", "order": 2, "action": { "type": "view", - "path": "status/iptables" + "path": "status/routes" }, "depends": { - "acl": [ "luci-mod-status-firewall" ] + "acl": [ "luci-mod-status-routes" ] } }, - "admin/status/routes": { - "title": "Routes", + "admin/status/iptables": { + "title": "Firewall", "order": 3, "action": { "type": "view", - "path": "status/routes" + "path": "status/iptables" }, "depends": { - "acl": [ "luci-mod-status-routes" ] + "acl": [ "luci-mod-status-firewall" ] } }, - "admin/status/syslog": { + "admin/status/logs": { "title": "System Log", "order": 4, "action": { - "type": "view", - "path": "status/syslog" + "type": "alias", + "path": "admin/status/logs/syslog" }, "depends": { "acl": [ "luci-mod-status-logs" ] } }, - "admin/status/dmesg": { + "admin/status/logs/syslog": { + "title": "System Log", + "order": 1, + "action": { + "type": "view", + "path": "status/syslog" + } + }, + + "admin/status/logs/dmesg": { "title": "Kernel Log", - "order": 5, + "order": 2, "action": { "type": "view", "path": "status/dmesg" - }, - "depends": { - "acl": [ "luci-mod-status-logs" ] } }, diff --git a/modules/luci-mod-status/root/usr/share/rpcd/acl.d/luci-mod-status.json b/modules/luci-mod-status/root/usr/share/rpcd/acl.d/luci-mod-status.json index e23a0ae6b4..7199cb76f9 100644 --- a/modules/luci-mod-status/root/usr/share/rpcd/acl.d/luci-mod-status.json +++ b/modules/luci-mod-status/root/usr/share/rpcd/acl.d/luci-mod-status.json @@ -44,11 +44,12 @@ }, "luci-mod-status-routes": { - "description": "Grant access to the system route status", + "description": "Grant access to routing status", "read": { "file": { "/sbin/ip -[46] neigh show": [ "exec" ], - "/sbin/ip -[46] route show table all": [ "exec" ] + "/sbin/ip -[46] route show table all": [ "exec" ], + "/sbin/ip -[46] rule show": [ "exec" ] }, "ubus": { "file": [ "exec" ] @@ -57,7 +58,7 @@ }, "luci-mod-status-channel_analysis": { - "description": "Grant access to the system route status", + "description": "Grant access to wireless channel status", "read": { "ubus": { "iwinfo": [ "info", "freqlist" ] @@ -104,6 +105,9 @@ "file": [ "list", "read" ], "system": [ "board", "info" ] } + }, + "write": { + "uci": [ "dhcp" ] } }, |