Dashboard: FF dashboardNewLayouts Fix library panels non-editable when multiple added (#107052)

Dashboards: Fix library panels non-editable if multiple were added - dashboardNewLayouts
This commit is contained in:
Alexa Vargas
2025-06-24 14:15:44 +02:00
committed by GitHub
parent 38fc06a6ff
commit f7fafe70f4
2 changed files with 4 additions and 0 deletions
@@ -139,6 +139,7 @@ describe('AddLibraryPanelWidget', () => {
expect(behavior.state.uid).toBe('new_uid');
expect(behavior.state.name).toBe('new_name');
expect(panels[0].state.title).toBe('model title');
expect(panels[0].state.key).toBe('panel-1'); // Key should be preserved from original panel
});
it('should set hoverHeader to true if the library panel title is empty', () => {
@@ -38,6 +38,9 @@ export class AddLibraryPanelDrawer extends SceneObjectBase<AddLibraryPanelDrawer
const layoutItem = panelToReplace.parent;
if (layoutItem && isDashboardLayoutItem(layoutItem)) {
// keep the same key from the panelToReplace
// this is important for edit mode
newPanel.setState({ key: panelToReplace.state.key });
layoutItem.setElementBody(newPanel);
}
} else {