mirror of https://github.com/grafana/grafana.git
DashboardLayout: Only use edit actions with `dashboardNewLayouts` feature toggle (#106445)
This commit is contained in:
parent
ff5d06734a
commit
33a9a9313d
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue