Fix glances network calculation (#2201)

pull/2194/head
shamoon 1 year ago committed by GitHub
parent 2f4985b977
commit 47db8be7bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -30,7 +30,7 @@ export default function Component({ service }) {
if (interfaceData) { if (interfaceData) {
setDataPoints((prevDataPoints) => { setDataPoints((prevDataPoints) => {
const newDataPoints = [...prevDataPoints, { a: interfaceData.tx, b: interfaceData.rx }]; const newDataPoints = [...prevDataPoints, { a: (interfaceData.rx * 8) / interfaceData.time_since_update, b: (interfaceData.tx * 8) / interfaceData.time_since_update }];
if (newDataPoints.length > pointsLimit) { if (newDataPoints.length > pointsLimit) {
newDataPoints.shift(); newDataPoints.shift();
} }
@ -59,8 +59,8 @@ export default function Component({ service }) {
{ chart && ( { chart && (
<ChartDual <ChartDual
dataPoints={dataPoints} dataPoints={dataPoints}
label={[t("docker.tx"), t("docker.rx")]} label={[t("docker.rx"), t("docker.tx")]}
formatter={(value) => t("common.byterate", { formatter={(value) => t("common.bitrate", {
value, value,
maximumFractionDigits: 0, maximumFractionDigits: 0,
})} })}
@ -76,9 +76,9 @@ export default function Component({ service }) {
<div className="text-xs opacity-75"> <div className="text-xs opacity-75">
{t("common.bitrate", { {t("common.bitrate", {
value: interfaceData.tx, value: (interfaceData.rx * 8) / interfaceData.time_since_update,
maximumFractionDigits: 0, maximumFractionDigits: 0,
})} {t("docker.tx")} })} {t("docker.rx")}
</div> </div>
</Block> </Block>
@ -95,9 +95,9 @@ export default function Component({ service }) {
<Block position="bottom-3 right-3"> <Block position="bottom-3 right-3">
<div className="text-xs opacity-75"> <div className="text-xs opacity-75">
{t("common.bitrate", { {t("common.bitrate", {
value: interfaceData.rx, value: (interfaceData.tx * 8) / interfaceData.time_since_update,
maximumFractionDigits: 0, maximumFractionDigits: 0,
})} {t("docker.rx")} })} {t("docker.tx")}
</div> </div>
</Block> </Block>
</Container> </Container>

Loading…
Cancel
Save