summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-mod-status/htdocs
diff options
context:
space:
mode:
Diffstat (limited to 'modules/luci-mod-status/htdocs')
-rw-r--r--modules/luci-mod-status/htdocs/luci-static/resources/view/status/channel_analysis.js100
-rw-r--r--modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/25_storage.js56
-rw-r--r--modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/29_ports.js30
-rw-r--r--modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/40_dhcp.js4
-rw-r--r--modules/luci-mod-status/htdocs/luci-static/resources/view/status/iptables.js6
-rw-r--r--modules/luci-mod-status/htdocs/luci-static/resources/view/status/nftables.js2
6 files changed, 127 insertions, 71 deletions
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 d8a3393256..abd21ea3d9 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
@@ -97,9 +97,8 @@ return view.extend({
})
},
- create_channel_graph: function(chan_analysis, freq_tbl, freq) {
- var is5GHz = freq == '5GHz',
- columns = is5GHz ? freq_tbl.length * 4 : freq_tbl.length + 3,
+ create_channel_graph: function(chan_analysis, freq_tbl, band) {
+ var columns = (band != 2) ? freq_tbl.length * 4 : freq_tbl.length + 3,
chan_graph = chan_analysis.graph,
G = chan_graph.firstElementChild,
step = (chan_graph.offsetWidth - 2) / columns,
@@ -131,7 +130,7 @@ return view.extend({
var channel = freq_tbl[i]
chan_analysis.offset_tbl[channel] = curr_offset+step;
- if (is5GHz) {
+ if (band != 2) {
createGraphHLine(G,curr_offset+step, 0.1, 3);
if (channel < 100)
createGraphText(G,curr_offset-(step/2), channel);
@@ -143,9 +142,9 @@ return view.extend({
}
curr_offset += step;
- if (is5GHz && freq_tbl[i+1]) {
+ if ((band != 2) && freq_tbl[i+1]) {
var next_channel = freq_tbl[i+1];
- /* Check if we are transitioning to another 5Ghz band range */
+ /* Check if we are transitioning to another 5/6Ghz band range */
if ((next_channel - channel) == 4) {
for (var j=1; j < 4; j++) {
chan_analysis.offset_tbl[channel+j] = curr_offset+step;
@@ -193,7 +192,8 @@ return view.extend({
local_wifi = data[1],
table = radio.table,
chan_analysis = radio.graph,
- scanCache = radio.scanCache;
+ scanCache = radio.scanCache,
+ band = radio.band;
var rows = [];
@@ -205,36 +205,38 @@ return view.extend({
scanCache[results[i].bssid].data.stale = false;
}
- if (scanCache[local_wifi.bssid] == null)
- scanCache[local_wifi.bssid] = {};
+ if (band + 'g' == radio.dev.get('band')) {
+ if (scanCache[local_wifi.bssid] == null)
+ scanCache[local_wifi.bssid] = {};
- scanCache[local_wifi.bssid].data = local_wifi;
+ scanCache[local_wifi.bssid].data = local_wifi;
- 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)*H[TE]/,''), /* Handle HT VHT HE */
- chan_width = parseInt(chan_width_text)/10;
+ 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)*H[TE]/,''), /* Handle HT VHT HE */
+ chan_width = parseInt(chan_width_text)/10;
- if (local_wifi.center_chan2) {
- center_channels.push(local_wifi.center_chan2);
- chan_width = 8;
- }
-
- local_wifi.signal = -10;
- local_wifi.ssid = 'Local Interface';
+ if (local_wifi.center_chan2) {
+ center_channels.push(local_wifi.center_chan2);
+ chan_width = 8;
+ }
- this.add_wifi_to_graph(chan_analysis, local_wifi, scanCache, center_channels, chan_width);
- rows.push([
- this.render_signal_badge(q, local_wifi.signal),
- [
- E('span', { 'style': 'color:'+scanCache[local_wifi.bssid].color }, '⬤ '),
- local_wifi.ssid
- ],
- '%d'.format(local_wifi.channel),
- '%h MHz'.format(chan_width_text),
- '%h'.format(local_wifi.mode),
- '%h'.format(local_wifi.bssid)
- ]);
+ local_wifi.signal = -10;
+ local_wifi.ssid = 'Local Interface';
+
+ this.add_wifi_to_graph(chan_analysis, local_wifi, scanCache, center_channels, chan_width);
+ rows.push([
+ this.render_signal_badge(q, local_wifi.signal),
+ [
+ E('span', { 'style': 'color:'+scanCache[local_wifi.bssid].color }, '⬤ '),
+ local_wifi.ssid
+ ],
+ '%d'.format(local_wifi.channel),
+ '%h MHz'.format(chan_width_text),
+ '%h'.format(local_wifi.mode),
+ '%h'.format(local_wifi.bssid)
+ ]);
+ }
}
for (var k in scanCache)
@@ -266,6 +268,8 @@ return view.extend({
chan_width = 2;
/* Skip WiFi not supported by the current band */
+ if (band != res.band)
+ continue;
if (chan_analysis.offset_tbl[res.channel] == null)
continue;
@@ -285,7 +289,10 @@ return view.extend({
}
}
- if (res.vht_operation != null) {
+ /* if channel_width <= 40, refer to HT (above) for actual channel width,
+ * as vht_operation.channel_width == 40 really only means that the used
+ * bandwidth is <= 40 and could be 20 Mhz as well */
+ if (res.vht_operation != null && res.vht_operation.channel_width > 40) {
center_channels[0] = res.vht_operation.center_freq_1;
if (res.vht_operation.channel_width == 80) {
chan_width = 8;
@@ -376,22 +383,20 @@ return view.extend({
var tabs = E('div', {}, E('div'));
for (var ifname in wifiDevs) {
- var freq_tbl = {
- ['2.4GHz'] : [],
- ['5GHz'] : [],
+ var bands = {
+ [2] : { title: '2.4GHz', channels: [] },
+ [5] : { title: '5GHz', channels: [] },
+ [6] : { title: '6GHz', channels: [] },
};
/* Split FrequencyList in Bands */
wifiDevs[ifname].freq.forEach(function(freq) {
- if (freq.mhz >= 5000) {
- freq_tbl['5GHz'].push(freq.channel);
- } else {
- freq_tbl['2.4GHz'].push(freq.channel);
- }
+ if (bands[freq.band])
+ bands[freq.band].channels.push(freq.channel);
});
- for (var freq in freq_tbl) {
- if (freq_tbl[freq].length == 0)
+ for (var band in bands) {
+ if (bands[band].channels.length == 0)
continue;
var csvg = svg.cloneNode(true),
@@ -405,7 +410,7 @@ return view.extend({
E('th', { 'class': 'th col-3 middle left hide-xs' }, _('BSSID'))
])
]),
- tab = E('div', { 'data-tab': ifname+freq, 'data-tab-title': ifname+' ('+freq+')' },
+ tab = E('div', { 'data-tab': ifname+band, 'data-tab-title': ifname+' ('+bands[band].title+')' },
[E('br'),csvg,E('br'),table,E('br')]),
graph_data = {
graph: csvg,
@@ -414,8 +419,9 @@ return view.extend({
tab: tab,
};
- this.radios[ifname+freq] = {
+ this.radios[ifname+band] = {
dev: wifiDevs[ifname].dev,
+ band: band,
graph: graph_data,
table: table,
scanCache: {},
@@ -426,7 +432,7 @@ return view.extend({
tabs.firstElementChild.appendChild(tab)
- requestAnimationFrame(L.bind(this.create_channel_graph, this, graph_data, freq_tbl[freq], freq));
+ requestAnimationFrame(L.bind(this.create_channel_graph, this, graph_data, bands[band].channels, band));
}
}
diff --git a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/25_storage.js b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/25_storage.js
index f6a3cef036..60661f63e5 100644
--- a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/25_storage.js
+++ b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/25_storage.js
@@ -7,6 +7,20 @@ var callSystemInfo = rpc.declare({
method: 'info'
});
+var callMountPoints = rpc.declare({
+ object: 'luci',
+ method: 'getMountPoints',
+ expect: { result: [] }
+});
+
+var MountSkipList = [
+ "/rom",
+ "/tmp",
+ "/dev",
+ "/overlay",
+ "/",
+]
+
function progressbar(value, max, byte) {
var vn = parseInt(value) || 0,
mn = parseInt(max) || 100,
@@ -24,27 +38,49 @@ return baseclass.extend({
title: _('Storage'),
load: function() {
- return L.resolveDefault(callSystemInfo(), {});
+ return Promise.all([
+ L.resolveDefault(callSystemInfo(), {}),
+ L.resolveDefault(callMountPoints(), {}),
+ ]);
},
- render: function(systeminfo) {
- var root = L.isObject(systeminfo.root) ? systeminfo.root : {},
+ render: function(data) {
+ var systeminfo = data[0],
+ mounts = data[1],
+ root = L.isObject(systeminfo.root) ? systeminfo.root : {},
tmp = L.isObject(systeminfo.tmp) ? systeminfo.tmp : {};
- var fields = [];
- fields.push(_('Disk space'), root.used*1024, root.total*1024);
- fields.push(_('Temp space'), tmp.used*1024, tmp.total*1024);
+ const existenceChk = function(fields, name, values) {
+ if (!fields.hasOwnProperty(name))
+ fields[name] = values;
+ };
+
+ var fields = {};
+ existenceChk(fields, _('Disk space'), { used: root.used * 1024, size: root.total * 1024 });
+ existenceChk(fields, _('Temp space'), { used: tmp.used * 1024, size: tmp.total * 1024 });
+
+ for (var i = 0; i < mounts.length; i++) {
+ var entry = mounts[i];
+
+ if (MountSkipList.includes(entry.mount))
+ continue;
+
+ var name = entry.device + ' (' + entry.mount +')',
+ used = entry.size - entry.free;
+
+ existenceChk(fields, name, { used: used, size: entry.size });
+ }
var table = E('table', { 'class': 'table' });
- for (var i = 0; i < fields.length; i += 3) {
+ Object.keys(fields).forEach(function(key) {
table.appendChild(E('tr', { 'class': 'tr' }, [
- E('td', { 'class': 'td left', 'width': '33%' }, [ fields[i] ]),
+ E('td', { 'class': 'td left', 'width': '33%' }, [ key ]),
E('td', { 'class': 'td left' }, [
- (fields[i + 1] != null) ? progressbar(fields[i + 1], fields[i + 2], true) : '?'
+ (fields[key].used != null) ? progressbar(fields[key].used, fields[key].size, true) : '?'
])
]));
- }
+ });
return table;
}
diff --git a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/29_ports.js b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/29_ports.js
index 1351ab935a..b511897921 100644
--- a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/29_ports.js
+++ b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/29_ports.js
@@ -138,15 +138,24 @@ function buildVLANMappings(mapping)
}
}
-function resolveVLANPorts(ifname, mapping)
+function resolveVLANPorts(ifname, mapping, seen)
{
var ports = [];
- if (mapping[ifname])
- for (var i = 0; i < mapping[ifname].length; i++)
- ports.push.apply(ports, resolveVLANPorts(mapping[ifname][i], mapping));
- else
+ if (!seen)
+ seen = {};
+
+ if (mapping[ifname]) {
+ for (var i = 0; i < mapping[ifname].length; i++) {
+ if (!seen[mapping[ifname][i]]) {
+ seen[mapping[ifname][i]] = true;
+ ports.push.apply(ports, resolveVLANPorts(mapping[ifname][i], mapping, seen));
+ }
+ }
+ }
+ else {
ports.push(ifname);
+ }
return ports.sort(L.naturalCompare);
}
@@ -200,7 +209,7 @@ function buildInterfaceMapping(zones, networks) {
return portmap;
}
-function formatSpeed(speed, duplex) {
+function formatSpeed(carrier, speed, duplex) {
if (speed && duplex) {
var d = (duplex == 'half') ? '\u202f(H)' : '',
e = E('span', { 'title': _('Speed: %d Mibit/s, Duplex: %s').format(speed, duplex) });
@@ -220,7 +229,7 @@ function formatSpeed(speed, duplex) {
return e;
}
- return _('no link');
+ return carrier ? _('Connected') : _('no link');
}
function formatStats(portdev) {
@@ -343,21 +352,22 @@ return baseclass.extend({
return E('div', { 'style': 'display:grid;grid-template-columns:repeat(auto-fit, minmax(70px, 1fr));margin-bottom:1em' }, known_ports.map(function(port) {
var speed = port.netdev.getSpeed(),
duplex = port.netdev.getDuplex(),
+ carrier = port.netdev.getCarrier(),
pmap = port_map[port.netdev.getName()],
pzones = (pmap && pmap.zones.length) ? pmap.zones.sort(function(a, b) { return L.naturalCompare(a.getName(), b.getName()) }) : [ null ];
return E('div', { 'class': 'ifacebox', 'style': 'margin:.25em;min-width:70px;max-width:100px' }, [
E('div', { 'class': 'ifacebox-head', 'style': 'font-weight:bold' }, [ port.netdev.getName() ]),
E('div', { 'class': 'ifacebox-body' }, [
- E('img', { 'src': L.resource('icons/port_%s.png').format((speed && duplex) ? 'up' : 'down') }),
+ E('img', { 'src': L.resource('icons/port_%s.png').format(carrier ? 'up' : 'down') }),
E('br'),
- formatSpeed(speed, duplex)
+ formatSpeed(carrier, speed, duplex)
]),
E('div', { 'class': 'ifacebox-head cbi-tooltip-container', 'style': 'display:flex' }, [
E([], pzones.map(function(zone) {
return E('div', {
'class': 'zonebadge',
- 'style': 'cursor:help;flex:1;height:3px;' + firewall.getZoneColorStyle(zone)
+ 'style': 'cursor:help;flex:1;height:3px;opacity:' + (carrier ? 1 : 0.25) + ';' + firewall.getZoneColorStyle(zone)
});
})),
E('span', { 'class': 'cbi-tooltip left' }, [ renderNetworksTooltip(pmap) ])
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 956c1b20f9..4c52916423 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
@@ -82,7 +82,7 @@ return baseclass.extend({
}
};
- var table = E('table', { 'class': 'table lases' }, [
+ var table = E('table', { 'id': 'status_leases', 'class': 'table lases' }, [
E('tr', { 'class': 'tr table-titles' }, [
E('th', { 'class': 'th' }, _('Hostname')),
E('th', { 'class': 'th' }, _('IPv4 address')),
@@ -129,7 +129,7 @@ return baseclass.extend({
return rows;
}, this)), E('em', _('There are no active leases')));
- var table6 = E('table', { 'class': 'table leases6' }, [
+ var table6 = E('table', { 'id': 'status_leases6', 'class': 'table leases6' }, [
E('tr', { 'class': 'tr table-titles' }, [
E('th', { 'class': 'th' }, _('Host')),
E('th', { 'class': 'th' }, _('IPv6 address')),
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 e409a5ac50..917dada57a 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
@@ -252,7 +252,11 @@ return view.extend({
elem = document.getElementById('rule_%s_%s'.format(table.toLowerCase(), chain));
if (elem) {
- (document.documentElement || document.body.parentNode || document.body).scrollTop = elem.offsetTop - 40;
+ if (elem.scrollIntoView) {
+ elem.scrollIntoView();
+ } else {
+ (document.documentElement || document.body.parentNode || document.body).scrollTop = elem.offsetTop - 40;
+ }
elem.classList.remove('flash');
void elem.offsetWidth;
elem.classList.add('flash');
diff --git a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/nftables.js b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/nftables.js
index d891526d04..be62d91350 100644
--- a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/nftables.js
+++ b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/nftables.js
@@ -9,7 +9,7 @@ var expr_translations = {
'meta.iifname': _('Ingress device name', 'nft meta iifname'),
'meta.oifname': _('Egress device name', 'nft meta oifname'),
'meta.iif': _('Ingress device id', 'nft meta iif'),
- 'meta.iif': _('Egress device id', 'nft meta oif'),
+ 'meta.oif': _('Egress device id', 'nft meta oif'),
'meta.l4proto': _('IP protocol', 'nft meta l4proto'),
'meta.l4proto.tcp': 'TCP',