From 0bbb6ab9475108aa532691086bb8090375f50c4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Jamr=C3=B3z?= Date: Mon, 24 Feb 2025 10:40:31 +0100 Subject: [PATCH] Explore: Make Drilldowns box dismissible (#101193) --- .../features/explore/DrilldownAlertBox.tsx | 42 +++++++++++++++++++ public/app/features/explore/Explore.tsx | 30 +------------ 2 files changed, 44 insertions(+), 28 deletions(-) create mode 100644 public/app/features/explore/DrilldownAlertBox.tsx diff --git a/public/app/features/explore/DrilldownAlertBox.tsx b/public/app/features/explore/DrilldownAlertBox.tsx new file mode 100644 index 00000000000..b6618f3f479 --- /dev/null +++ b/public/app/features/explore/DrilldownAlertBox.tsx @@ -0,0 +1,42 @@ +import { useLocalStorage } from 'react-use'; + +import { Alert, LinkButton, Stack } from '@grafana/ui'; + +import { t, Trans } from '../../core/internationalization'; + +type Props = { + datasourceType: string; +}; + +export function DrilldownAlertBox(props: Props) { + const isDsCompatibleWithDrilldown = ['prometheus', 'loki', 'tempo', 'grafana-pyroscope-datasource'].includes( + props.datasourceType + ); + + const [dismissed, setDismissed] = useLocalStorage('grafana.explore.drilldownsBoxDismissed', false); + + return ( + isDsCompatibleWithDrilldown && + !dismissed && ( + { + setDismissed(true); + }} + > + + + + Looking for the Grafana Explore apps? They are now called the Grafana Drilldown apps and can be found + under Menu > Drilldown + + + + Go to Grafana Drilldown + + + + ) + ); +} diff --git a/public/app/features/explore/Explore.tsx b/public/app/features/explore/Explore.tsx index 4927fc5be4a..7229276849e 100644 --- a/public/app/features/explore/Explore.tsx +++ b/public/app/features/explore/Explore.tsx @@ -23,18 +23,14 @@ import { getDataSourceSrv, reportInteraction } from '@grafana/runtime'; import { DataQuery } from '@grafana/schema'; import { AdHocFilterItem, - Alert, ErrorBoundaryAlert, - LinkButton, PanelContainer, ScrollContainer, - Stack, Themeable2, withTheme2, } from '@grafana/ui'; import { FILTER_FOR_OPERATOR, FILTER_OUT_OPERATOR } from '@grafana/ui/src/components/Table/types'; import { supportedFeatures } from 'app/core/history/richHistoryStorageProvider'; -import { t, Trans } from 'app/core/internationalization'; import { MIXED_DATASOURCE_NAME } from 'app/plugins/datasource/mixed/MixedDataSource'; import { StoreState } from 'app/types'; @@ -45,6 +41,7 @@ import { ContentOutlineContextProvider } from './ContentOutline/ContentOutlineCo import { ContentOutlineItem } from './ContentOutline/ContentOutlineItem'; import { CorrelationHelper } from './CorrelationHelper'; import { CustomContainer } from './CustomContainer'; +import { DrilldownAlertBox } from './DrilldownAlertBox'; import { ExploreToolbar } from './ExploreToolbar'; import { FlameGraphExploreContainer } from './FlameGraph/FlameGraphExploreContainer'; import { GraphContainer } from './Graph/GraphContainer'; @@ -568,9 +565,6 @@ export class Explore extends PureComponent { if (showCorrelationHelper && correlationEditorHelperData !== undefined) { correlationsBox = ; } - const isDsCompatibleWithDrilldown = ['prometheus', 'loki', 'tempo', 'grafana-pyroscope-datasource'].includes( - datasourceInstance?.type || '' - ); return ( @@ -600,27 +594,7 @@ export class Explore extends PureComponent { <> - {isDsCompatibleWithDrilldown && ( - - - - - Looking for the Grafana Explore apps? They are now called the Grafana Drilldown apps - and can be found under Menu > Drilldown - - - - Go to Grafana Drilldown - - - - )} + {correlationsBox}