diff --git a/public/app/features/dashboard-scene/scene/layout-default/DefaultGridLayoutManager.tsx b/public/app/features/dashboard-scene/scene/layout-default/DefaultGridLayoutManager.tsx index bad747f55de..22452f73c61 100644 --- a/public/app/features/dashboard-scene/scene/layout-default/DefaultGridLayoutManager.tsx +++ b/public/app/features/dashboard-scene/scene/layout-default/DefaultGridLayoutManager.tsx @@ -26,7 +26,6 @@ import { getGridItemKeyForPanelId, getDashboardSceneFor, } from '../../utils/utils'; -import { TabsLayoutManager } from '../layout-tabs/TabsLayoutManager'; import { DashboardLayoutManager } from '../types/DashboardLayoutManager'; import { LayoutRegistryItem } from '../types/LayoutRegistryItem'; @@ -180,22 +179,6 @@ export class DefaultGridLayoutManager return panels; } - public hasVizPanels(): boolean { - for (const child of this.state.grid.state.children) { - if (child instanceof DashboardGridItem) { - return true; - } else if (child instanceof SceneGridRow) { - for (const rowChild of child.state.children) { - if (rowChild instanceof DashboardGridItem) { - return true; - } - } - } - } - - return false; - } - public addNewRow(): SceneGridRow { const id = dashboardSceneGraph.getNextPanelId(this); @@ -224,17 +207,6 @@ export class DefaultGridLayoutManager return row; } - public addNewTab() { - const shouldAddTab = this.hasVizPanels(); - const tabsLayout = TabsLayoutManager.createFromLayout(this); - - if (shouldAddTab) { - tabsLayout.addNewTab(); - } - - getDashboardSceneFor(this).switchLayout(tabsLayout); - } - public editModeChanged(isEditing: boolean) { const updateResizeAndDragging = () => { this.state.grid.setState({ isDraggable: isEditing, isResizable: isEditing }); diff --git a/public/app/features/dashboard-scene/scene/layout-responsive-grid/ResponsiveGridLayoutManager.tsx b/public/app/features/dashboard-scene/scene/layout-responsive-grid/ResponsiveGridLayoutManager.tsx index 8c3505038c2..0823498bccf 100644 --- a/public/app/features/dashboard-scene/scene/layout-responsive-grid/ResponsiveGridLayoutManager.tsx +++ b/public/app/features/dashboard-scene/scene/layout-responsive-grid/ResponsiveGridLayoutManager.tsx @@ -4,14 +4,7 @@ import { OptionsPaneItemDescriptor } from 'app/features/dashboard/components/Pan import { joinCloneKeys } from '../../utils/clone'; import { dashboardSceneGraph } from '../../utils/dashboardSceneGraph'; -import { - getDashboardSceneFor, - getGridItemKeyForPanelId, - getPanelIdForVizPanel, - getVizPanelKeyForPanelId, -} from '../../utils/utils'; -import { RowsLayoutManager } from '../layout-rows/RowsLayoutManager'; -import { TabsLayoutManager } from '../layout-tabs/TabsLayoutManager'; +import { getGridItemKeyForPanelId, getPanelIdForVizPanel, getVizPanelKeyForPanelId } from '../../utils/utils'; import { DashboardLayoutManager } from '../types/DashboardLayoutManager'; import { LayoutRegistryItem } from '../types/LayoutRegistryItem'; @@ -111,16 +104,6 @@ export class ResponsiveGridLayoutManager return panels; } - public hasVizPanels(): boolean { - for (const child of this.state.layout.state.children) { - if (child instanceof ResponsiveGridItem) { - return true; - } - } - - return false; - } - public cloneLayout(ancestorKey: string, isSource: boolean): DashboardLayoutManager { return this.clone({ layout: this.state.layout.clone({ @@ -143,28 +126,6 @@ export class ResponsiveGridLayoutManager }); } - public addNewRow() { - const shouldAddRow = this.hasVizPanels(); - const rowsLayout = RowsLayoutManager.createFromLayout(this); - - if (shouldAddRow) { - rowsLayout.addNewRow(); - } - - getDashboardSceneFor(this).switchLayout(rowsLayout); - } - - public addNewTab() { - const shouldAddTab = this.hasVizPanels(); - const tabsLayout = TabsLayoutManager.createFromLayout(this); - - if (shouldAddTab) { - tabsLayout.addNewTab(); - } - - getDashboardSceneFor(this).switchLayout(tabsLayout); - } - public getOptions(): OptionsPaneItemDescriptor[] { return getEditOptions(this); } 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 a4959f810ec..5acf9063531 100644 --- a/public/app/features/dashboard-scene/scene/layout-rows/RowsLayoutManager.tsx +++ b/public/app/features/dashboard-scene/scene/layout-rows/RowsLayoutManager.tsx @@ -65,16 +65,6 @@ export class RowsLayoutManager extends SceneObjectBase i return panels; } - public hasVizPanels(): boolean { - for (const row of this.state.rows) { - if (row.getLayout().hasVizPanels()) { - return true; - } - } - - return false; - } - public cloneLayout(ancestorKey: string, isSource: boolean): DashboardLayoutManager { throw new Error('Method not implemented.'); } diff --git a/public/app/features/dashboard-scene/scene/layout-tabs/TabsLayoutManager.tsx b/public/app/features/dashboard-scene/scene/layout-tabs/TabsLayoutManager.tsx index c30491cc6fc..410fe06d781 100644 --- a/public/app/features/dashboard-scene/scene/layout-tabs/TabsLayoutManager.tsx +++ b/public/app/features/dashboard-scene/scene/layout-tabs/TabsLayoutManager.tsx @@ -85,16 +85,6 @@ export class TabsLayoutManager extends SceneObjectBase i throw new Error('Method not implemented.'); } - public hasVizPanels(): boolean { - for (const tab of this.state.tabs) { - if (tab.getLayout().hasVizPanels()) { - return true; - } - } - - return false; - } - public addNewTab() { const currentTab = new TabItem(); this.setState({ tabs: [...this.state.tabs, currentTab], currentTabIndex: this.state.tabs.length }); diff --git a/public/app/features/dashboard-scene/scene/types/DashboardLayoutManager.ts b/public/app/features/dashboard-scene/scene/types/DashboardLayoutManager.ts index 53862b2578d..190a6806467 100644 --- a/public/app/features/dashboard-scene/scene/types/DashboardLayoutManager.ts +++ b/public/app/features/dashboard-scene/scene/types/DashboardLayoutManager.ts @@ -39,11 +39,6 @@ export interface DashboardLayoutManager extends SceneObject { */ getVizPanels(): VizPanel[]; - /** - * Check if the layout has viz panels - */ - hasVizPanels(): boolean; - /** * Notify the layout manager that the edit mode has changed * @param isEditing