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

pull/15084/head
Torkel Ödegaard 6 years ago
commit 994c79b59b
  1. 1
      public/app/features/dashboard/services/DashboardViewStateSrv.test.ts
  2. 13
      public/app/features/dashboard/services/DashboardViewStateSrv.ts

@ -58,7 +58,6 @@ describe('when updating view state', () => {
it('should remove params from query string', () => {
viewState.update({ fullscreen: true, panelId: 1, edit: true });
viewState.update({ fullscreen: false });
expect(viewState.dashboard.meta.fullscreen).toBe(false);
expect(viewState.state.fullscreen).toBe(null);
});
});

@ -72,7 +72,6 @@ export class DashboardViewStateSrv {
}
_.extend(this.state, state);
this.dashboard.meta.fullscreen = this.state.fullscreen;
if (!this.state.fullscreen) {
this.state.fullscreen = null;
@ -117,10 +116,20 @@ export class DashboardViewStateSrv {
}
syncState() {
if (this.dashboard.meta.fullscreen) {
if (this.state.fullscreen) {
const panel = this.dashboard.getPanelById(this.state.panelId);
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;
}

Loading…
Cancel
Save