From 4e91d45de0899e5584de4554bf3c1d30d961f935 Mon Sep 17 00:00:00 2001 From: olehp Date: Tue, 5 Mar 2024 17:08:01 +0200 Subject: [PATCH 01/10] add dismissal --- .../Insights/InsightsCatalog/index.tsx | 34 +++++++++++++++++++ .../Insights/InsightsCatalog/styles.ts | 11 ++++++ .../Insights/InsightsPage/index.tsx | 17 +++++++++- src/components/Insights/InsightsPage/types.ts | 1 + src/components/Insights/actions.ts | 4 ++- .../Insights/common/InsightCard/index.tsx | 12 ++++++- .../EndpointBottleneckInsight/index.tsx | 1 + .../EndpointNPlusOneInsight/index.tsx | 1 + .../index.tsx | 1 + .../EndpointSlowdownSourceInsight/index.tsx | 1 + .../ExcessiveAPICallsInsight/index.tsx | 1 + .../HighNumberOfQueriesInsight/index.tsx | 1 + .../insights/ScalingIssueInsight/index.tsx | 1 + .../insights/SessionInViewInsight/index.tsx | 1 + .../insights/SlowEndpointInsight/index.tsx | 1 + .../SpanEndpointBottleneckInsight/index.tsx | 1 + .../insights/SpanNPlusOneInsight/index.tsx | 1 + .../SpanQueryOptimizationInsight/index.tsx | 1 + .../common/insights/TrafficInsight/index.tsx | 1 + src/components/Insights/types.ts | 1 + 20 files changed, 90 insertions(+), 3 deletions(-) diff --git a/src/components/Insights/InsightsCatalog/index.tsx b/src/components/Insights/InsightsCatalog/index.tsx index 2a678d7dc..7fdbcb606 100644 --- a/src/components/Insights/InsightsCatalog/index.tsx +++ b/src/components/Insights/InsightsCatalog/index.tsx @@ -8,11 +8,20 @@ import { Pagination } from "../../common/Pagination"; import { SearchInput } from "../../common/SearchInput"; import { SortingSelector } from "../../common/SortingSelector"; import { SORTING_ORDER, Sorting } from "../../common/SortingSelector/types"; +import { ChevronIcon } from "../../common/icons/16px/ChevronIcon"; +import { Direction } from "../../common/icons/types"; +import { Button } from "../../common/v3/Button"; import { InsightsPage } from "../InsightsPage"; +import { actions } from "../actions"; import * as s from "./styles"; import { InsightsCatalogProps, SORTING_CRITERION } from "./types"; const PAGE_SIZE = 10; +enum ViewMode { + All, + Hidden +} + export const InsightsCatalog = (props: InsightsCatalogProps) => { const { insights, onJiraTicketCreate, defaultQuery, totalCount } = props; const [page, setPage] = useState(0); @@ -32,6 +41,14 @@ export const InsightsCatalog = (props: InsightsCatalogProps) => { const config = useContext(ConfigContext); const previousConfig = usePrevious(config); const previousScope = usePrevious(config.scope?.span); + const [mode, setMode] = useState(ViewMode.All); + + const handleDismissal = (insightId: string) => { + window.sendMessageToDigma({ + action: actions.DISMISS, + payload: insightId + }); + }; useEffect(() => { if (!previousScope || previousScope !== config.scope?.span) { @@ -109,6 +126,22 @@ export const InsightsCatalog = (props: InsightsCatalogProps) => { default={defaultQuery.sorting} /> + {mode === ViewMode.Hidden && ( + +