diff --git a/src/components/Insights/InsightsCatalog/index.tsx b/src/components/Insights/InsightsCatalog/index.tsx index c54fcd780..0b73e4982 100644 --- a/src/components/Insights/InsightsCatalog/index.tsx +++ b/src/components/Insights/InsightsCatalog/index.tsx @@ -52,9 +52,9 @@ export const InsightsCatalog = (props: InsightsCatalogProps) => { const previousMode = usePrevious(mode); const theme = useTheme(); - const isViewModeButtonVisible = getFeatureFlagValue( - config, - FeatureFlag.IS_INSIGHT_DISMISSAL_ENABLED + const isViewModeButtonVisible = Boolean( + getFeatureFlagValue(config, FeatureFlag.IS_INSIGHT_DISMISSAL_ENABLED) && + props.dismissedCount ); const refreshData = useCallback( diff --git a/src/components/Insights/InsightsCatalog/types.ts b/src/components/Insights/InsightsCatalog/types.ts index 383f2f62d..87ba0cbfe 100644 --- a/src/components/Insights/InsightsCatalog/types.ts +++ b/src/components/Insights/InsightsCatalog/types.ts @@ -3,6 +3,7 @@ import { GenericCodeObjectInsight, InsightsQuery } from "../types"; export interface InsightsCatalogProps { insights: GenericCodeObjectInsight[]; totalCount: number; + dismissedCount?: number; onJiraTicketCreate: ( insight: GenericCodeObjectInsight, spanCodeObjectId?: string diff --git a/src/components/Insights/common/InsightCard/index.tsx b/src/components/Insights/common/InsightCard/index.tsx index f0bb65233..b3aef582d 100644 --- a/src/components/Insights/common/InsightCard/index.tsx +++ b/src/components/Insights/common/InsightCard/index.tsx @@ -12,7 +12,7 @@ import { BaseButtonProps } from "../../../common/v3/Button/types"; import { JiraButton } from "../../../common/v3/JiraButton"; import { Link } from "../../../common/v3/Link"; import { Tooltip } from "../../../common/v3/Tooltip"; -import { isSpanInsight } from "../../typeGuards"; +import { isEndpointInsight, isSpanInsight } from "../../typeGuards"; import { InsightHeader } from "./InsightHeader"; import * as s from "./styles"; import { InsightCardProps } from "./types"; @@ -66,7 +66,10 @@ export const InsightCard = (props: InsightCardProps) => { }; const handleSpanLinkClick = () => { - if (isSpanInsight(props.insight) && props.insight.spanInfo) { + if ( + (isSpanInsight(props.insight) || isEndpointInsight(props.insight)) && + props.insight.spanInfo + ) { props.onGoToSpan(props.insight.spanInfo.spanCodeObjectId); } }; @@ -264,7 +267,9 @@ export const InsightCard = (props: InsightCardProps) => { header={ { }} onRefresh={refresh} defaultQuery={DEFAULT_QUERY} + dismissedCount={data.dismissedCount} /> ); }; diff --git a/src/components/Insights/types.ts b/src/components/Insights/types.ts index f93304d4a..244ef84a2 100644 --- a/src/components/Insights/types.ts +++ b/src/components/Insights/types.ts @@ -72,6 +72,7 @@ export interface InsightsData { totalCount: number; insightsStatus: InsightsStatus; // ?? default viewMode: ViewMode; // Insights + dismissedCount?: number; // methods: Method[]; // empty // assetId?: string; // remove