diff --git a/public/app/features/annotations/event_editor.ts b/public/app/features/annotations/event_editor.ts index f6a15935876..791232333a8 100644 --- a/public/app/features/annotations/event_editor.ts +++ b/public/app/features/annotations/event_editor.ts @@ -14,7 +14,9 @@ export class EventEditorCtrl { timeFormated: string; /** @ngInject */ - constructor(private annotationsSrv: AnnotationsSrv) { + constructor(private annotationsSrv: AnnotationsSrv) {} + + $onInit() { this.event.panelId = this.panelCtrl.panel.id; this.event.dashboardId = this.panelCtrl.dashboard.id; diff --git a/public/app/plugins/panel/graph/graph.ts b/public/app/plugins/panel/graph/graph.ts index cec92e6b90c..3de95db23d4 100644 --- a/public/app/plugins/panel/graph/graph.ts +++ b/public/app/plugins/panel/graph/graph.ts @@ -243,11 +243,17 @@ class GraphElement { return; } - if ((pos.ctrlKey || pos.metaKey) && (this.dashboard.meta.canEdit || this.dashboard.meta.canMakeEditable)) { + if (pos.ctrlKey || pos.metaKey) { // Skip if range selected (added in "plotselected" event handler) if (pos.x !== pos.x1) { return; } + + // skip if dashboard is not saved yet (exists in db) or user cannot edit + if (!this.dashboard.id || (!this.dashboard.meta.canEdit && !this.dashboard.meta.canMakeEditable)) { + return; + } + setTimeout(() => { this.eventManager.updateTime({ from: pos.x, to: null }); }, 100);