2.5.28: added deltas as possible source of tx/rx from associations

This commit is contained in:
Charles
2022-01-18 11:10:13 +01:00
parent 09a10d7838
commit a0ba5aeca4
4 changed files with 34 additions and 10 deletions

View File

@@ -117,12 +117,36 @@ const StatisticsChartList = ({ setOptions, section, setStart, setEnd, time }) =>
for (const log of sortedData) {
// Looping through the interfaces of the log
for (const inter of log.data.interfaces) {
interfaceList[interfaceTypes[inter.name]][0].data.push(
inter.counters?.tx_bytes ? Math.floor(inter.counters.tx_bytes / 1024) : 0,
);
interfaceList[interfaceTypes[inter.name]][1].data.push(
inter.counters?.rx_bytes ? Math.floor(inter.counters.rx_bytes / 1024) : 0,
);
if (inter.counters) {
interfaceList[interfaceTypes[inter.name]][0].data.push(
inter.counters?.tx_bytes ? Math.floor(inter.counters.tx_bytes / 1024) : 0,
);
interfaceList[interfaceTypes[inter.name]][1].data.push(
inter.counters?.rx_bytes ? Math.floor(inter.counters.rx_bytes / 1024) : 0,
);
} else if (
inter.ssids.length > 0 &&
inter.ssids[0].associations.length > 0 &&
inter.ssids[0].associations[0].deltas
) {
let totalTx = 0;
let totalRx = 0;
for (const ssid of inter.ssids) {
for (const assoc of ssid.associations) {
totalTx += assoc.deltas?.tx_bytes ?? 0;
totalRx += assoc.deltas?.rx_bytes ?? 0;
}
}
totalTx = Math.floor(totalTx / 1024);
totalRx = Math.floor(totalRx / 1024);
interfaceList[interfaceTypes[inter.name]][0].data.push(totalTx);
interfaceList[interfaceTypes[inter.name]][1].data.push(totalRx);
} else {
interfaceList[interfaceTypes[inter.name]][0].data.push(0);
interfaceList[interfaceTypes[inter.name]][1].data.push(0);
}
}
}