mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Dashboard scenes: Fix issue going from view panel to edit panel when dashboard is not in edit mode (#87487)
Fix issue going from view panel to edit panel
This commit is contained in:
parent
37d1d1c0a0
commit
d52381b744
@ -41,6 +41,17 @@ describe('DashboardSceneUrlSync', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('entering edit mode', () => {
|
||||
it('it should be possible to go from the view panel view to the edit view when the dashboard is not in edit mdoe', () => {
|
||||
const scene = buildTestScene();
|
||||
scene.setState({ isEditing: false });
|
||||
scene.urlSync?.updateFromUrl({ viewPanel: 'panel-1' });
|
||||
expect(scene.state.viewPanelScene).toBeDefined();
|
||||
scene.urlSync?.updateFromUrl({ editPanel: 'panel-1' });
|
||||
expect(scene.state.editPanel).toBeDefined();
|
||||
});
|
||||
});
|
||||
|
||||
describe('Given a viewPanelKey with clone that is not found', () => {
|
||||
const scene = buildTestScene();
|
||||
|
||||
|
@ -129,6 +129,11 @@ export class DashboardSceneUrlSync implements SceneObjectUrlSyncHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
// We cannot simultaneously be in edit and view panel state.
|
||||
if (this._scene.state.viewPanelScene) {
|
||||
this._scene.setState({ viewPanelScene: undefined });
|
||||
}
|
||||
|
||||
// If we are not in editing (for example after full page reload)
|
||||
if (!isEditing) {
|
||||
this._scene.onEnterEditMode();
|
||||
|
@ -90,7 +90,7 @@ export function getViewPanelUrl(vizPanel: VizPanel) {
|
||||
}
|
||||
|
||||
export function getEditPanelUrl(panelId: number) {
|
||||
return locationUtil.getUrlForPartial(locationService.getLocation(), { editPanel: panelId });
|
||||
return locationUtil.getUrlForPartial(locationService.getLocation(), { editPanel: panelId, viewPanel: undefined });
|
||||
}
|
||||
|
||||
export function getInspectUrl(vizPanel: VizPanel, inspectTab?: InspectTab) {
|
||||
|
Loading…
Reference in New Issue
Block a user