diff --git a/src/app/panels/annotations/editor.js b/src/app/panels/annotations/editor.js index 4afc322d032..6aa43342cc4 100644 --- a/src/app/panels/annotations/editor.js +++ b/src/app/panels/annotations/editor.js @@ -42,6 +42,10 @@ function (angular, app, _) { $scope.currentAnnotation = annotation; $scope.currentIsNew = false; $scope.currentDatasource = _.findWhere($scope.datasources, { name: annotation.datasource }); + + if (!$scope.currentDatasource) { + $scope.currentDatasource = $scope.datasources[0]; + } }; $scope.update = function() { diff --git a/src/app/panels/annotations/module.js b/src/app/panels/annotations/module.js index 339fb2e0f94..0c63570aabb 100644 --- a/src/app/panels/annotations/module.js +++ b/src/app/panels/annotations/module.js @@ -27,7 +27,7 @@ function (angular, app, _) { annotations: [] }; - _.defaults($scope.panel,_d); + _.defaults($scope.panel, _d); $scope.hide = function (annotation) { annotation.enable = !annotation.enable; diff --git a/src/app/services/datasourceSrv.js b/src/app/services/datasourceSrv.js index f63a3923df1..1696ee7f20e 100644 --- a/src/app/services/datasourceSrv.js +++ b/src/app/services/datasourceSrv.js @@ -24,6 +24,7 @@ function (angular, _, config) { if (!this.default) { this.default = datasources[_.keys(datasources)[0]]; + this.default.default = true; } }; @@ -51,7 +52,7 @@ function (angular, _, config) { if (value.supportAnnotations) { results.push({ name: key, - editorSrc: value.annotationEditorSrc + editorSrc: value.annotationEditorSrc, }); } });