DashboardLayout: Only use edit actions with `dashboardNewLayouts` feature toggle (#106445)

This commit is contained in:
Sven Grossmann 2025-06-10 09:22:06 +02:00 committed by GitHub
parent ff5d06734a
commit 33a9a9313d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 17 additions and 11 deletions

View File

@ -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();
}