mirror of
https://github.com/karl0ss/homepage.git
synced 2025-05-03 14:03:40 +01:00
Fix glances network calculation (#2201)
This commit is contained in:
parent
2f4985b977
commit
47db8be7bb
@ -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…
x
Reference in New Issue
Block a user