diff --git a/client/public/locales/en/translation.json b/client/public/locales/en/translation.json index 284b900851..51f852fea0 100644 --- a/client/public/locales/en/translation.json +++ b/client/public/locales/en/translation.json @@ -246,7 +246,8 @@ "high": "High", "low": "Low", "medium": "Medium", - "unknown": "Unknown" + "unknown": "Unknown", + "unassessed": "Unassessed" }, "sidebar": { "administrator": "Administration", diff --git a/client/src/app/Constants.ts b/client/src/app/Constants.ts index 80a622ee9f..3a1171c7c6 100644 --- a/client/src/app/Constants.ts +++ b/client/src/app/Constants.ts @@ -118,6 +118,12 @@ export const RISK_LIST: RiskListType = { labelColor: "grey", sortFactor: 4, }, + unassessed: { + i18Key: "risks.unassessed", + hexColor: black.value, + labelColor: "grey", + sortFactor: 5, + }, }; // Proposed action diff --git a/client/src/app/api/models.ts b/client/src/app/api/models.ts index 98ffa8fdfc..e3047d8abd 100644 --- a/client/src/app/api/models.ts +++ b/client/src/app/api/models.ts @@ -781,7 +781,7 @@ export interface Thresholds { } export type AssessmentStatus = "empty" | "started" | "complete"; -export type Risk = "green" | "yellow" | "red" | "unknown"; +export type Risk = "green" | "yellow" | "red" | "unknown" | "unassessed"; export interface InitialAssessment { application?: Ref; diff --git a/client/src/app/components/RiskLabel.tsx b/client/src/app/components/RiskLabel.tsx index a12330e1ed..220d5a4f3f 100644 --- a/client/src/app/components/RiskLabel.tsx +++ b/client/src/app/components/RiskLabel.tsx @@ -5,9 +5,10 @@ import { Label } from "@patternfly/react-core"; import { RISK_LIST } from "@app/Constants"; import { Risk } from "@app/api/models"; +import { normalizeRisk } from "@app/utils/type-utils"; export interface IRiskLabelProps { - risk: Risk; + risk?: Risk | string; } export const RiskLabel: React.FC = ({ @@ -15,7 +16,8 @@ export const RiskLabel: React.FC = ({ }: IRiskLabelProps) => { const { t } = useTranslation(); - const data = RISK_LIST[risk]; + const asRisk = normalizeRisk(risk); + const data = !asRisk ? undefined : RISK_LIST[asRisk]; return (