diff --git a/src/components/Assets/AssetList/AssetEntry/index.tsx b/src/components/Assets/AssetList/AssetEntry/index.tsx index 952acc8d1..5734d9035 100644 --- a/src/components/Assets/AssetList/AssetEntry/index.tsx +++ b/src/components/Assets/AssetList/AssetEntry/index.tsx @@ -5,15 +5,24 @@ import { getInsightTypeInfo } from "../../../../utils/getInsightTypeInfo"; import { getInsightTypeOrderPriority } from "../../../../utils/getInsightTypeOrderPriority"; import { timeAgo } from "../../../../utils/timeAgo"; import { GlobeIcon } from "../../../common/icons/GlobeIcon"; -import { ImpactScore } from "../../types"; import { getAssetTypeInfo } from "../../utils"; import * as s from "./styles"; import { AssetEntryProps } from "./types"; -const impactScoreLabels = { - [ImpactScore.High]: "High", - [ImpactScore.Medium]: "Medium", - [ImpactScore.Low]: "Low" +const getImpactScoreLabel = (score: number) => { + if (score < 0) { + return "No data"; + } + + if (score < 0.4) { + return "Low"; + } + + if (score < 0.8) { + return "Medium"; + } + + return "High"; }; const getServiceIconColor = (theme: DefaultTheme) => { @@ -126,11 +135,7 @@ export const AssetEntry = (props: AssetEntryProps) => { Performance impact - { - impactScoreLabels[ - props.entry.impactScores.ScoreExp25 as ImpactScore - ] - } + {getImpactScoreLabel(props.entry.impactScores.ScoreExp25)} )} @@ -158,11 +163,7 @@ export const AssetEntry = (props: AssetEntryProps) => { Overall impact - { - impactScoreLabels[ - props.entry.impactScores.ScoreExp1000 as ImpactScore - ] - } + {getImpactScoreLabel(props.entry.impactScores.ScoreExp1000)} )} diff --git a/src/components/Assets/types.ts b/src/components/Assets/types.ts index 03810b713..c435cd834 100644 --- a/src/components/Assets/types.ts +++ b/src/components/Assets/types.ts @@ -4,12 +4,6 @@ import { SpanInstanceInfo } from "../../types"; -export enum ImpactScore { - High = 2, - Medium = 1, - Low = 0 -} - export interface AssetsProps { data?: AssetsData; }