Skip to content

Commit

Permalink
Replace buildPresetLabels func
Browse files Browse the repository at this point in the history
Signed-off-by: Maayan Hadasi <[email protected]>
  • Loading branch information
mguetta1 committed Nov 19, 2024
1 parent 179248d commit f628c04
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 21 deletions.
20 changes: 19 additions & 1 deletion client/src/app/components/Icons/IconedStatus.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -164,3 +163,22 @@ export const IconedStatus: React.FC<IIconedStatusProps> = ({
/>
);
};

export const buildPresetLabels = (
t: (key: string) => string
): Record<IconedStatusPreset, { label: string }> => ({
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
});
Original file line number Diff line number Diff line change
@@ -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;
}
Expand Down Expand Up @@ -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<IconedStatusPreset, { label: string }> => ({
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
});

0 comments on commit f628c04

Please sign in to comment.