channel used stats

This commit is contained in:
Martin Geno 2017-07-06 14:25:24 +02:00
parent b921e6cdee
commit 17ccb2c4ff
No known key found for this signature in database
GPG Key ID: F0D39A37E925E941
2 changed files with 37 additions and 6 deletions

View File

@ -86,14 +86,12 @@ const guiList = {};
option = domlib.newAt(tr, 'td'),
edit = domlib.newAt(option, 'div');
// eslint-disable-next-line no-underscore-dangle
if (!node._wireless) {
tr.classList.add('unseen');
} else {
startdate.setMinutes(startdate.getMinutes() - config.node.offline);
if (new Date(node.lastseen) < startdate) {
tr.classList.add('offline');
}
// eslint-disable-next-line no-underscore-dangle
} else if (!node._wireless) {
tr.classList.add('unseen');
}

View File

@ -9,6 +9,7 @@ const guiStats = {};
let container = null,
el = null,
channelTabelle = null,
nodes = null,
clients = null,
@ -22,6 +23,33 @@ const guiStats = {};
clientsWifi.innerHTML = store.stats.ClientsWifi;
clientsWifi24.innerHTML = store.stats.ClientsWifi24;
clientsWifi5.innerHTML = store.stats.ClientsWifi5;
domlib.removeChildren(channelTabelle);
let tr = domlib.newAt(channelTabelle, 'tr');
let title = domlib.newAt(tr, 'th');
title.innerHTML = '2.4 Ghz';
title.setAttribute('colspan', '2');
title = domlib.newAt(tr, 'th');
title.innerHTML = '5 Ghz';
title.setAttribute('colspan', '2');
const storeNodes = store.getNodes();
for (let ch = 1; ch <= 33; ch++) {
tr = domlib.newAt(channelTabelle, 'tr');
if (ch < 14) {
domlib.newAt(tr, 'td').innerHTML = ch;
domlib.newAt(tr, 'td').innerHTML = storeNodes.reduce((c, node) => node.wireless.channel24 === ch ? c + 1 : c, 0);
} else {
domlib.newAt(tr, 'td');
domlib.newAt(tr, 'td');
}
const ch5 = 32 + ch * 4;
domlib.newAt(tr, 'td').innerHTML = ch5;
domlib.newAt(tr, 'td').innerHTML = storeNodes.reduce((c, node) => node.wireless.channel5 === ch5 ? c + 1 : c, 0);
}
}
view.bind = function bind (bindEl) {
@ -69,6 +97,11 @@ const guiStats = {};
clientsWifi24 = domlib.newAt(tr, 'td');
clientsWifi5 = domlib.newAt(tr, 'td');
// Channels table
domlib.newAt(el, 'h1').innerHTML = 'Channels';
channelTabelle = domlib.newAt(el, 'table');
channelTabelle.classList.add('stats');
update();
};
})();