diff --git a/client/public/locales/en/translation.json b/client/public/locales/en/translation.json index a26eb9ebb9..37ec58db06 100644 --- a/client/public/locales/en/translation.json +++ b/client/public/locales/en/translation.json @@ -502,7 +502,8 @@ "user": "User", "version": "Version", "workPriority": "Work priority", - "YAMLTemplate": "YAML template" + "YAMLTemplate": "YAML template", + "ok": "OK" }, "titles": { "archetypeDrawer": "Archetype details", diff --git a/client/src/app/components/Icons/IconedStatus.tsx b/client/src/app/components/Icons/IconedStatus.tsx index 984031d995..1539cd4ece 100644 --- a/client/src/app/components/Icons/IconedStatus.tsx +++ b/client/src/app/components/Icons/IconedStatus.tsx @@ -13,6 +13,7 @@ import { UnknownIcon, TopologyIcon, } from "@patternfly/react-icons"; +import { buildPresetLabels } from "@app/pages/applications/components/application-analysis-status"; export type IconedStatusPreset = | "InheritedReviews" @@ -62,11 +63,12 @@ export const IconedStatus: React.FC = ({ tooltipCount = 0, }: IIconedStatusProps) => { const { t } = useTranslation(); + const messages = buildPresetLabels(t); const presets: IconedStatusPresetType = { InProgressInheritedReviews: { icon: , status: "info", - label: t("terms.inProgress"), + label: messages.InProgressInheritedReviews.label, tooltipMessage: t("message.inheritedReviewTooltip", { count: tooltipCount, }), @@ -75,7 +77,7 @@ export const IconedStatus: React.FC = ({ InProgressInheritedAssessments: { icon: , status: "info", - label: t("terms.inProgress"), + label: messages.InProgressInheritedAssessments.label, tooltipMessage: t("message.inheritedAssessmentTooltip", { count: tooltipCount, }), @@ -84,7 +86,7 @@ export const IconedStatus: React.FC = ({ InheritedReviews: { icon: , status: "success", - label: t("terms.completed"), + label: messages.InheritedReviews.label, tooltipMessage: t("message.inheritedReviewTooltip", { count: tooltipCount, }), @@ -93,7 +95,7 @@ export const IconedStatus: React.FC = ({ InheritedAssessments: { icon: , status: "success", - label: t("terms.completed"), + label: messages.InheritedAssessments.label, tooltipMessage: t("message.inheritedAssessmentTooltip", { count: tooltipCount, }), @@ -102,36 +104,36 @@ export const IconedStatus: React.FC = ({ Canceled: { icon: , status: "info", - label: t("terms.canceled"), + label: messages.Canceled.label, }, Completed: { icon: , status: "success", - label: t("terms.completed"), + label: messages.Completed.label, }, CompletedWithErrors: { icon: , status: "warning", - label: t("terms.completedWithErrors"), + label: messages.CompletedWithErrors.label, }, Error: { icon: , status: "danger", - label: t("terms.error"), + label: messages.Error.label, }, Failed: { icon: , status: "danger", - label: t("terms.failed"), + label: messages.Failed.label, }, InProgress: { icon: , status: "info", - label: t("terms.inProgress"), + label: messages.InProgress.label, }, NotStarted: { icon: , - label: t("terms.notStarted"), + label: messages.NotStarted.label, }, Ok: { icon: , @@ -140,7 +142,7 @@ export const IconedStatus: React.FC = ({ Scheduled: { icon: , status: "info", - label: t("terms.scheduled"), + label: messages.Scheduled.label, }, Unknown: { icon: , 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 887345144b..8cea066070 100644 --- a/client/src/app/pages/applications/components/application-analysis-status.tsx +++ b/client/src/app/pages/applications/components/application-analysis-status.tsx @@ -39,12 +39,12 @@ export const mapAnalysisStateToLabel = ( t: (key: string) => string ) => { const presetKey: IconedStatusPreset = getTaskStatus(value); - const presets = buildPresets(t); - const label = presets[presetKey]?.label ?? t("terms.unknown"); + const presets = buildPresetLabels(t); + const label = presets[presetKey]?.label ?? presets.Unknown.label; return label; }; -export const buildPresets = ( +export const buildPresetLabels = ( t: (key: string) => string ): Record => ({ InProgressInheritedReviews: { label: t("terms.inProgress") },