浏览代码

Annotation datasource redesign is done, Closes #608

Torkel Ödegaard 11 年之前
父节点
当前提交
551b802d89
共有 3 个文件被更改,包括 7 次插入2 次删除
  1. 4 0
      src/app/panels/annotations/editor.js
  2. 1 1
      src/app/panels/annotations/module.js
  3. 2 1
      src/app/services/datasourceSrv.js

+ 4 - 0
src/app/panels/annotations/editor.js

@@ -42,6 +42,10 @@ function (angular, app, _) {
       $scope.currentAnnotation = annotation;
       $scope.currentAnnotation = annotation;
       $scope.currentIsNew = false;
       $scope.currentIsNew = false;
       $scope.currentDatasource = _.findWhere($scope.datasources, { name: annotation.datasource });
       $scope.currentDatasource = _.findWhere($scope.datasources, { name: annotation.datasource });
+
+      if (!$scope.currentDatasource) {
+        $scope.currentDatasource = $scope.datasources[0];
+      }
     };
     };
 
 
     $scope.update = function() {
     $scope.update = function() {

+ 1 - 1
src/app/panels/annotations/module.js

@@ -27,7 +27,7 @@ function (angular, app, _) {
       annotations: []
       annotations: []
     };
     };
 
 
-    _.defaults($scope.panel,_d);
+    _.defaults($scope.panel, _d);
 
 
     $scope.hide = function (annotation) {
     $scope.hide = function (annotation) {
       annotation.enable = !annotation.enable;
       annotation.enable = !annotation.enable;

+ 2 - 1
src/app/services/datasourceSrv.js

@@ -24,6 +24,7 @@ function (angular, _, config) {
 
 
       if (!this.default) {
       if (!this.default) {
         this.default = datasources[_.keys(datasources)[0]];
         this.default = datasources[_.keys(datasources)[0]];
+        this.default.default = true;
       }
       }
     };
     };
 
 
@@ -51,7 +52,7 @@ function (angular, _, config) {
         if (value.supportAnnotations) {
         if (value.supportAnnotations) {
           results.push({
           results.push({
             name: key,
             name: key,
-            editorSrc: value.annotationEditorSrc
+            editorSrc: value.annotationEditorSrc,
           });
           });
         }
         }
       });
       });