From 33a9a9313d6bafda22946b625be5c99dea2ed4de Mon Sep 17 00:00:00 2001 From: Sven Grossmann Date: Tue, 10 Jun 2025 09:22:06 +0200 Subject: [PATCH] DashboardLayout: Only use edit actions with `dashboardNewLayouts` feature toggle (#106445) --- .../DefaultGridLayoutManager.tsx | 28 +++++++++++-------- 1 file changed, 17 insertions(+), 11 deletions(-) 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 0a33231fb9d..de3bd6b6c65 100644 --- a/public/app/features/dashboard-scene/scene/layout-default/DefaultGridLayoutManager.tsx +++ b/public/app/features/dashboard-scene/scene/layout-default/DefaultGridLayoutManager.tsx @@ -153,17 +153,23 @@ export class DefaultGridLayoutManager const emptySpace = findSpaceForNewPanel(this.state.grid); const newGridItem = getDashboardGridItemFromClipboard(getDashboardSceneFor(this), emptySpace); - dashboardEditActions.edit({ - description: t('dashboard.edit-actions.paste-panel', 'Paste panel'), - addedObject: newGridItem.state.body, - source: this, - perform: () => { - this.state.grid.setState({ children: [...this.state.grid.state.children, newGridItem] }); - }, - undo: () => { - this.state.grid.setState({ children: this.state.grid.state.children.filter((child) => child !== newGridItem) }); - }, - }); + if (config.featureToggles.dashboardNewLayouts) { + dashboardEditActions.edit({ + description: t('dashboard.edit-actions.paste-panel', 'Paste panel'), + addedObject: newGridItem.state.body, + source: this, + perform: () => { + this.state.grid.setState({ children: [...this.state.grid.state.children, newGridItem] }); + }, + undo: () => { + this.state.grid.setState({ + children: this.state.grid.state.children.filter((child) => child !== newGridItem), + }); + }, + }); + } else { + this.state.grid.setState({ children: [...this.state.grid.state.children, newGridItem] }); + } clearClipboard(); }