From e8b9f0ecf699af91ce059dc708572690b74b490f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Mon, 12 May 2025 14:16:25 +0200 Subject: [PATCH] RowsLayout: Remove unused code / logic (#104759) --- .../scene/layout-rows/RowItem.tsx | 6 +----- .../scene/layout-rows/RowsLayoutManager.tsx | 18 +----------------- 2 files changed, 2 insertions(+), 22 deletions(-) diff --git a/public/app/features/dashboard-scene/scene/layout-rows/RowItem.tsx b/public/app/features/dashboard-scene/scene/layout-rows/RowItem.tsx index 4ba6753075c..ee25ec31ca2 100644 --- a/public/app/features/dashboard-scene/scene/layout-rows/RowItem.tsx +++ b/public/app/features/dashboard-scene/scene/layout-rows/RowItem.tsx @@ -20,7 +20,7 @@ import { ShowConfirmModalEvent } from 'app/types/events'; import { ConditionalRendering } from '../../conditional-rendering/ConditionalRendering'; import { serializeRow } from '../../serialization/layoutSerializers/RowsLayoutSerializer'; import { getElements } from '../../serialization/layoutSerializers/utils'; -import { getDashboardSceneFor, getDefaultVizPanel } from '../../utils/utils'; +import { getDashboardSceneFor } from '../../utils/utils'; import { AutoGridLayoutManager } from '../layout-auto-grid/AutoGridLayoutManager'; import { LayoutRestorer } from '../layouts-shared/LayoutRestorer'; import { clearClipboard } from '../layouts-shared/paste'; @@ -161,10 +161,6 @@ export class RowItem store.set(LS_ROW_COPY_KEY, JSON.stringify({ elements, row: this.serialize() })); } - public onAddPanel(panel = getDefaultVizPanel()) { - this.getLayout().addPanel(panel); - } - public setIsDropTarget(isDropTarget: boolean) { if (!!this.state.isDropTarget !== isDropTarget) { this.setState({ isDropTarget }); diff --git a/public/app/features/dashboard-scene/scene/layout-rows/RowsLayoutManager.tsx b/public/app/features/dashboard-scene/scene/layout-rows/RowsLayoutManager.tsx index 7cd516afd99..90d902d8100 100644 --- a/public/app/features/dashboard-scene/scene/layout-rows/RowsLayoutManager.tsx +++ b/public/app/features/dashboard-scene/scene/layout-rows/RowsLayoutManager.tsx @@ -16,7 +16,6 @@ import { } from '../../edit-pane/shared'; import { serializeRowsLayout } from '../../serialization/layoutSerializers/RowsLayoutSerializer'; import { isClonedKey, joinCloneKeys } from '../../utils/clone'; -import { dashboardSceneGraph } from '../../utils/dashboardSceneGraph'; import { getDashboardSceneFor } from '../../utils/utils'; import { DashboardGridItem } from '../layout-default/DashboardGridItem'; import { DefaultGridLayoutManager } from '../layout-default/DefaultGridLayoutManager'; @@ -60,22 +59,7 @@ export class RowsLayoutManager extends SceneObjectBase i public readonly descriptor = RowsLayoutManager.descriptor; - public addPanel(vizPanel: VizPanel) { - // Try to add new panels to the selected row - const selectedRows = dashboardSceneGraph.getAllSelectedObjects(this).filter((obj) => obj instanceof RowItem); - if (selectedRows.length > 0) { - return selectedRows.forEach((row) => row.onAddPanel(vizPanel)); - } - - // If we don't have selected row add it to the first row - if (this.state.rows.length > 0) { - return this.state.rows[0].onAddPanel(vizPanel); - } - - // Otherwise fallback to adding a new row and a panel - this.addNewRow(); - this.state.rows[this.state.rows.length - 1].onAddPanel(vizPanel); - } + public addPanel(vizPanel: VizPanel) {} public getVizPanels(): VizPanel[] { const panels: VizPanel[] = [];