From f49b9b89cf98b59a5b39bec5ea635e2b7ef34390 Mon Sep 17 00:00:00 2001 From: Nathan Marrs Date: Wed, 24 May 2023 09:32:36 -0700 Subject: [PATCH] chore: high level restructure of canvas panel files (#69004) --- .betterer.results | 34 +++++++++---------- .../app/features/canvas/elements/button.tsx | 2 +- public/app/features/canvas/elements/icon.tsx | 2 +- public/app/features/canvas/runtime/scene.tsx | 8 ++--- .../app/plugins/panel/canvas/CanvasPanel.tsx | 4 +-- .../{ => components}/CanvasContextMenu.tsx | 11 +++--- .../canvas/{ => components}/CanvasTooltip.tsx | 0 .../canvas/{ => components}/SetBackground.tsx | 7 ++-- .../connections}/ConnectionAnchors.tsx | 0 .../connections}/ConnectionSVG.tsx | 2 +- .../connections}/Connections.tsx | 5 +-- .../canvas/editor/{ => element}/APIEditor.tsx | 0 .../{ => element}/ConstraintSelectionBox.tsx | 0 .../editor/{ => element}/PlacementEditor.tsx | 2 +- .../editor/{ => element}/QuickPositioning.tsx | 0 .../editor/{ => element}/elementEditor.tsx | 6 ++-- .../canvas/{ => editor/inline}/InlineEdit.tsx | 0 .../{ => editor/inline}/InlineEditBody.tsx | 15 ++++---- .../canvas/editor/{ => inline}/TabsEditor.tsx | 2 +- .../{ => layer}/TreeNavigationEditor.tsx | 14 ++++---- .../editor/{ => layer}/TreeNodeTitle.tsx | 8 ++--- .../canvas/editor/{ => layer}/layerEditor.tsx | 6 ++-- .../panel/canvas/{ => editor/layer}/tree.ts | 2 +- public/app/plugins/panel/canvas/models.gen.ts | 2 +- public/app/plugins/panel/canvas/module.tsx | 4 +-- public/app/plugins/panel/canvas/utils.ts | 19 +++++------ 26 files changed, 77 insertions(+), 78 deletions(-) rename public/app/plugins/panel/canvas/{ => components}/CanvasContextMenu.tsx (95%) rename public/app/plugins/panel/canvas/{ => components}/CanvasTooltip.tsx (100%) rename public/app/plugins/panel/canvas/{ => components}/SetBackground.tsx (88%) rename public/app/plugins/panel/canvas/{ => components/connections}/ConnectionAnchors.tsx (100%) rename public/app/plugins/panel/canvas/{ => components/connections}/ConnectionSVG.tsx (99%) rename public/app/plugins/panel/canvas/{ => components/connections}/Connections.tsx (99%) rename public/app/plugins/panel/canvas/editor/{ => element}/APIEditor.tsx (100%) rename public/app/plugins/panel/canvas/editor/{ => element}/ConstraintSelectionBox.tsx (100%) rename public/app/plugins/panel/canvas/editor/{ => element}/PlacementEditor.tsx (99%) rename public/app/plugins/panel/canvas/editor/{ => element}/QuickPositioning.tsx (100%) rename public/app/plugins/panel/canvas/editor/{ => element}/elementEditor.tsx (95%) rename public/app/plugins/panel/canvas/{ => editor/inline}/InlineEdit.tsx (100%) rename public/app/plugins/panel/canvas/{ => editor/inline}/InlineEditBody.tsx (93%) rename public/app/plugins/panel/canvas/editor/{ => inline}/TabsEditor.tsx (95%) rename public/app/plugins/panel/canvas/editor/{ => layer}/TreeNavigationEditor.tsx (92%) rename public/app/plugins/panel/canvas/editor/{ => layer}/TreeNodeTitle.tsx (93%) rename public/app/plugins/panel/canvas/editor/{ => layer}/layerEditor.tsx (94%) rename public/app/plugins/panel/canvas/{ => editor/layer}/tree.ts (98%) diff --git a/.betterer.results b/.betterer.results index 36466a971d4..6e1d53ec622 100644 --- a/.betterer.results +++ b/.betterer.results @@ -4985,31 +4985,31 @@ exports[`better eslint`] = { [0, 0, 0, "Do not use any type assertions.", "10"], [0, 0, 0, "Do not use any type assertions.", "11"] ], - "public/app/plugins/panel/canvas/InlineEditBody.tsx:5381": [ + "public/app/plugins/panel/canvas/editor/connectionEditor.tsx:5381": [ + [0, 0, 0, "Unexpected any. Specify a different type.", "0"] + ], + "public/app/plugins/panel/canvas/editor/element/APIEditor.tsx:5381": [ + [0, 0, 0, "Do not use any type assertions.", "0"] + ], + "public/app/plugins/panel/canvas/editor/element/PlacementEditor.tsx:5381": [ + [0, 0, 0, "Unexpected any. Specify a different type.", "0"] + ], + "public/app/plugins/panel/canvas/editor/element/elementEditor.tsx:5381": [ + [0, 0, 0, "Unexpected any. Specify a different type.", "0"], + [0, 0, 0, "Do not use any type assertions.", "1"], + [0, 0, 0, "Unexpected any. Specify a different type.", "2"] + ], + "public/app/plugins/panel/canvas/editor/inline/InlineEditBody.tsx:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], [0, 0, 0, "Unexpected any. Specify a different type.", "1"], [0, 0, 0, "Unexpected any. Specify a different type.", "2"], [0, 0, 0, "Do not use any type assertions.", "3"], [0, 0, 0, "Unexpected any. Specify a different type.", "4"] ], - "public/app/plugins/panel/canvas/editor/APIEditor.tsx:5381": [ - [0, 0, 0, "Do not use any type assertions.", "0"] - ], - "public/app/plugins/panel/canvas/editor/PlacementEditor.tsx:5381": [ + "public/app/plugins/panel/canvas/editor/layer/TreeNavigationEditor.tsx:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"] ], - "public/app/plugins/panel/canvas/editor/TreeNavigationEditor.tsx:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"] - ], - "public/app/plugins/panel/canvas/editor/connectionEditor.tsx:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"] - ], - "public/app/plugins/panel/canvas/editor/elementEditor.tsx:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"], - [0, 0, 0, "Do not use any type assertions.", "1"], - [0, 0, 0, "Unexpected any. Specify a different type.", "2"] - ], - "public/app/plugins/panel/canvas/editor/layerEditor.tsx:5381": [ + "public/app/plugins/panel/canvas/editor/layer/layerEditor.tsx:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"], [0, 0, 0, "Unexpected any. Specify a different type.", "1"], [0, 0, 0, "Do not use any type assertions.", "2"], diff --git a/public/app/features/canvas/elements/button.tsx b/public/app/features/canvas/elements/button.tsx index ca324bffe1c..a4d054b6f16 100644 --- a/public/app/features/canvas/elements/button.tsx +++ b/public/app/features/canvas/elements/button.tsx @@ -5,7 +5,7 @@ import { TextDimensionConfig } from '@grafana/schema'; import { Button } from '@grafana/ui'; import { DimensionContext } from 'app/features/dimensions/context'; import { TextDimensionEditor } from 'app/features/dimensions/editors/TextDimensionEditor'; -import { APIEditor, APIEditorConfig, callApi } from 'app/plugins/panel/canvas/editor/APIEditor'; +import { APIEditor, APIEditorConfig, callApi } from 'app/plugins/panel/canvas/editor/element/APIEditor'; import { CanvasElementItem, CanvasElementProps, defaultBgColor } from '../element'; diff --git a/public/app/features/canvas/elements/icon.tsx b/public/app/features/canvas/elements/icon.tsx index 27928d61ebf..55b47a6024d 100644 --- a/public/app/features/canvas/elements/icon.tsx +++ b/public/app/features/canvas/elements/icon.tsx @@ -7,7 +7,7 @@ import { SanitizedSVG } from 'app/core/components/SVG/SanitizedSVG'; import { getPublicOrAbsoluteUrl } from 'app/features/dimensions'; import { DimensionContext } from 'app/features/dimensions/context'; import { ColorDimensionEditor, ResourceDimensionEditor } from 'app/features/dimensions/editors'; -import { APIEditorConfig, callApi } from 'app/plugins/panel/canvas/editor/APIEditor'; +import { APIEditorConfig, callApi } from 'app/plugins/panel/canvas/editor/element/APIEditor'; import { CanvasElementItem, CanvasElementProps, defaultBgColor } from '../element'; import { LineConfig } from '../types'; diff --git a/public/app/features/canvas/runtime/scene.tsx b/public/app/features/canvas/runtime/scene.tsx index 5a80d311fa7..68489e95121 100644 --- a/public/app/features/canvas/runtime/scene.tsx +++ b/public/app/features/canvas/runtime/scene.tsx @@ -25,10 +25,10 @@ import { getScaleDimensionFromData, getTextDimensionFromData, } from 'app/features/dimensions/utils'; -import { CanvasContextMenu } from 'app/plugins/panel/canvas/CanvasContextMenu'; -import { CanvasTooltip } from 'app/plugins/panel/canvas/CanvasTooltip'; -import { CONNECTION_ANCHOR_DIV_ID } from 'app/plugins/panel/canvas/ConnectionAnchors'; -import { Connections } from 'app/plugins/panel/canvas/Connections'; +import { CanvasContextMenu } from 'app/plugins/panel/canvas/components/CanvasContextMenu'; +import { CanvasTooltip } from 'app/plugins/panel/canvas/components/CanvasTooltip'; +import { CONNECTION_ANCHOR_DIV_ID } from 'app/plugins/panel/canvas/components/connections/ConnectionAnchors'; +import { Connections } from 'app/plugins/panel/canvas/components/connections/Connections'; import { AnchorPoint, CanvasTooltipPayload, LayerActionID } from 'app/plugins/panel/canvas/types'; import appEvents from '../../../core/app_events'; diff --git a/public/app/plugins/panel/canvas/CanvasPanel.tsx b/public/app/plugins/panel/canvas/CanvasPanel.tsx index 9ee04d1b349..ef6e797f076 100644 --- a/public/app/plugins/panel/canvas/CanvasPanel.tsx +++ b/public/app/plugins/panel/canvas/CanvasPanel.tsx @@ -9,8 +9,8 @@ import { ElementState } from 'app/features/canvas/runtime/element'; import { Scene } from 'app/features/canvas/runtime/scene'; import { PanelEditEnteredEvent, PanelEditExitedEvent } from 'app/types/events'; -import { InlineEdit } from './InlineEdit'; -import { SetBackground } from './SetBackground'; +import { SetBackground } from './components/SetBackground'; +import { InlineEdit } from './editor/inline/InlineEdit'; import { Options } from './models.gen'; import { AnchorPoint, CanvasTooltipPayload, ConnectionState } from './types'; diff --git a/public/app/plugins/panel/canvas/CanvasContextMenu.tsx b/public/app/plugins/panel/canvas/components/CanvasContextMenu.tsx similarity index 95% rename from public/app/plugins/panel/canvas/CanvasContextMenu.tsx rename to public/app/plugins/panel/canvas/components/CanvasContextMenu.tsx index bc99da0f5da..c5868fbbcf2 100644 --- a/public/app/plugins/panel/canvas/CanvasContextMenu.tsx +++ b/public/app/plugins/panel/canvas/components/CanvasContextMenu.tsx @@ -4,14 +4,13 @@ import { first } from 'rxjs/operators'; import { SelectableValue } from '@grafana/data'; import { ContextMenu, MenuItem, MenuItemProps } from '@grafana/ui'; +import { ElementState } from 'app/features/canvas/runtime/element'; +import { FrameState } from 'app/features/canvas/runtime/frame'; import { Scene } from 'app/features/canvas/runtime/scene'; -import { ElementState } from '../../../features/canvas/runtime/element'; -import { FrameState } from '../../../features/canvas/runtime/frame'; - -import { CanvasPanel } from './CanvasPanel'; -import { AnchorPoint, LayerActionID } from './types'; -import { getElementTypes, onAddItem } from './utils'; +import { CanvasPanel } from '../CanvasPanel'; +import { AnchorPoint, LayerActionID } from '../types'; +import { getElementTypes, onAddItem } from '../utils'; type Props = { scene: Scene; diff --git a/public/app/plugins/panel/canvas/CanvasTooltip.tsx b/public/app/plugins/panel/canvas/components/CanvasTooltip.tsx similarity index 100% rename from public/app/plugins/panel/canvas/CanvasTooltip.tsx rename to public/app/plugins/panel/canvas/components/CanvasTooltip.tsx diff --git a/public/app/plugins/panel/canvas/SetBackground.tsx b/public/app/plugins/panel/canvas/components/SetBackground.tsx similarity index 88% rename from public/app/plugins/panel/canvas/SetBackground.tsx rename to public/app/plugins/panel/canvas/components/SetBackground.tsx index 2d6d3e157c3..9b353a096f1 100644 --- a/public/app/plugins/panel/canvas/SetBackground.tsx +++ b/public/app/plugins/panel/canvas/components/SetBackground.tsx @@ -5,11 +5,10 @@ import { GrafanaTheme2 } from '@grafana/data'; import { ResourceDimensionMode } from '@grafana/schema'; import { Portal, useTheme2 } from '@grafana/ui'; import { Scene } from 'app/features/canvas/runtime/scene'; +import { MediaType, ResourceFolderName } from 'app/features/dimensions'; +import { ResourcePickerPopover } from 'app/features/dimensions/editors/ResourcePickerPopover'; -import { MediaType, ResourceFolderName } from '../../../features/dimensions'; -import { ResourcePickerPopover } from '../../../features/dimensions/editors/ResourcePickerPopover'; - -import { AnchorPoint } from './types'; +import { AnchorPoint } from '../types'; type Props = { onClose: () => void; diff --git a/public/app/plugins/panel/canvas/ConnectionAnchors.tsx b/public/app/plugins/panel/canvas/components/connections/ConnectionAnchors.tsx similarity index 100% rename from public/app/plugins/panel/canvas/ConnectionAnchors.tsx rename to public/app/plugins/panel/canvas/components/connections/ConnectionAnchors.tsx diff --git a/public/app/plugins/panel/canvas/ConnectionSVG.tsx b/public/app/plugins/panel/canvas/components/connections/ConnectionSVG.tsx similarity index 99% rename from public/app/plugins/panel/canvas/ConnectionSVG.tsx rename to public/app/plugins/panel/canvas/components/connections/ConnectionSVG.tsx index e2146895cfd..ca40af12200 100644 --- a/public/app/plugins/panel/canvas/ConnectionSVG.tsx +++ b/public/app/plugins/panel/canvas/components/connections/ConnectionSVG.tsx @@ -6,7 +6,7 @@ import { useStyles2 } from '@grafana/ui'; import { config } from 'app/core/config'; import { Scene } from 'app/features/canvas/runtime/scene'; -import { ConnectionState } from './types'; +import { ConnectionState } from '../../types'; type Props = { setSVGRef: (anchorElement: SVGSVGElement) => void; diff --git a/public/app/plugins/panel/canvas/Connections.tsx b/public/app/plugins/panel/canvas/components/connections/Connections.tsx similarity index 99% rename from public/app/plugins/panel/canvas/Connections.tsx rename to public/app/plugins/panel/canvas/components/connections/Connections.tsx index 6edda793f76..e3e5ac6e492 100644 --- a/public/app/plugins/panel/canvas/Connections.tsx +++ b/public/app/plugins/panel/canvas/components/connections/Connections.tsx @@ -6,10 +6,11 @@ import { CanvasConnection, ConnectionPath } from 'app/features/canvas'; import { ElementState } from 'app/features/canvas/runtime/element'; import { Scene } from 'app/features/canvas/runtime/scene'; +import { ConnectionState } from '../../types'; +import { getConnections, isConnectionSource, isConnectionTarget } from '../../utils'; + import { CONNECTION_ANCHOR_ALT, ConnectionAnchors, CONNECTION_ANCHOR_HIGHLIGHT_OFFSET } from './ConnectionAnchors'; import { ConnectionSVG } from './ConnectionSVG'; -import { ConnectionState } from './types'; -import { getConnections, isConnectionSource, isConnectionTarget } from './utils'; export class Connections { scene: Scene; diff --git a/public/app/plugins/panel/canvas/editor/APIEditor.tsx b/public/app/plugins/panel/canvas/editor/element/APIEditor.tsx similarity index 100% rename from public/app/plugins/panel/canvas/editor/APIEditor.tsx rename to public/app/plugins/panel/canvas/editor/element/APIEditor.tsx diff --git a/public/app/plugins/panel/canvas/editor/ConstraintSelectionBox.tsx b/public/app/plugins/panel/canvas/editor/element/ConstraintSelectionBox.tsx similarity index 100% rename from public/app/plugins/panel/canvas/editor/ConstraintSelectionBox.tsx rename to public/app/plugins/panel/canvas/editor/element/ConstraintSelectionBox.tsx diff --git a/public/app/plugins/panel/canvas/editor/PlacementEditor.tsx b/public/app/plugins/panel/canvas/editor/element/PlacementEditor.tsx similarity index 99% rename from public/app/plugins/panel/canvas/editor/PlacementEditor.tsx rename to public/app/plugins/panel/canvas/editor/element/PlacementEditor.tsx index 731bc89c605..a569194a31a 100644 --- a/public/app/plugins/panel/canvas/editor/PlacementEditor.tsx +++ b/public/app/plugins/panel/canvas/editor/element/PlacementEditor.tsx @@ -7,7 +7,7 @@ import { Field, HorizontalGroup, Icon, InlineField, InlineFieldRow, Select, Vert import { NumberInput } from 'app/core/components/OptionsUI/NumberInput'; import { HorizontalConstraint, Placement, VerticalConstraint } from 'app/features/canvas'; -import { Options } from '../models.gen'; +import { Options } from '../../models.gen'; import { ConstraintSelectionBox } from './ConstraintSelectionBox'; import { QuickPositioning } from './QuickPositioning'; diff --git a/public/app/plugins/panel/canvas/editor/QuickPositioning.tsx b/public/app/plugins/panel/canvas/editor/element/QuickPositioning.tsx similarity index 100% rename from public/app/plugins/panel/canvas/editor/QuickPositioning.tsx rename to public/app/plugins/panel/canvas/editor/element/QuickPositioning.tsx diff --git a/public/app/plugins/panel/canvas/editor/elementEditor.tsx b/public/app/plugins/panel/canvas/editor/element/elementEditor.tsx similarity index 95% rename from public/app/plugins/panel/canvas/editor/elementEditor.tsx rename to public/app/plugins/panel/canvas/editor/element/elementEditor.tsx index 78935c85039..3c9cf6778f8 100644 --- a/public/app/plugins/panel/canvas/editor/elementEditor.tsx +++ b/public/app/plugins/panel/canvas/editor/element/elementEditor.tsx @@ -8,14 +8,14 @@ import { defaultElementItems, } from 'app/features/canvas'; import { ElementState } from 'app/features/canvas/runtime/element'; +import { FrameState } from 'app/features/canvas/runtime/frame'; import { Scene } from 'app/features/canvas/runtime/scene'; import { setOptionImmutably } from 'app/features/dashboard/components/PanelEditor/utils'; -import { FrameState } from '../../../../features/canvas/runtime/frame'; -import { getElementTypes } from '../utils'; +import { getElementTypes } from '../../utils'; +import { optionBuilder } from '../options'; import { PlacementEditor } from './PlacementEditor'; -import { optionBuilder } from './options'; export interface CanvasEditorOptions { element: ElementState; diff --git a/public/app/plugins/panel/canvas/InlineEdit.tsx b/public/app/plugins/panel/canvas/editor/inline/InlineEdit.tsx similarity index 100% rename from public/app/plugins/panel/canvas/InlineEdit.tsx rename to public/app/plugins/panel/canvas/editor/inline/InlineEdit.tsx diff --git a/public/app/plugins/panel/canvas/InlineEditBody.tsx b/public/app/plugins/panel/canvas/editor/inline/InlineEditBody.tsx similarity index 93% rename from public/app/plugins/panel/canvas/InlineEditBody.tsx rename to public/app/plugins/panel/canvas/editor/inline/InlineEditBody.tsx index 4aecb720e46..d805996cc6b 100644 --- a/public/app/plugins/panel/canvas/InlineEditBody.tsx +++ b/public/app/plugins/panel/canvas/editor/inline/InlineEditBody.tsx @@ -14,13 +14,14 @@ import { OptionsPaneCategoryDescriptor } from 'app/features/dashboard/components import { fillOptionsPaneItems } from 'app/features/dashboard/components/PanelEditor/getVisualizationOptions'; import { setOptionImmutably } from 'app/features/dashboard/components/PanelEditor/utils'; -import { activePanelSubject, InstanceState } from './CanvasPanel'; -import { TabsEditor } from './editor/TabsEditor'; -import { getElementEditor } from './editor/elementEditor'; -import { getLayerEditor } from './editor/layerEditor'; -import { addStandardCanvasEditorOptions } from './module'; -import { InlineEditTabs } from './types'; -import { getElementTypes, onAddItem } from './utils'; +import { activePanelSubject, InstanceState } from '../../CanvasPanel'; +import { addStandardCanvasEditorOptions } from '../../module'; +import { InlineEditTabs } from '../../types'; +import { getElementTypes, onAddItem } from '../../utils'; +import { getElementEditor } from '../element/elementEditor'; +import { getLayerEditor } from '../layer/layerEditor'; + +import { TabsEditor } from './TabsEditor'; export function InlineEditBody() { const activePanel = useObservable(activePanelSubject); diff --git a/public/app/plugins/panel/canvas/editor/TabsEditor.tsx b/public/app/plugins/panel/canvas/editor/inline/TabsEditor.tsx similarity index 95% rename from public/app/plugins/panel/canvas/editor/TabsEditor.tsx rename to public/app/plugins/panel/canvas/editor/inline/TabsEditor.tsx index d142f1f21a6..620646518b2 100644 --- a/public/app/plugins/panel/canvas/editor/TabsEditor.tsx +++ b/public/app/plugins/panel/canvas/editor/inline/TabsEditor.tsx @@ -2,7 +2,7 @@ import React, { useState } from 'react'; import { Tab, TabsBar } from '@grafana/ui/src'; -import { InlineEditTabs } from '../types'; +import { InlineEditTabs } from '../../types'; type Props = { onTabChange: (v: string) => void; diff --git a/public/app/plugins/panel/canvas/editor/TreeNavigationEditor.tsx b/public/app/plugins/panel/canvas/editor/layer/TreeNavigationEditor.tsx similarity index 92% rename from public/app/plugins/panel/canvas/editor/TreeNavigationEditor.tsx rename to public/app/plugins/panel/canvas/editor/layer/TreeNavigationEditor.tsx index 06f6bcc5aa9..02a138fe52a 100644 --- a/public/app/plugins/panel/canvas/editor/TreeNavigationEditor.tsx +++ b/public/app/plugins/panel/canvas/editor/layer/TreeNavigationEditor.tsx @@ -6,17 +6,17 @@ import React, { Key, useEffect, useMemo, useState } from 'react'; import { GrafanaTheme2, StandardEditorProps } from '@grafana/data'; import { config } from '@grafana/runtime'; import { Button, HorizontalGroup, Icon, useStyles2, useTheme2 } from '@grafana/ui'; +import { AddLayerButton } from 'app/core/components/Layers/AddLayerButton'; import { ElementState } from 'app/features/canvas/runtime/element'; -import { AddLayerButton } from '../../../../core/components/Layers/AddLayerButton'; -import { getGlobalStyles } from '../globalStyles'; -import { Options } from '../models.gen'; -import { getTreeData, onNodeDrop, TreeElement } from '../tree'; -import { DragNode, DropNode } from '../types'; -import { doSelect, getElementTypes, onAddItem } from '../utils'; +import { getGlobalStyles } from '../../globalStyles'; +import { Options } from '../../models.gen'; +import { DragNode, DropNode } from '../../types'; +import { doSelect, getElementTypes, onAddItem } from '../../utils'; +import { TreeViewEditorProps } from '../element/elementEditor'; import { TreeNodeTitle } from './TreeNodeTitle'; -import { TreeViewEditorProps } from './elementEditor'; +import { getTreeData, onNodeDrop, TreeElement } from './tree'; let allowSelection = true; diff --git a/public/app/plugins/panel/canvas/editor/TreeNodeTitle.tsx b/public/app/plugins/panel/canvas/editor/layer/TreeNodeTitle.tsx similarity index 93% rename from public/app/plugins/panel/canvas/editor/TreeNodeTitle.tsx rename to public/app/plugins/panel/canvas/editor/layer/TreeNodeTitle.tsx index f22aca3bc91..db67023f2cd 100644 --- a/public/app/plugins/panel/canvas/editor/TreeNodeTitle.tsx +++ b/public/app/plugins/panel/canvas/editor/layer/TreeNodeTitle.tsx @@ -3,13 +3,13 @@ import React from 'react'; import { GrafanaTheme2 } from '@grafana/data'; import { IconButton, useStyles2 } from '@grafana/ui'; +import { LayerName } from 'app/core/components/Layers/LayerName'; import { ElementState } from 'app/features/canvas/runtime/element'; -import { LayerName } from '../../../../core/components/Layers/LayerName'; -import { TreeElement } from '../tree'; -import { LayerActionID } from '../types'; +import { LayerActionID } from '../../types'; +import { TreeViewEditorProps } from '../element/elementEditor'; -import { TreeViewEditorProps } from './elementEditor'; +import { TreeElement } from './tree'; interface Props { settings: TreeViewEditorProps; diff --git a/public/app/plugins/panel/canvas/editor/layerEditor.tsx b/public/app/plugins/panel/canvas/editor/layer/layerEditor.tsx similarity index 94% rename from public/app/plugins/panel/canvas/editor/layerEditor.tsx rename to public/app/plugins/panel/canvas/editor/layer/layerEditor.tsx index 28cf61c56e8..f98c03c3818 100644 --- a/public/app/plugins/panel/canvas/editor/layerEditor.tsx +++ b/public/app/plugins/panel/canvas/editor/layer/layerEditor.tsx @@ -6,11 +6,11 @@ import { FrameState } from 'app/features/canvas/runtime/frame'; import { Scene } from 'app/features/canvas/runtime/scene'; import { setOptionImmutably } from 'app/features/dashboard/components/PanelEditor/utils'; -import { InstanceState } from '../CanvasPanel'; +import { InstanceState } from '../../CanvasPanel'; +import { PlacementEditor } from '../element/PlacementEditor'; +import { optionBuilder } from '../options'; -import { PlacementEditor } from './PlacementEditor'; import { TreeNavigationEditor } from './TreeNavigationEditor'; -import { optionBuilder } from './options'; export interface LayerEditorProps { scene: Scene; diff --git a/public/app/plugins/panel/canvas/tree.ts b/public/app/plugins/panel/canvas/editor/layer/tree.ts similarity index 98% rename from public/app/plugins/panel/canvas/tree.ts rename to public/app/plugins/panel/canvas/editor/layer/tree.ts index 0460c6b84eb..36216bc201c 100644 --- a/public/app/plugins/panel/canvas/tree.ts +++ b/public/app/plugins/panel/canvas/editor/layer/tree.ts @@ -4,7 +4,7 @@ import { ElementState } from 'app/features/canvas/runtime/element'; import { FrameState } from 'app/features/canvas/runtime/frame'; import { RootElement } from 'app/features/canvas/runtime/root'; -import { DragNode, DropNode } from './types'; +import { DragNode, DropNode } from '../../types'; export interface TreeElement { key: number; diff --git a/public/app/plugins/panel/canvas/models.gen.ts b/public/app/plugins/panel/canvas/models.gen.ts index b1f67028eb1..a00c2441ad5 100644 --- a/public/app/plugins/panel/canvas/models.gen.ts +++ b/public/app/plugins/panel/canvas/models.gen.ts @@ -1,6 +1,6 @@ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // NOTE: This file will be auto generated from models.cue -// It is currenty hand written but will serve as the target for cuetsy +// It is currently hand written but will serve as the target for cuetsy //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ import { CanvasFrameOptions, DEFAULT_CANVAS_ELEMENT_CONFIG } from 'app/features/canvas'; diff --git a/public/app/plugins/panel/canvas/module.tsx b/public/app/plugins/panel/canvas/module.tsx index 745787b3423..a3b0a04ba13 100644 --- a/public/app/plugins/panel/canvas/module.tsx +++ b/public/app/plugins/panel/canvas/module.tsx @@ -3,8 +3,8 @@ import { FrameState } from 'app/features/canvas/runtime/frame'; import { CanvasPanel, InstanceState } from './CanvasPanel'; import { getConnectionEditor } from './editor/connectionEditor'; -import { getElementEditor } from './editor/elementEditor'; -import { getLayerEditor } from './editor/layerEditor'; +import { getElementEditor } from './editor/element/elementEditor'; +import { getLayerEditor } from './editor/layer/layerEditor'; import { canvasMigrationHandler } from './migrations'; import { Options } from './models.gen'; diff --git a/public/app/plugins/panel/canvas/utils.ts b/public/app/plugins/panel/canvas/utils.ts index a61767d9b2a..d44acf5ac03 100644 --- a/public/app/plugins/panel/canvas/utils.ts +++ b/public/app/plugins/panel/canvas/utils.ts @@ -1,22 +1,21 @@ import { isNumber, isString } from 'lodash'; import { AppEvents, Field, LinkModel, PluginState, SelectableValue } from '@grafana/data'; +import appEvents from 'app/core/app_events'; import { hasAlphaPanels } from 'app/core/config'; - -import appEvents from '../../../core/app_events'; import { + defaultElementItems, advancedElementItems, CanvasElementItem, - CanvasElementOptions, canvasElementRegistry, - defaultElementItems, + CanvasElementOptions, TextConfig, -} from '../../../features/canvas'; -import { notFoundItem } from '../../../features/canvas/elements/notFound'; -import { ElementState } from '../../../features/canvas/runtime/element'; -import { FrameState } from '../../../features/canvas/runtime/frame'; -import { Scene, SelectionParams } from '../../../features/canvas/runtime/scene'; -import { DimensionContext } from '../../../features/dimensions'; +} from 'app/features/canvas'; +import { notFoundItem } from 'app/features/canvas/elements/notFound'; +import { ElementState } from 'app/features/canvas/runtime/element'; +import { FrameState } from 'app/features/canvas/runtime/frame'; +import { Scene, SelectionParams } from 'app/features/canvas/runtime/scene'; +import { DimensionContext } from 'app/features/dimensions'; import { AnchorPoint, ConnectionState } from './types';