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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user