mirror of
https://github.com/DI0IK/homepage-plus.git
synced 2025-07-10 15:28:47 +00:00
Fix: sum throughput data for docker stats (#2334)
This commit is contained in:
parent
c9991bc2a2
commit
7f50f6cfaa
2 changed files with 20 additions and 5 deletions
|
@ -1,7 +1,7 @@
|
|||
import useSWR from "swr";
|
||||
import { useTranslation } from "next-i18next";
|
||||
|
||||
import { calculateCPUPercent, calculateUsedMemory } from "./stats-helpers";
|
||||
import { calculateCPUPercent, calculateUsedMemory, calculateThroughput } from "./stats-helpers";
|
||||
|
||||
import Container from "components/services/widget/container";
|
||||
import Block from "components/services/widget/block";
|
||||
|
@ -41,7 +41,7 @@ export default function Component({ service }) {
|
|||
);
|
||||
}
|
||||
|
||||
const network = statsData.stats.networks?.eth0 || statsData.stats.networks?.network;
|
||||
const { rx_bytes, tx_bytes } = calculateThroughput(statsData.stats);
|
||||
|
||||
return (
|
||||
<Container service={service}>
|
||||
|
@ -49,10 +49,10 @@ export default function Component({ service }) {
|
|||
{statsData.stats.memory_stats.usage && (
|
||||
<Block label="docker.mem" value={t("common.bytes", { value: calculateUsedMemory(statsData.stats) })} />
|
||||
)}
|
||||
{network && (
|
||||
{statsData.stats.networks && (
|
||||
<>
|
||||
<Block label="docker.rx" value={t("common.bytes", { value: network.rx_bytes })} />
|
||||
<Block label="docker.tx" value={t("common.bytes", { value: network.tx_bytes })} />
|
||||
<Block label="docker.rx" value={t("common.bytes", { value: rx_bytes })} />
|
||||
<Block label="docker.tx" value={t("common.bytes", { value: tx_bytes })} />
|
||||
</>
|
||||
)}
|
||||
</Container>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue