mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Annotations: Fixes error when trying to create annotation when dashboard is unsaved (#29013)
This commit is contained in:
parent
28383bcfac
commit
cbd28cd28b
@ -14,7 +14,9 @@ export class EventEditorCtrl {
|
|||||||
timeFormated: string;
|
timeFormated: string;
|
||||||
|
|
||||||
/** @ngInject */
|
/** @ngInject */
|
||||||
constructor(private annotationsSrv: AnnotationsSrv) {
|
constructor(private annotationsSrv: AnnotationsSrv) {}
|
||||||
|
|
||||||
|
$onInit() {
|
||||||
this.event.panelId = this.panelCtrl.panel.id;
|
this.event.panelId = this.panelCtrl.panel.id;
|
||||||
this.event.dashboardId = this.panelCtrl.dashboard.id;
|
this.event.dashboardId = this.panelCtrl.dashboard.id;
|
||||||
|
|
||||||
|
@ -243,11 +243,17 @@ class GraphElement {
|
|||||||
return;
|
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)
|
// Skip if range selected (added in "plotselected" event handler)
|
||||||
if (pos.x !== pos.x1) {
|
if (pos.x !== pos.x1) {
|
||||||
return;
|
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(() => {
|
setTimeout(() => {
|
||||||
this.eventManager.updateTime({ from: pos.x, to: null });
|
this.eventManager.updateTime({ from: pos.x, to: null });
|
||||||
}, 100);
|
}, 100);
|
||||||
|
Loading…
Reference in New Issue
Block a user