mirror of
https://github.com/gethomepage/homepage.git
synced 2026-04-05 01:31:22 -07:00
Fix: sum throughput data for docker stats (#2334)
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user