DashboardLayouts: Remove unused functions (#101602)

This commit is contained in:
Torkel Ödegaard
2025-03-05 17:01:53 +01:00
committed by GitHub
parent 47f82a0c16
commit 962496c50d
5 changed files with 1 additions and 93 deletions
@@ -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 });
@@ -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);
}
@@ -65,16 +65,6 @@ export class RowsLayoutManager extends SceneObjectBase<RowsLayoutManagerState> 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.');
}
@@ -85,16 +85,6 @@ export class TabsLayoutManager extends SceneObjectBase<TabsLayoutManagerState> 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 });
@@ -39,11 +39,6 @@ export interface DashboardLayoutManager<S = {}> 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