Browse Source

Annotations: Fix query editor rendering on datasource change (#18945)

Andrej Ocenas 6 năm trước cách đây
mục cha
commit
8c79085351
1 tập tin đã thay đổi với 5 bổ sung2 xóa
  1. 5 2
      public/app/features/annotations/editor_ctrl.ts

+ 5 - 2
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) {