From 0d1d45ee585e7db0ee503be996d9aae4a24dbca3 Mon Sep 17 00:00:00 2001 From: Ryan McKinley Date: Thu, 2 Nov 2023 09:24:30 -0700 Subject: [PATCH] Graph: Move graph component to graveyard folder (#77579) --- .betterer.results | 12 ++++++------ .github/CODEOWNERS | 2 +- packages/grafana-ui/src/components/index.ts | 16 +++++++++++----- .../Graph/Graph.test.tsx | 2 +- .../{components => graveyard}/Graph/Graph.tsx | 4 ++-- .../Graph/GraphContextMenu.tsx | 12 ++++++------ .../Graph/GraphSeriesToggler.tsx | 0 .../Graph/GraphTooltip/GraphTooltip.tsx | 2 +- .../GraphTooltip/MultiModeGraphTooltip.test.tsx | 2 +- .../Graph/GraphTooltip/MultiModeGraphTooltip.tsx | 4 ++-- .../GraphTooltip/SingleModeGraphTooltip.tsx | 2 +- .../Graph/GraphTooltip/types.ts | 2 +- .../Graph/GraphWithLegend.internal.story.tsx | 0 .../Graph/GraphWithLegend.tsx | 6 +++--- .../src/{components => graveyard}/Graph/types.ts | 0 .../Graph/utils.test.ts | 0 .../src/{components => graveyard}/Graph/utils.ts | 0 17 files changed, 36 insertions(+), 30 deletions(-) rename packages/grafana-ui/src/{components => graveyard}/Graph/Graph.test.tsx (98%) rename packages/grafana-ui/src/{components => graveyard}/Graph/Graph.tsx (98%) rename packages/grafana-ui/src/{components => graveyard}/Graph/GraphContextMenu.tsx (88%) rename packages/grafana-ui/src/{components => graveyard}/Graph/GraphSeriesToggler.tsx (100%) rename packages/grafana-ui/src/{components => graveyard}/Graph/GraphTooltip/GraphTooltip.tsx (93%) rename packages/grafana-ui/src/{components => graveyard}/Graph/GraphTooltip/MultiModeGraphTooltip.test.tsx (98%) rename packages/grafana-ui/src/{components => graveyard}/Graph/GraphTooltip/MultiModeGraphTooltip.tsx (91%) rename packages/grafana-ui/src/{components => graveyard}/Graph/GraphTooltip/SingleModeGraphTooltip.tsx (95%) rename packages/grafana-ui/src/{components => graveyard}/Graph/GraphTooltip/types.ts (85%) rename packages/grafana-ui/src/{components => graveyard}/Graph/GraphWithLegend.internal.story.tsx (100%) rename packages/grafana-ui/src/{components => graveyard}/Graph/GraphWithLegend.tsx (94%) rename packages/grafana-ui/src/{components => graveyard}/Graph/types.ts (100%) rename packages/grafana-ui/src/{components => graveyard}/Graph/utils.test.ts (100%) rename packages/grafana-ui/src/{components => graveyard}/Graph/utils.ts (100%) diff --git a/.betterer.results b/.betterer.results index 27b2fd82df3..bb7e73b4731 100644 --- a/.betterer.results +++ b/.betterer.results @@ -807,12 +807,6 @@ exports[`better eslint`] = { [0, 0, 0, "Unexpected any. Specify a different type.", "0"], [0, 0, 0, "Unexpected any. Specify a different type.", "1"] ], - "packages/grafana-ui/src/components/Graph/GraphContextMenu.tsx:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"] - ], - "packages/grafana-ui/src/components/Graph/utils.ts:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"] - ], "packages/grafana-ui/src/components/InfoBox/InfoBox.tsx:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"] ], @@ -1010,6 +1004,12 @@ exports[`better eslint`] = { [0, 0, 0, "Do not use any type assertions.", "0"], [0, 0, 0, "Do not use any type assertions.", "1"] ], + "packages/grafana-ui/src/graveyard/Graph/GraphContextMenu.tsx:5381": [ + [0, 0, 0, "Unexpected any. Specify a different type.", "0"] + ], + "packages/grafana-ui/src/graveyard/Graph/utils.ts:5381": [ + [0, 0, 0, "Unexpected any. Specify a different type.", "0"] + ], "packages/grafana-ui/src/graveyard/GraphNG/GraphNG.tsx:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], [0, 0, 0, "Unexpected any. Specify a different type.", "1"], diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index fbbf20a345b..125af1b3853 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -312,7 +312,6 @@ /packages/grafana-ui/src/components/Table/ @grafana/grafana-bi-squad /packages/grafana-ui/src/components/Gauge/ @grafana/dataviz-squad /packages/grafana-ui/src/components/BarGauge/ @grafana/dataviz-squad -/packages/grafana-ui/src/components/Graph/ @grafana/dataviz-squad /packages/grafana-ui/src/components/uPlot/ @grafana/dataviz-squad /packages/grafana-ui/src/components/DataLinks/ @grafana/dataviz-squad /packages/grafana-ui/src/components/ValuePicker/ @grafana/dataviz-squad @@ -320,6 +319,7 @@ /packages/grafana-ui/src/components/VizLegend/ @grafana/dataviz-squad /packages/grafana-ui/src/components/VizRepeater/ @grafana/dataviz-squad /packages/grafana-ui/src/components/VizTooltip/ @grafana/dataviz-squad +/packages/grafana-ui/src/graveyard/Graph/ @grafana/dataviz-squad /packages/grafana-ui/src/graveyard/GraphNG/ @grafana/dataviz-squad /packages/grafana-ui/src/graveyard/TimeSeries/ @grafana/dataviz-squad /packages/grafana-ui/src/utils/storybook/ @grafana/plugins-platform-frontend diff --git a/packages/grafana-ui/src/components/index.ts b/packages/grafana-ui/src/components/index.ts index d5abea2d4c1..72c8be994c5 100644 --- a/packages/grafana-ui/src/components/index.ts +++ b/packages/grafana-ui/src/components/index.ts @@ -117,9 +117,6 @@ export { export { Sparkline } from './Sparkline/Sparkline'; export { Gauge } from './Gauge/Gauge'; -export { Graph } from './Graph/Graph'; -export { GraphWithLegend } from './Graph/GraphWithLegend'; -export { GraphContextMenu, GraphContextMenuHeader } from './Graph/GraphContextMenu'; export { BarGauge } from './BarGauge/BarGauge'; export { VizTooltip, @@ -130,7 +127,6 @@ export { type SeriesTableRowProps, } from './VizTooltip'; export { VizRepeater, type VizRepeaterRenderValueProps } from './VizRepeater/VizRepeater'; -export { graphTimeFormat, graphTickFormatter } from './Graph/utils'; export { PanelChrome, type PanelChromeProps, @@ -154,7 +150,7 @@ export { VizLegend } from './VizLegend/VizLegend'; export { VizLegendListItem } from './VizLegend/VizLegendListItem'; export { Alert, type AlertVariant } from './Alert/Alert'; -export { GraphSeriesToggler, type GraphSeriesTogglerAPI } from './Graph/GraphSeriesToggler'; +export { GraphSeriesToggler, type GraphSeriesTogglerAPI } from '../graveyard/Graph/GraphSeriesToggler'; export { Collapse, ControlledCollapse } from './Collapse/Collapse'; export { CollapsableSection } from './Collapse/CollapsableSection'; export { DataLinkButton } from './DataLinks/DataLinkButton'; @@ -296,6 +292,16 @@ export * from './PanelChrome/types'; export { Label as BrowserLabel } from './BrowserLabel/Label'; export { PanelContainer } from './PanelContainer/PanelContainer'; +// ----------------------------------------------------- +// Graveyard: exported, but no longer used internally +// These will be removed in the future +// ----------------------------------------------------- + +export { Graph } from '../graveyard/Graph/Graph'; +export { GraphWithLegend } from '../graveyard/Graph/GraphWithLegend'; +export { GraphContextMenu, GraphContextMenuHeader } from '../graveyard/Graph/GraphContextMenu'; +export { graphTimeFormat, graphTickFormatter } from '../graveyard/Graph/utils'; + export { GraphNG, type GraphNGProps } from '../graveyard/GraphNG/GraphNG'; export { TimeSeries } from '../graveyard/TimeSeries/TimeSeries'; export { useGraphNGContext } from '../graveyard/GraphNG/hooks'; diff --git a/packages/grafana-ui/src/components/Graph/Graph.test.tsx b/packages/grafana-ui/src/graveyard/Graph/Graph.test.tsx similarity index 98% rename from packages/grafana-ui/src/components/Graph/Graph.test.tsx rename to packages/grafana-ui/src/graveyard/Graph/Graph.test.tsx index fc616c31cd8..847d6e883c0 100644 --- a/packages/grafana-ui/src/components/Graph/Graph.test.tsx +++ b/packages/grafana-ui/src/graveyard/Graph/Graph.test.tsx @@ -5,7 +5,7 @@ import React from 'react'; import { GraphSeriesXY, FieldType, dateTime, FieldColorModeId, DisplayProcessor } from '@grafana/data'; import { TooltipDisplayMode } from '@grafana/schema'; -import { VizTooltip } from '../VizTooltip'; +import { VizTooltip } from '../../components/VizTooltip'; import Graph from './Graph'; diff --git a/packages/grafana-ui/src/components/Graph/Graph.tsx b/packages/grafana-ui/src/graveyard/Graph/Graph.tsx similarity index 98% rename from packages/grafana-ui/src/components/Graph/Graph.tsx rename to packages/grafana-ui/src/graveyard/Graph/Graph.tsx index 9c61e8691fd..624d19e29c6 100644 --- a/packages/grafana-ui/src/components/Graph/Graph.tsx +++ b/packages/grafana-ui/src/graveyard/Graph/Graph.tsx @@ -7,8 +7,8 @@ import React, { PureComponent } from 'react'; import { TimeRange, GraphSeriesXY, TimeZone, createDimension } from '@grafana/data'; import { TooltipDisplayMode } from '@grafana/schema'; -import { VizTooltipProps, VizTooltipContentProps, ActiveDimensions, VizTooltip } from '../VizTooltip'; -import { FlotPosition } from '../VizTooltip/VizTooltip'; +import { VizTooltipProps, VizTooltipContentProps, ActiveDimensions, VizTooltip } from '../../components/VizTooltip'; +import { FlotPosition } from '../../components/VizTooltip/VizTooltip'; import { GraphContextMenu, GraphContextMenuProps, ContextDimensions } from './GraphContextMenu'; import { GraphTooltip } from './GraphTooltip/GraphTooltip'; diff --git a/packages/grafana-ui/src/components/Graph/GraphContextMenu.tsx b/packages/grafana-ui/src/graveyard/Graph/GraphContextMenu.tsx similarity index 88% rename from packages/grafana-ui/src/components/Graph/GraphContextMenu.tsx rename to packages/grafana-ui/src/graveyard/Graph/GraphContextMenu.tsx index c58744435db..5b3da31708a 100644 --- a/packages/grafana-ui/src/components/Graph/GraphContextMenu.tsx +++ b/packages/grafana-ui/src/graveyard/Graph/GraphContextMenu.tsx @@ -11,13 +11,13 @@ import { GrafanaTheme2, } from '@grafana/data'; +import { ContextMenu, ContextMenuProps } from '../../components/ContextMenu/ContextMenu'; +import { FormattedValueDisplay } from '../../components/FormattedValueDisplay/FormattedValueDisplay'; +import { HorizontalGroup } from '../../components/Layout/Layout'; +import { MenuGroup, MenuGroupProps } from '../../components/Menu/MenuGroup'; +import { MenuItem } from '../../components/Menu/MenuItem'; +import { SeriesIcon } from '../../components/VizLegend/SeriesIcon'; import { useStyles2 } from '../../themes'; -import { ContextMenu, ContextMenuProps } from '../ContextMenu/ContextMenu'; -import { FormattedValueDisplay } from '../FormattedValueDisplay/FormattedValueDisplay'; -import { HorizontalGroup } from '../Layout/Layout'; -import { MenuGroup, MenuGroupProps } from '../Menu/MenuGroup'; -import { MenuItem } from '../Menu/MenuItem'; -import { SeriesIcon } from '../VizLegend/SeriesIcon'; import { GraphDimensions } from './GraphTooltip/types'; diff --git a/packages/grafana-ui/src/components/Graph/GraphSeriesToggler.tsx b/packages/grafana-ui/src/graveyard/Graph/GraphSeriesToggler.tsx similarity index 100% rename from packages/grafana-ui/src/components/Graph/GraphSeriesToggler.tsx rename to packages/grafana-ui/src/graveyard/Graph/GraphSeriesToggler.tsx diff --git a/packages/grafana-ui/src/components/Graph/GraphTooltip/GraphTooltip.tsx b/packages/grafana-ui/src/graveyard/Graph/GraphTooltip/GraphTooltip.tsx similarity index 93% rename from packages/grafana-ui/src/components/Graph/GraphTooltip/GraphTooltip.tsx rename to packages/grafana-ui/src/graveyard/Graph/GraphTooltip/GraphTooltip.tsx index d52b37c0144..d58c0816dfe 100644 --- a/packages/grafana-ui/src/components/Graph/GraphTooltip/GraphTooltip.tsx +++ b/packages/grafana-ui/src/graveyard/Graph/GraphTooltip/GraphTooltip.tsx @@ -2,7 +2,7 @@ import React from 'react'; import { TooltipDisplayMode } from '@grafana/schema'; -import { VizTooltipContentProps } from '../../VizTooltip'; +import { VizTooltipContentProps } from '../../../components/VizTooltip'; import { MultiModeGraphTooltip } from './MultiModeGraphTooltip'; import { SingleModeGraphTooltip } from './SingleModeGraphTooltip'; diff --git a/packages/grafana-ui/src/components/Graph/GraphTooltip/MultiModeGraphTooltip.test.tsx b/packages/grafana-ui/src/graveyard/Graph/GraphTooltip/MultiModeGraphTooltip.test.tsx similarity index 98% rename from packages/grafana-ui/src/components/Graph/GraphTooltip/MultiModeGraphTooltip.test.tsx rename to packages/grafana-ui/src/graveyard/Graph/GraphTooltip/MultiModeGraphTooltip.test.tsx index 0ab52812667..1af501183a6 100644 --- a/packages/grafana-ui/src/components/Graph/GraphTooltip/MultiModeGraphTooltip.test.tsx +++ b/packages/grafana-ui/src/graveyard/Graph/GraphTooltip/MultiModeGraphTooltip.test.tsx @@ -3,7 +3,7 @@ import React from 'react'; import { createDimension, createTheme, FieldType, DisplayProcessor } from '@grafana/data'; -import { ActiveDimensions } from '../../VizTooltip'; +import { ActiveDimensions } from '../../../components/VizTooltip'; import { MultiModeGraphTooltip } from './MultiModeGraphTooltip'; import { GraphDimensions } from './types'; diff --git a/packages/grafana-ui/src/components/Graph/GraphTooltip/MultiModeGraphTooltip.tsx b/packages/grafana-ui/src/graveyard/Graph/GraphTooltip/MultiModeGraphTooltip.tsx similarity index 91% rename from packages/grafana-ui/src/components/Graph/GraphTooltip/MultiModeGraphTooltip.tsx rename to packages/grafana-ui/src/graveyard/Graph/GraphTooltip/MultiModeGraphTooltip.tsx index b6810da3e93..bfe2856c700 100644 --- a/packages/grafana-ui/src/components/Graph/GraphTooltip/MultiModeGraphTooltip.tsx +++ b/packages/grafana-ui/src/graveyard/Graph/GraphTooltip/MultiModeGraphTooltip.tsx @@ -2,8 +2,8 @@ import React from 'react'; import { getValueFromDimension } from '@grafana/data'; -import { SeriesTable } from '../../VizTooltip'; -import { FlotPosition } from '../../VizTooltip/VizTooltip'; +import { SeriesTable } from '../../../components/VizTooltip'; +import { FlotPosition } from '../../../components/VizTooltip/VizTooltip'; import { getMultiSeriesGraphHoverInfo } from '../utils'; import { GraphTooltipContentProps } from './types'; diff --git a/packages/grafana-ui/src/components/Graph/GraphTooltip/SingleModeGraphTooltip.tsx b/packages/grafana-ui/src/graveyard/Graph/GraphTooltip/SingleModeGraphTooltip.tsx similarity index 95% rename from packages/grafana-ui/src/components/Graph/GraphTooltip/SingleModeGraphTooltip.tsx rename to packages/grafana-ui/src/graveyard/Graph/GraphTooltip/SingleModeGraphTooltip.tsx index 1f9c5d4699f..7eb4d61872c 100644 --- a/packages/grafana-ui/src/components/Graph/GraphTooltip/SingleModeGraphTooltip.tsx +++ b/packages/grafana-ui/src/graveyard/Graph/GraphTooltip/SingleModeGraphTooltip.tsx @@ -7,7 +7,7 @@ import { getFieldDisplayName, } from '@grafana/data'; -import { SeriesTable } from '../../VizTooltip'; +import { SeriesTable } from '../../../components/VizTooltip'; import { GraphTooltipContentProps } from './types'; diff --git a/packages/grafana-ui/src/components/Graph/GraphTooltip/types.ts b/packages/grafana-ui/src/graveyard/Graph/GraphTooltip/types.ts similarity index 85% rename from packages/grafana-ui/src/components/Graph/GraphTooltip/types.ts rename to packages/grafana-ui/src/graveyard/Graph/GraphTooltip/types.ts index 049ca540b1a..d4d68b729c1 100644 --- a/packages/grafana-ui/src/components/Graph/GraphTooltip/types.ts +++ b/packages/grafana-ui/src/graveyard/Graph/GraphTooltip/types.ts @@ -1,6 +1,6 @@ import { Dimension, Dimensions, TimeZone } from '@grafana/data'; -import { ActiveDimensions } from '../../VizTooltip'; +import { ActiveDimensions } from '../../../components/VizTooltip'; /** @deprecated */ export interface GraphDimensions extends Dimensions { diff --git a/packages/grafana-ui/src/components/Graph/GraphWithLegend.internal.story.tsx b/packages/grafana-ui/src/graveyard/Graph/GraphWithLegend.internal.story.tsx similarity index 100% rename from packages/grafana-ui/src/components/Graph/GraphWithLegend.internal.story.tsx rename to packages/grafana-ui/src/graveyard/Graph/GraphWithLegend.internal.story.tsx diff --git a/packages/grafana-ui/src/components/Graph/GraphWithLegend.tsx b/packages/grafana-ui/src/graveyard/Graph/GraphWithLegend.tsx similarity index 94% rename from packages/grafana-ui/src/components/Graph/GraphWithLegend.tsx rename to packages/grafana-ui/src/graveyard/Graph/GraphWithLegend.tsx index f7c28de0d3d..9788f6a580a 100644 --- a/packages/grafana-ui/src/components/Graph/GraphWithLegend.tsx +++ b/packages/grafana-ui/src/graveyard/Graph/GraphWithLegend.tsx @@ -6,10 +6,10 @@ import React from 'react'; import { GraphSeriesValue } from '@grafana/data'; import { LegendDisplayMode, LegendPlacement } from '@grafana/schema'; +import { CustomScrollbar } from '../../components/CustomScrollbar/CustomScrollbar'; +import { VizLegend } from '../../components/VizLegend/VizLegend'; +import { VizLegendItem } from '../../components/VizLegend/types'; import { stylesFactory } from '../../themes'; -import { CustomScrollbar } from '../CustomScrollbar/CustomScrollbar'; -import { VizLegend } from '../VizLegend/VizLegend'; -import { VizLegendItem } from '../VizLegend/types'; import { Graph, GraphProps } from './Graph'; diff --git a/packages/grafana-ui/src/components/Graph/types.ts b/packages/grafana-ui/src/graveyard/Graph/types.ts similarity index 100% rename from packages/grafana-ui/src/components/Graph/types.ts rename to packages/grafana-ui/src/graveyard/Graph/types.ts diff --git a/packages/grafana-ui/src/components/Graph/utils.test.ts b/packages/grafana-ui/src/graveyard/Graph/utils.test.ts similarity index 100% rename from packages/grafana-ui/src/components/Graph/utils.test.ts rename to packages/grafana-ui/src/graveyard/Graph/utils.test.ts diff --git a/packages/grafana-ui/src/components/Graph/utils.ts b/packages/grafana-ui/src/graveyard/Graph/utils.ts similarity index 100% rename from packages/grafana-ui/src/components/Graph/utils.ts rename to packages/grafana-ui/src/graveyard/Graph/utils.ts