mirror of
https://github.com/Telecominfraproject/wlan-cloud-ucentralgw-ui.git
synced 2025-11-01 03:07:49 +00:00
2.6.14: statistics fix for devices with more than one interface
This commit is contained in:
@@ -124,19 +124,21 @@ const StatisticsChartList = ({ setOptions, section, setStart, setEnd, time }) =>
|
||||
}
|
||||
|
||||
// Looping through all the data
|
||||
let prevTx = 0;
|
||||
let prevRx = 0;
|
||||
const prevTxObj = {};
|
||||
const prevRxObj = {};
|
||||
for (const log of sortedData) {
|
||||
// Looping through the interfaces of the log
|
||||
const version = log.data.version ?? 0;
|
||||
for (const inter of log.data.interfaces) {
|
||||
if (version > 0) {
|
||||
const tx = inter.counters ? Math.floor(inter.counters.tx_bytes) : 0;
|
||||
const rx = inter.counters ? Math.floor(inter.counters.rx_bytes) : 0;
|
||||
interfaceList[interfaceTypes[inter.name]][0].data.push(tx - prevTx);
|
||||
interfaceList[interfaceTypes[inter.name]][1].data.push(rx - prevRx);
|
||||
prevTx = tx;
|
||||
prevRx = rx;
|
||||
const prevTx = prevTxObj[inter.name] !== undefined ? prevTxObj[inter.name] : 0;
|
||||
const prevRx = prevTxObj[inter.name] !== undefined ? prevRxObj[inter.name] : 0;
|
||||
const tx = inter.counters ? inter.counters.tx_bytes : 0;
|
||||
const rx = inter.counters ? inter.counters.rx_bytes : 0;
|
||||
interfaceList[interfaceTypes[inter.name]][0].data.push(Math.max(0, tx - prevTx));
|
||||
interfaceList[interfaceTypes[inter.name]][1].data.push(Math.max(0, rx - prevRx));
|
||||
prevTxObj[inter.name] = tx;
|
||||
prevRxObj[inter.name] = rx;
|
||||
} else {
|
||||
interfaceList[interfaceTypes[inter.name]][0].data.push(
|
||||
inter.counters ? Math.floor(inter.counters.tx_bytes) : 0,
|
||||
|
||||
Reference in New Issue
Block a user