From 1d8151d41df3b146baea46f0cd075cc571f9407e Mon Sep 17 00:00:00 2001 From: DONY BENNY <141351076+Dony-Ben@users.noreply.github.com> Date: Sat, 15 Nov 2025 22:58:12 +0530 Subject: [PATCH] added uid for identification (#620) --- .../InstalledPackages/HealthStatus.tsx | 58 ++++++++++--------- frontend/src/data/types.ts | 7 +-- 2 files changed, 34 insertions(+), 31 deletions(-) diff --git a/frontend/src/components/InstalledPackages/HealthStatus.tsx b/frontend/src/components/InstalledPackages/HealthStatus.tsx index 6bf3f83..79e4ce9 100644 --- a/frontend/src/components/InstalledPackages/HealthStatus.tsx +++ b/frontend/src/components/InstalledPackages/HealthStatus.tsx @@ -1,41 +1,45 @@ import { HD_RESOURCE_CONDITION_TYPE } from "../../API/releases"; import { Tooltip } from "flowbite-react"; import { ReleaseHealthStatus } from "../../data/types"; -import { v4 as uuidv4 } from "uuid"; interface Props { statusData: ReleaseHealthStatus[]; } const HealthStatus = ({ statusData }: Props) => { - const statuses = statusData.map((item) => { - for (let i = 0; i < item.status.conditions.length; i++) { - const cond = item.status.conditions[i]; + const statuses = statusData.flatMap((item) => { + return item.status?.conditions + ?.filter((cond) => cond.type === HD_RESOURCE_CONDITION_TYPE) + .map((cond) => { + const stableKey = + item.metadata?.uid + ? `${item.metadata.uid}-${item.metadata.namespace ?? "default"}` + : `${item.kind}-${item.metadata?.namespace ?? "default"}-${item.metadata?.name}`; - if (cond.type !== HD_RESOURCE_CONDITION_TYPE) { - continue; - } - - return ( - - - - ); - } + return ( + + + + ); + }); }); - + + if (statuses.length === 0) { + return
No health statuses available
; + } + return
{statuses}
; }; -export default HealthStatus; +export default HealthStatus; \ No newline at end of file diff --git a/frontend/src/data/types.ts b/frontend/src/data/types.ts index a43ca00..9ab9070 100644 --- a/frontend/src/data/types.ts +++ b/frontend/src/data/types.ts @@ -53,10 +53,9 @@ export type ReleaseHealthStatus = { metadata: { name: string; namespace: string; - creationTimestamp?: string; - labels: { - [key: string]: string; - }; + uid?: string; // added: Kubernetes UID for stable identification + creationTimestamp: Date; + labels: string[]; }; spec: unknown; status: {