diff --git a/src/components/Assets/AssetList/AssetEntry/AssetEntry.stories.tsx b/src/components/Assets/AssetList/AssetEntry/AssetEntry.stories.tsx index ae15eee79..051dc1dbe 100644 --- a/src/components/Assets/AssetList/AssetEntry/AssetEntry.stories.tsx +++ b/src/components/Assets/AssetList/AssetEntry/AssetEntry.stories.tsx @@ -35,7 +35,7 @@ export const Default: Story = { unit: "ms", raw: 62466300.59999996 }, - + impactScore: 0, impactScores: { ScoreExp25: 0, ScoreExp1000: 0 diff --git a/src/components/Assets/AssetList/AssetEntry/index.tsx b/src/components/Assets/AssetList/AssetEntry/index.tsx index f6046beb9..dae0ba702 100644 --- a/src/components/Assets/AssetList/AssetEntry/index.tsx +++ b/src/components/Assets/AssetList/AssetEntry/index.tsx @@ -1,5 +1,8 @@ +import { useGlobalStore } from "../../../../containers/Main/stores/useGlobalStore"; +import { getFeatureFlagValue } from "../../../../featureFlags"; +import { isNumber } from "../../../../typeGuards/isNumber"; import { isString } from "../../../../typeGuards/isString"; -import { InsightType } from "../../../../types"; +import { FeatureFlag, InsightType } from "../../../../types"; import { formatTimeDistance } from "../../../../utils/formatTimeDistance"; import { getInsightTypeInfo } from "../../../../utils/getInsightTypeInfo"; import { getInsightTypeOrderPriority } from "../../../../utils/getInsightTypeOrderPriority"; @@ -21,6 +24,15 @@ export const AssetEntry = ({ isImpactHidden, sortingCriterion }: AssetEntryProps) => { + const backendInfo = useGlobalStore.use.backendInfo(); + const isNewImpactScoreCalculationEnabled = getFeatureFlagValue( + backendInfo, + FeatureFlag.IS_NEW_IMPACT_SCORE_CALCULATION_ENABLED + ); + const impactScore = isNewImpactScoreCalculationEnabled + ? entry.impactScore + : entry.impactScores?.ScoreExp25; + const handleLinkClick = () => { onAssetLinkClick(entry); }; @@ -151,14 +163,14 @@ export const AssetEntry = ({ - {!isImpactHidden && entry.impactScores && ( + {!isImpactHidden && isNumber(impactScore) && ( Performance impact - +