Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | 1x 140x 186x 186x 140x 140x 140x 140x | "use client";
import { Cpu, HardDrive } from "lucide-react";
import type { PeakEntry, TopoComponent } from "./types";
import { useT } from "@/lib/i18n/translate";
export function ResourceSummary({
components,
label,
metricsShared = false,
}: {
components: TopoComponent[];
peaks?: Map<string, PeakEntry>;
label?: string;
// When true the backend has zeroed per-participant CPU/MEM because
// those containers are shared on this deployment (Azure ACA). Render a
// "shared — see Layer View" marker instead of a meaningless 0.0%.
metricsShared?: boolean;
}) {
const t = useT("admin");
const totalCpu = components.reduce((s, c) => s + c.cpu, 0);
const totalMem = components.reduce((s, c) => s + c.memMB, 0);
const fmtMem = (mb: number) =>
mb > 1024 ? `${(mb / 1024).toFixed(1)} GB` : `${Math.round(mb)} MB`;
Iif (metricsShared) {
return (
<div className="flex items-center gap-2 text-xs text-(--text-secondary) italic">
{label && <span className="mr-1">{label}</span>}
<span
title={t(
"Containers are shared across all participants on this deployment; per-container CPU/MEM is shown in Layer View.",
)}
>
{t("shared infrastructure; see Layer View")}
</span>
</div>
);
}
return (
<div className="flex items-center gap-x-4 text-xs text-(--text-secondary)">
{label && <span className="text-(--text-secondary) mr-1">{label}</span>}
<span className="flex items-center gap-1 tabular-nums">
<Cpu size={10} className="text-(--accent)" />
<span className="text-(--text-primary) font-medium">
CPU {totalCpu.toFixed(1)}%
</span>
</span>
<span className="flex items-center gap-1 tabular-nums">
<HardDrive size={10} className="text-(--accent)" />
<span className="text-(--text-primary) font-medium">
MEM {fmtMem(totalMem)}
</span>
</span>
</div>
);
}
|