diff --git a/public/app/features/annotations/editorCtrl.js b/public/app/features/annotations/editorCtrl.js index 39b072263fc..5a509fe4ca9 100644 --- a/public/app/features/annotations/editorCtrl.js +++ b/public/app/features/annotations/editorCtrl.js @@ -20,15 +20,13 @@ function (angular, _, $) { }; $scope.init = function() { - $scope.editor = { index: 0 }; + $scope.mode = 'list'; $scope.datasources = datasourceSrv.getAnnotationSources(); $scope.annotations = $scope.dashboard.annotations.list; $scope.reset(); - $scope.$watch('editor.index', function(newVal) { - if (newVal !== 2) { - $scope.reset(); - } + $scope.$watch('mode', function(newVal) { + if (newVal === 'new') { $scope.reset(); } }); }; @@ -43,8 +41,8 @@ function (angular, _, $) { $scope.currentAnnotation = annotation; $scope.currentIsNew = false; $scope.datasourceChanged(); + $scope.mode = 'edit'; - $scope.editor.index = 2; $(".tooltip.in").remove(); }; @@ -57,14 +55,14 @@ function (angular, _, $) { $scope.update = function() { $scope.reset(); - $scope.editor.index = 0; + $scope.mode = 'list'; $scope.broadcastRefresh(); }; $scope.add = function() { $scope.annotations.push($scope.currentAnnotation); $scope.reset(); - $scope.editor.index = 0; + $scope.mode = 'list'; $scope.updateSubmenuVisibility(); $scope.broadcastRefresh(); }; diff --git a/public/app/features/annotations/partials/editor.html b/public/app/features/annotations/partials/editor.html index 2ff4040d098..851db4b4f01 100644 --- a/public/app/features/annotations/partials/editor.html +++ b/public/app/features/annotations/partials/editor.html @@ -6,9 +6,27 @@ Annotations -
-
-
+
+
-
+ +
No annotations defined @@ -47,7 +66,7 @@
-
+
@@ -75,11 +94,10 @@
- - + +

-
diff --git a/public/app/plugins/datasource/elasticsearch/queryCtrl.js b/public/app/plugins/datasource/elasticsearch/queryCtrl.js index 837ceb5017f..00a03207c08 100644 --- a/public/app/plugins/datasource/elasticsearch/queryCtrl.js +++ b/public/app/plugins/datasource/elasticsearch/queryCtrl.js @@ -58,7 +58,7 @@ function (angular, _) { if ($scope.target.rawQuery) { delete $scope.target.rawQuery; } else { - $scope.target.rawQuery = $scope.rawQueryOld; + $scope.target.rawQuery = angular.toJson($scope.datasource.queryBuilder.build($scope.target), true); } };