From 364bd930dce739d36b67b8ef6402ecf86e569596 Mon Sep 17 00:00:00 2001 From: Nathan Marrs Date: Tue, 23 May 2023 16:53:36 -0700 Subject: [PATCH] chore: Move data hover out of Geomap panel code (refactor part 1 of 2) (#68863) --- .github/CODEOWNERS | 3 ++- .../features/search/page/components/ExplainScorePopup.tsx | 2 +- .../visualization/data-hover}/ComplexDataHoverView.tsx | 3 +-- .../visualization/data-hover}/DataHoverRow.tsx | 0 .../visualization/data-hover}/DataHoverRows.tsx | 5 ++--- .../visualization/data-hover}/DataHoverTabs.tsx | 3 +-- .../visualization/data-hover}/DataHoverView.test.tsx | 0 .../visualization/data-hover}/DataHoverView.tsx | 3 +-- public/app/plugins/panel/barchart/BarChartPanel.tsx | 3 +-- public/app/plugins/panel/debug/CursorView.tsx | 3 +-- public/app/plugins/panel/geomap/GeomapTooltip.tsx | 2 +- public/app/plugins/panel/heatmap/HeatmapHoverView.tsx | 3 +-- 12 files changed, 12 insertions(+), 18 deletions(-) rename public/app/{plugins/panel/geomap/components => features/visualization/data-hover}/ComplexDataHoverView.tsx (92%) rename public/app/{plugins/panel/geomap/components => features/visualization/data-hover}/DataHoverRow.tsx (100%) rename public/app/{plugins/panel/geomap/components => features/visualization/data-hover}/DataHoverRows.tsx (95%) rename public/app/{plugins/panel/geomap/components => features/visualization/data-hover}/DataHoverTabs.tsx (91%) rename public/app/{plugins/panel/geomap/components => features/visualization/data-hover}/DataHoverView.test.tsx (100%) rename public/app/{plugins/panel/geomap/components => features/visualization/data-hover}/DataHoverView.tsx (98%) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 98fb6d6cbcb..fb130e0f0c0 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -358,6 +358,8 @@ lerna.json @grafana/frontend-ops /public/app/features/annotations/ @grafana/grafana-frontend-platform /public/app/features/api-keys/ @grafana/grafana-frontend-platform /public/app/features/canvas/ @grafana/dataviz-squad +/public/app/features/geo/ @grafana/dataviz-squad +/public/app/features/visualization/data-hover/ @grafana/dataviz-squad /public/app/features/commandPalette/ @grafana/grafana-frontend-platform /public/app/features/connections/ @grafana/plugins-platform-frontend /public/app/features/correlations/ @grafana/explore-squad @@ -370,7 +372,6 @@ lerna.json @grafana/frontend-ops /public/app/features/folders/ @grafana/grafana-frontend-platform /public/app/features/inspector/ @grafana/dashboards-squad /public/app/features/invites/ @grafana/grafana-frontend-platform -/public/app/features/geo/ @grafana/dataviz-squad /public/app/features/library-panels/ @grafana/grafana-frontend-platform /public/app/features/logs/ @grafana/observability-logs /public/app/features/live/ @grafana/grafana-app-platform-squad diff --git a/public/app/features/search/page/components/ExplainScorePopup.tsx b/public/app/features/search/page/components/ExplainScorePopup.tsx index 387118a181b..3f1b754dbdb 100644 --- a/public/app/features/search/page/components/ExplainScorePopup.tsx +++ b/public/app/features/search/page/components/ExplainScorePopup.tsx @@ -2,7 +2,7 @@ import React, { useState } from 'react'; import { DataFrame } from '@grafana/data'; import { CodeEditor, Modal, ModalTabsHeader, TabContent } from '@grafana/ui'; -import { DataHoverView } from 'app/plugins/panel/geomap/components/DataHoverView'; +import { DataHoverView } from 'app/features/visualization/data-hover/DataHoverView'; export interface Props { name: string; diff --git a/public/app/plugins/panel/geomap/components/ComplexDataHoverView.tsx b/public/app/features/visualization/data-hover/ComplexDataHoverView.tsx similarity index 92% rename from public/app/plugins/panel/geomap/components/ComplexDataHoverView.tsx rename to public/app/features/visualization/data-hover/ComplexDataHoverView.tsx index 767f3f29b8f..f0b505a7f9f 100644 --- a/public/app/plugins/panel/geomap/components/ComplexDataHoverView.tsx +++ b/public/app/features/visualization/data-hover/ComplexDataHoverView.tsx @@ -1,8 +1,7 @@ import React, { useState } from 'react'; import { CloseButton } from 'app/core/components/CloseButton/CloseButton'; - -import { GeomapLayerHover } from '../event'; +import { GeomapLayerHover } from 'app/plugins/panel/geomap/event'; import { DataHoverRows } from './DataHoverRows'; import { DataHoverTabs } from './DataHoverTabs'; diff --git a/public/app/plugins/panel/geomap/components/DataHoverRow.tsx b/public/app/features/visualization/data-hover/DataHoverRow.tsx similarity index 100% rename from public/app/plugins/panel/geomap/components/DataHoverRow.tsx rename to public/app/features/visualization/data-hover/DataHoverRow.tsx diff --git a/public/app/plugins/panel/geomap/components/DataHoverRows.tsx b/public/app/features/visualization/data-hover/DataHoverRows.tsx similarity index 95% rename from public/app/plugins/panel/geomap/components/DataHoverRows.tsx rename to public/app/features/visualization/data-hover/DataHoverRows.tsx index 7bc10cfd4fa..cbd9e156aea 100644 --- a/public/app/plugins/panel/geomap/components/DataHoverRows.tsx +++ b/public/app/features/visualization/data-hover/DataHoverRows.tsx @@ -5,9 +5,8 @@ import React, { useState } from 'react'; import { DataFrame, FieldType, getFieldDisplayName, GrafanaTheme2 } from '@grafana/data'; import { Collapse, TabContent, useStyles2 } from '@grafana/ui'; - -import { GeomapLayerHover } from '../event'; -import { renderValue } from '../utils/uiUtils'; +import { GeomapLayerHover } from 'app/plugins/panel/geomap/event'; +import { renderValue } from 'app/plugins/panel/geomap/utils/uiUtils'; import { DataHoverRow } from './DataHoverRow'; diff --git a/public/app/plugins/panel/geomap/components/DataHoverTabs.tsx b/public/app/features/visualization/data-hover/DataHoverTabs.tsx similarity index 91% rename from public/app/plugins/panel/geomap/components/DataHoverTabs.tsx rename to public/app/features/visualization/data-hover/DataHoverTabs.tsx index 4014d0308f8..30f6d111a77 100644 --- a/public/app/plugins/panel/geomap/components/DataHoverTabs.tsx +++ b/public/app/features/visualization/data-hover/DataHoverTabs.tsx @@ -1,8 +1,7 @@ import React, { Dispatch, SetStateAction } from 'react'; import { Tab, TabsBar } from '@grafana/ui'; - -import { GeomapLayerHover } from '../event'; +import { GeomapLayerHover } from 'app/plugins/panel/geomap/event'; type Props = { layers?: GeomapLayerHover[]; diff --git a/public/app/plugins/panel/geomap/components/DataHoverView.test.tsx b/public/app/features/visualization/data-hover/DataHoverView.test.tsx similarity index 100% rename from public/app/plugins/panel/geomap/components/DataHoverView.test.tsx rename to public/app/features/visualization/data-hover/DataHoverView.test.tsx diff --git a/public/app/plugins/panel/geomap/components/DataHoverView.tsx b/public/app/features/visualization/data-hover/DataHoverView.tsx similarity index 98% rename from public/app/plugins/panel/geomap/components/DataHoverView.tsx rename to public/app/features/visualization/data-hover/DataHoverView.tsx index 698dd41a378..5683bddfb17 100644 --- a/public/app/plugins/panel/geomap/components/DataHoverView.tsx +++ b/public/app/features/visualization/data-hover/DataHoverView.tsx @@ -12,8 +12,7 @@ import { } from '@grafana/data'; import { SortOrder, TooltipDisplayMode } from '@grafana/schema'; import { LinkButton, useStyles2, VerticalGroup } from '@grafana/ui'; - -import { renderValue } from '../utils/uiUtils'; +import { renderValue } from 'app/plugins/panel/geomap/utils/uiUtils'; export interface Props { data?: DataFrame; // source data diff --git a/public/app/plugins/panel/barchart/BarChartPanel.tsx b/public/app/plugins/panel/barchart/BarChartPanel.tsx index a4137b1b3dd..c3ea72f4b21 100644 --- a/public/app/plugins/panel/barchart/BarChartPanel.tsx +++ b/public/app/plugins/panel/barchart/BarChartPanel.tsx @@ -35,8 +35,7 @@ import { PropDiffFn } from '@grafana/ui/src/components/GraphNG/GraphNG'; import { HoverEvent, addTooltipSupport } from '@grafana/ui/src/components/uPlot/config/addTooltipSupport'; import { CloseButton } from 'app/core/components/CloseButton/CloseButton'; import { getFieldLegendItem } from 'app/core/components/TimelineChart/utils'; - -import { DataHoverView } from '../geomap/components/DataHoverView'; +import { DataHoverView } from 'app/features/visualization/data-hover/DataHoverView'; import { Options } from './panelcfg.gen'; import { prepareBarChartDisplayValues, preparePlotConfigBuilder } from './utils'; diff --git a/public/app/plugins/panel/debug/CursorView.tsx b/public/app/plugins/panel/debug/CursorView.tsx index 124ea8482e2..3b8dac26732 100644 --- a/public/app/plugins/panel/debug/CursorView.tsx +++ b/public/app/plugins/panel/debug/CursorView.tsx @@ -10,8 +10,7 @@ import { BusEventBase, } from '@grafana/data'; import { CustomScrollbar } from '@grafana/ui'; - -import { DataHoverView } from '../geomap/components/DataHoverView'; +import { DataHoverView } from 'app/features/visualization/data-hover/DataHoverView'; interface Props { eventBus: EventBus; diff --git a/public/app/plugins/panel/geomap/GeomapTooltip.tsx b/public/app/plugins/panel/geomap/GeomapTooltip.tsx index 4393fd970c2..a3ee8782b95 100644 --- a/public/app/plugins/panel/geomap/GeomapTooltip.tsx +++ b/public/app/plugins/panel/geomap/GeomapTooltip.tsx @@ -3,8 +3,8 @@ import { useOverlay } from '@react-aria/overlays'; import React, { createRef } from 'react'; import { Portal, VizTooltipContainer } from '@grafana/ui'; +import { ComplexDataHoverView } from 'app/features/visualization/data-hover/ComplexDataHoverView'; -import { ComplexDataHoverView } from './components/ComplexDataHoverView'; import { GeomapHoverPayload } from './event'; interface Props { diff --git a/public/app/plugins/panel/heatmap/HeatmapHoverView.tsx b/public/app/plugins/panel/heatmap/HeatmapHoverView.tsx index e0862331827..40fe2fe4897 100644 --- a/public/app/plugins/panel/heatmap/HeatmapHoverView.tsx +++ b/public/app/plugins/panel/heatmap/HeatmapHoverView.tsx @@ -13,8 +13,7 @@ import { HeatmapCellLayout } from '@grafana/schema'; import { LinkButton, VerticalGroup } from '@grafana/ui'; import { getDashboardSrv } from 'app/features/dashboard/services/DashboardSrv'; import { isHeatmapCellsDense, readHeatmapRowsCustomMeta } from 'app/features/transformers/calculateHeatmap/heatmap'; - -import { DataHoverView } from '../geomap/components/DataHoverView'; +import { DataHoverView } from 'app/features/visualization/data-hover/DataHoverView'; import { HeatmapData } from './fields'; import { HeatmapHoverEvent } from './utils';