|
|
@ -1,7 +1,7 @@
|
|
|
|
import useSWR from "swr";
|
|
|
|
import useSWR from "swr";
|
|
|
|
import { useTranslation } from "next-i18next";
|
|
|
|
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 Container from "components/services/widget/container";
|
|
|
|
import Block from "components/services/widget/block";
|
|
|
|
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 (
|
|
|
|
return (
|
|
|
|
<Container service={service}>
|
|
|
|
<Container service={service}>
|
|
|
@ -49,10 +49,10 @@ export default function Component({ service }) {
|
|
|
|
{statsData.stats.memory_stats.usage && (
|
|
|
|
{statsData.stats.memory_stats.usage && (
|
|
|
|
<Block label="docker.mem" value={t("common.bytes", { value: calculateUsedMemory(statsData.stats) })} />
|
|
|
|
<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.rx" value={t("common.bytes", { value: rx_bytes })} />
|
|
|
|
<Block label="docker.tx" value={t("common.bytes", { value: network.tx_bytes })} />
|
|
|
|
<Block label="docker.tx" value={t("common.bytes", { value: tx_bytes })} />
|
|
|
|
</>
|
|
|
|
</>
|
|
|
|
)}
|
|
|
|
)}
|
|
|
|
</Container>
|
|
|
|
</Container>
|
|
|
|