mirror of
https://github.com/grafana/grafana.git
synced 2025-01-07 22:53:56 -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;
|
||||
|
||||
/** @ngInject */
|
||||
constructor(private annotationsSrv: AnnotationsSrv) {
|
||||
constructor(private annotationsSrv: AnnotationsSrv) {}
|
||||
|
||||
$onInit() {
|
||||
this.event.panelId = this.panelCtrl.panel.id;
|
||||
this.event.dashboardId = this.panelCtrl.dashboard.id;
|
||||
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user