summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-mod-status
diff options
context:
space:
mode:
authorAndre Heider <a.heider@gmail.com>2023-07-31 15:23:57 +0200
committerChristian Marangi <ansuelsmth@gmail.com>2023-09-18 13:40:34 +0200
commit9f8a553d19fd330a8a2d910080ca706e9bfcf19e (patch)
treee9c6e687db9de6bbcd0f701c4f3bcba3d6b46fff /modules/luci-mod-status
parent4e9dac1b6ebc1726bed9110931b2b1dac2f4306b (diff)
luci-mod-status: reuse the already provided band info
iwinfo already provides the band information with every channel, so just use that instead. Signed-off-by: Andre Heider <a.heider@gmail.com>
Diffstat (limited to 'modules/luci-mod-status')
-rw-r--r--modules/luci-mod-status/htdocs/luci-static/resources/view/status/channel_analysis.js36
1 files changed, 17 insertions, 19 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..d16f011ef0 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,7 +142,7 @@ 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 */
if ((next_channel - channel) == 4) {
@@ -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 = [];
@@ -376,22 +376,19 @@ 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: [] },
};
/* 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 +402,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 +411,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 +424,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));
}
}