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 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | 2x 141x 141x 141x 141x | "use client";
import { ComponentActions } from "@/components/ComponentActions";
import { Cpu, HardDrive } from "lucide-react";
import { InfoPopover } from "./InfoPopover";
import { SeverityDot } from "./SeverityDot";
import { KNOWN_BROKEN_ACA_APPS, SEVERITY_STYLES } from "./constants";
import type { TopoComponent } from "./types";
import { useT } from "@/lib/i18n/translate";
export function TopoComponentCard({
comp,
metricsShared = false,
}: {
comp: TopoComponent;
// When true the same underlying ACA app serves every participant. The
// CPU/MEM numbers are real (the container's actual draw) but identical
// across rows; we render a small "shared" suffix so users understand
// why eight rows show the same value.
metricsShared?: boolean;
}) {
const t = useT("admin");
const sev = SEVERITY_STYLES[comp.severity];
const sharedTitle = metricsShared
? t(
"Shared ACA container: the same value applies to every participant. See Layer View for the cluster total.",
)
: undefined;
// The live status decides. The list of apps known to be broken on Azure
// only marks one whose status is not healthy: apps on it while scaled to
// zero kept showing "Broken" once they ran (#774).
const isBroken =
comp.severity === "critical" ||
comp.severity === "warning" ||
(KNOWN_BROKEN_ACA_APPS.has(comp.container) && comp.severity !== "healthy");
return (
<div
className={`border rounded-lg p-3 ${sev.border} ${sev.bg} transition-colors`}
>
<div className="flex items-center justify-between mb-1.5">
<span className="flex items-center gap-1.5 text-xs font-medium text-(--text-primary)">
<SeverityDot severity={comp.severity} />
{comp.name}
<InfoPopover name={comp.name} />
</span>
<span className="text-[10px] text-(--text-secondary) capitalize">
{t(comp.status)}
{metricsShared && (
<span
className="ml-1 italic text-[9px] text-(--text-secondary)"
title={sharedTitle}
>
ยท {t("shared")}
</span>
)}
</span>
</div>
<div className="grid grid-cols-3 gap-1 text-[10px] text-(--text-secondary)">
<span title={sharedTitle}>
<Cpu size={9} className="inline mr-0.5" />
{`${comp.cpu.toFixed(1)}%`}
</span>
<span title={sharedTitle}>
<HardDrive size={9} className="inline mr-0.5" />
{`${comp.memMB < 1 ? "<1" : Math.round(comp.memMB)} MB`}
</span>
<span className="text-right" title={sharedTitle}>
{comp.uptime}
</span>
</div>
<ComponentActions name={comp.container} isBroken={isBroken} />
</div>
);
}
|