From 6bec9f977ff04456c204219a8b7fff4ef0a0975a Mon Sep 17 00:00:00 2001 From: Charles Date: Tue, 5 Apr 2022 19:41:09 +0100 Subject: [PATCH] 2.6.13 --- package-lock.json | 4 +- package.json | 2 +- .../StatisticsChartList.js | 47 ++++--------------- 3 files changed, 12 insertions(+), 41 deletions(-) diff --git a/package-lock.json b/package-lock.json index e0ef128..dd4e3b8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "ucentral-client", - "version": "2.6.12", + "version": "2.6.13", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "ucentral-client", - "version": "2.6.12", + "version": "2.6.13", "dependencies": { "@coreui/coreui": "^3.4.0", "@coreui/icons": "^2.0.1", diff --git a/package.json b/package.json index 0ed7657..03b0939 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ucentral-client", - "version": "2.6.12", + "version": "2.6.13", "dependencies": { "@coreui/coreui": "^3.4.0", "@coreui/icons": "^2.0.1", diff --git a/src/components/InterfaceStatistics/StatisticsChartList.js b/src/components/InterfaceStatistics/StatisticsChartList.js index 4bd2a70..1aa8141 100644 --- a/src/components/InterfaceStatistics/StatisticsChartList.js +++ b/src/components/InterfaceStatistics/StatisticsChartList.js @@ -130,48 +130,19 @@ const StatisticsChartList = ({ setOptions, section, setStart, setEnd, time }) => // Looping through the interfaces of the log const version = log.data.version ?? 0; for (const inter of log.data.interfaces) { - if (inter.ssids?.length > 0) { - let totalTx = 0; - let totalRx = 0; - for (const ssid of inter.ssids) { - if (ssid.associations) { - for (const assoc of ssid.associations) { - if (version === 0) { - if (assoc.deltas) { - totalTx += Math.max(0, assoc.deltas?.tx_bytes ?? 0); - totalRx += Math.max(0, assoc.deltas?.rx_bytes ?? 0); - } else { - totalTx += Math.max(0, assoc.tx_bytes ?? 0); - totalRx += Math.max(0, assoc.rx_bytes ?? 0); - } - } else { - totalTx += Math.max(0, assoc.tx_bytes ?? 0); - totalRx += Math.max(0, assoc.rx_bytes ?? 0); - } - } - } - } - if (version > 0) { - const tx = Math.floor(totalTx / 1024); - const rx = Math.floor(totalRx / 1024); - interfaceList[interfaceTypes[inter.name]][0].data.push(Math.max(0, tx - prevTx)); - interfaceList[interfaceTypes[inter.name]][1].data.push(Math.max(0, rx - prevRx)); - prevTx = tx; - prevRx = rx; - } else { - interfaceList[interfaceTypes[inter.name]][0].data.push( - Math.max(0, Math.floor(totalTx / 1024)), - ); - interfaceList[interfaceTypes[inter.name]][1].data.push( - Math.max(0, Math.floor(totalRx / 1024)), - ); - } + 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; } else { interfaceList[interfaceTypes[inter.name]][0].data.push( - inter.counters ? Math.max(0, Math.floor(inter.counters.tx_bytes)) : 0, + inter.counters ? Math.floor(inter.counters.tx_bytes) : 0, ); interfaceList[interfaceTypes[inter.name]][1].data.push( - inter.counters ? Math.max(0, Math.floor(inter.counters.rx_bytes)) : 0, + inter.counters ? Math.floor(inter.counters.rx_bytes) : 0, ); } }