From 643290eba5132e7f6376b46077e5fd052703228d Mon Sep 17 00:00:00 2001 From: Kyrylo Shmidt Date: Thu, 3 Aug 2023 19:17:12 +0200 Subject: [PATCH 1/2] Filter visible insights Fix handling of empty list of assets --- src/components/Assets/AssetList/AssetEntry/index.tsx | 12 +++++++++++- src/components/Assets/AssetList/index.tsx | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/components/Assets/AssetList/AssetEntry/index.tsx b/src/components/Assets/AssetList/AssetEntry/index.tsx index b71f766d8..8f31aa8ed 100644 --- a/src/components/Assets/AssetList/AssetEntry/index.tsx +++ b/src/components/Assets/AssetList/AssetEntry/index.tsx @@ -1,4 +1,5 @@ import { DefaultTheme, useTheme } from "styled-components"; +import { InsightType } from "../../../../types"; import { getInsightImportanceColor } from "../../../../utils/getInsightImportanceColor"; import { getInsightTypeInfo } from "../../../../utils/getInsightTypeInfo"; import { getInsightTypeOrderPriority } from "../../../../utils/getInsightTypeOrderPriority"; @@ -40,7 +41,16 @@ export const AssetEntry = (props: AssetEntryProps) => { const lastSeenDateTime = props.entry.lastSpanInstanceInfo.startTime; - const sortedInsights = [...props.entry.insights].sort( + // Do not show not unimplemented insights + const filteredInsights = props.entry.insights.filter( + (x) => + ![ + InsightType.SpanScalingWell, + InsightType.SpanScalingInsufficientData + ].includes(x.type as InsightType) + ); + + const sortedInsights = [...filteredInsights].sort( (a, b) => a.importance - b.importance || getInsightTypeOrderPriority(a.type) - getInsightTypeOrderPriority(b.type) diff --git a/src/components/Assets/AssetList/index.tsx b/src/components/Assets/AssetList/index.tsx index 8f4d5b8a7..801d990b6 100644 --- a/src/components/Assets/AssetList/index.tsx +++ b/src/components/Assets/AssetList/index.tsx @@ -217,7 +217,7 @@ const getAvailableSortingCriterions = ( SORTING_CRITERION.NAME ]; - if (assets[0].impactScores) { + if (assets.length > 0 && assets[0].impactScores) { criterions.push( SORTING_CRITERION.PERFORMANCE_IMPACT, SORTING_CRITERION.OVERALL_IMPACT From 93d7286489adf316d5b1b58a2d17d8dc6e6b3b14 Mon Sep 17 00:00:00 2001 From: Kyrylo Shmidt Date: Thu, 3 Aug 2023 19:18:52 +0200 Subject: [PATCH 2/2] Fix typo --- src/components/Assets/AssetList/AssetEntry/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Assets/AssetList/AssetEntry/index.tsx b/src/components/Assets/AssetList/AssetEntry/index.tsx index 8f31aa8ed..7f778ac99 100644 --- a/src/components/Assets/AssetList/AssetEntry/index.tsx +++ b/src/components/Assets/AssetList/AssetEntry/index.tsx @@ -41,7 +41,7 @@ export const AssetEntry = (props: AssetEntryProps) => { const lastSeenDateTime = props.entry.lastSpanInstanceInfo.startTime; - // Do not show not unimplemented insights + // Do not show unimplemented insights const filteredInsights = props.entry.insights.filter( (x) => ![