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 -