From 8c790853517da8f280bae33350874d4e9eab9dd7 Mon Sep 17 00:00:00 2001 From: Andrej Ocenas Date: Mon, 9 Sep 2019 17:10:26 +0200 Subject: [PATCH] Annotations: Fix query editor rendering on datasource change (#18945) --- public/app/features/annotations/editor_ctrl.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/public/app/features/annotations/editor_ctrl.ts b/public/app/features/annotations/editor_ctrl.ts index 56c87a31a38..9c8ba7428dd 100644 --- a/public/app/features/annotations/editor_ctrl.ts +++ b/public/app/features/annotations/editor_ctrl.ts @@ -46,7 +46,7 @@ export class AnnotationsEditorCtrl { showOptions: any = [{ text: 'All Panels', value: 0 }, { text: 'Specific Panels', value: 1 }]; /** @ngInject */ - constructor($scope: any, private datasourceSrv: DatasourceSrv) { + constructor(private $scope: any, private datasourceSrv: DatasourceSrv) { $scope.ctrl = this; this.dashboard = $scope.dashboard; @@ -59,7 +59,10 @@ export class AnnotationsEditorCtrl { } async datasourceChanged() { - return (this.currentDatasource = await this.datasourceSrv.get(this.currentAnnotation.datasource)); + const newDatasource = await this.datasourceSrv.get(this.currentAnnotation.datasource); + this.$scope.$apply(() => { + this.currentDatasource = newDatasource; + }); } edit(annotation: any) {