From f628c04c1ebc48a3b486bf2acc771019b4e6b5c0 Mon Sep 17 00:00:00 2001 From: Maayan Hadasi Date: Tue, 19 Nov 2024 20:30:17 +0200 Subject: [PATCH] Replace buildPresetLabels func Signed-off-by: Maayan Hadasi --- .../src/app/components/Icons/IconedStatus.tsx | 20 ++++++++++++++- .../application-analysis-status.tsx | 25 ++++--------------- 2 files changed, 24 insertions(+), 21 deletions(-) diff --git a/client/src/app/components/Icons/IconedStatus.tsx b/client/src/app/components/Icons/IconedStatus.tsx index 1539cd4ec..4c81a283e 100644 --- a/client/src/app/components/Icons/IconedStatus.tsx +++ b/client/src/app/components/Icons/IconedStatus.tsx @@ -13,7 +13,6 @@ import { UnknownIcon, TopologyIcon, } from "@patternfly/react-icons"; -import { buildPresetLabels } from "@app/pages/applications/components/application-analysis-status"; export type IconedStatusPreset = | "InheritedReviews" @@ -164,3 +163,22 @@ export const IconedStatus: React.FC = ({ /> ); }; + +export const buildPresetLabels = ( + t: (key: string) => string +): Record => ({ + InProgressInheritedReviews: { label: t("terms.inProgress") }, + InProgressInheritedAssessments: { label: t("terms.inProgress") }, + InheritedReviews: { label: t("terms.completed") }, + InheritedAssessments: { label: t("terms.completed") }, + Canceled: { label: t("terms.canceled") }, + Completed: { label: t("terms.completed") }, + CompletedWithErrors: { label: t("terms.completedWithErrors") }, + Error: { label: t("terms.error") }, + Failed: { label: t("terms.failed") }, + InProgress: { label: t("terms.inProgress") }, + NotStarted: { label: t("terms.notStarted") }, + Scheduled: { label: t("terms.scheduled") }, + Ok: { label: t("terms.ok") }, // Add Ok with a label + Unknown: { label: t("terms.unknown") }, // Add Unknown with a label +}); diff --git a/client/src/app/pages/applications/components/application-analysis-status.tsx b/client/src/app/pages/applications/components/application-analysis-status.tsx index 8cea06607..a0ea6bd88 100644 --- a/client/src/app/pages/applications/components/application-analysis-status.tsx +++ b/client/src/app/pages/applications/components/application-analysis-status.tsx @@ -1,7 +1,11 @@ import React from "react"; import { TaskState } from "@app/api/models"; -import { IconedStatus, IconedStatusPreset } from "@app/components/Icons"; +import { + buildPresetLabels, + IconedStatus, + IconedStatusPreset, +} from "@app/components/Icons"; export interface ApplicationAnalysisStatusProps { state: TaskState; } @@ -43,22 +47,3 @@ export const mapAnalysisStateToLabel = ( const label = presets[presetKey]?.label ?? presets.Unknown.label; return label; }; - -export const buildPresetLabels = ( - t: (key: string) => string -): Record => ({ - InProgressInheritedReviews: { label: t("terms.inProgress") }, - InProgressInheritedAssessments: { label: t("terms.inProgress") }, - InheritedReviews: { label: t("terms.completed") }, - InheritedAssessments: { label: t("terms.completed") }, - Canceled: { label: t("terms.canceled") }, - Completed: { label: t("terms.completed") }, - CompletedWithErrors: { label: t("terms.completedWithErrors") }, - Error: { label: t("terms.error") }, - Failed: { label: t("terms.failed") }, - InProgress: { label: t("terms.inProgress") }, - NotStarted: { label: t("terms.notStarted") }, - Scheduled: { label: t("terms.scheduled") }, - Ok: { label: t("terms.ok") }, // Add Ok with a label - Unknown: { label: t("terms.unknown") }, // Add Unknown with a label -});