From d504bab1469a0e3a2b4988670658078062609ba3 Mon Sep 17 00:00:00 2001 From: Yash Mehrotra Date: Tue, 17 Sep 2024 19:10:09 +0530 Subject: [PATCH 1/2] fix: use topology.health instead of status --- src/components/Topology/TopologyCard/index.tsx | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/components/Topology/TopologyCard/index.tsx b/src/components/Topology/TopologyCard/index.tsx index aa7a654fd..33d4df404 100644 --- a/src/components/Topology/TopologyCard/index.tsx +++ b/src/components/Topology/TopologyCard/index.tsx @@ -17,7 +17,7 @@ import { PropertyDisplay } from "./Property"; import { TopologyConfigAnalysisLine } from "./TopologyConfigAnalysisLine"; import { TopologyDropdownMenu } from "./TopologyDropdownMenu"; -export enum ComponentStatus { +export enum ComponentHealth { unhealthy = "unhealthy", warning = "warning" } @@ -29,9 +29,9 @@ export const CardWidth: Record = { [Size.extra_large]: "554px" }; -export const StatusStyles: Record = { - [ComponentStatus.unhealthy]: "border-red-300", - [ComponentStatus.warning]: "border-orange-300" +export const StatusStyles: Record = { + [ComponentHealth.unhealthy]: "border-red-300", + [ComponentHealth.warning]: "border-orange-300" } as const; interface IProps { @@ -123,7 +123,6 @@ export function TopologyCard({ ? `&refererId=${parentId}` : "" }`; - }; const sortedTopologyComponents = useMemo( () => @@ -159,7 +158,7 @@ export function TopologyCard({ style={{ width: CardWidth[size as Size] || size }} className={clsx( "card relative mb-3 mr-3 rounded-8px border-0 border-t-8 bg-lightest-gray shadow-card", - StatusStyles[topology.status as ComponentStatus] || "border-white", + StatusStyles[topology.health as ComponentHealth] || "border-white", selectionMode ? "cursor-pointer" : "" )} {...selectionModeRootProps} From a1491cbf8523b708b63aceb2929b9c7533cf17e6 Mon Sep 17 00:00:00 2001 From: Yash Mehrotra Date: Tue, 17 Sep 2024 19:18:05 +0530 Subject: [PATCH 2/2] chore: add health attr to topology --- src/api/types/topology.ts | 1 + src/components/Topology/TopologyCard/index.tsx | 1 + 2 files changed, 2 insertions(+) diff --git a/src/api/types/topology.ts b/src/api/types/topology.ts index c0dd9aaa4..867ba1f4d 100644 --- a/src/api/types/topology.ts +++ b/src/api/types/topology.ts @@ -42,6 +42,7 @@ export interface Topology extends Component, CostsData, Agent { labels?: Record; path?: string; text?: string; + health?: string; status?: string; status_reason?: string; hidden?: boolean; diff --git a/src/components/Topology/TopologyCard/index.tsx b/src/components/Topology/TopologyCard/index.tsx index 33d4df404..b2ad1af2c 100644 --- a/src/components/Topology/TopologyCard/index.tsx +++ b/src/components/Topology/TopologyCard/index.tsx @@ -123,6 +123,7 @@ export function TopologyCard({ ? `&refererId=${parentId}` : "" }`; + }; const sortedTopologyComponents = useMemo( () =>