Commit 994c79b5 by Torkel Ödegaard

Merge branch '15048/navigate-from-not-saved-panel'

parents dc125f1e 520756fb
...@@ -58,7 +58,6 @@ describe('when updating view state', () => { ...@@ -58,7 +58,6 @@ describe('when updating view state', () => {
it('should remove params from query string', () => { it('should remove params from query string', () => {
viewState.update({ fullscreen: true, panelId: 1, edit: true }); viewState.update({ fullscreen: true, panelId: 1, edit: true });
viewState.update({ fullscreen: false }); viewState.update({ fullscreen: false });
expect(viewState.dashboard.meta.fullscreen).toBe(false);
expect(viewState.state.fullscreen).toBe(null); expect(viewState.state.fullscreen).toBe(null);
}); });
}); });
......
...@@ -72,7 +72,6 @@ export class DashboardViewStateSrv { ...@@ -72,7 +72,6 @@ export class DashboardViewStateSrv {
} }
_.extend(this.state, state); _.extend(this.state, state);
this.dashboard.meta.fullscreen = this.state.fullscreen;
if (!this.state.fullscreen) { if (!this.state.fullscreen) {
this.state.fullscreen = null; this.state.fullscreen = null;
...@@ -117,10 +116,20 @@ export class DashboardViewStateSrv { ...@@ -117,10 +116,20 @@ export class DashboardViewStateSrv {
} }
syncState() { syncState() {
if (this.dashboard.meta.fullscreen) { if (this.state.fullscreen) {
const panel = this.dashboard.getPanelById(this.state.panelId); const panel = this.dashboard.getPanelById(this.state.panelId);
if (!panel) { if (!panel) {
this.state.fullscreen = null;
this.state.panelId = null;
this.state.edit = null;
this.update(this.state);
setTimeout(() => {
appEvents.emit('alert-error', ['Error', 'Panel not found']);
}, 100);
return; return;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment