module.js 1007 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. ## annotations
  3. */
  4. define([
  5. 'angular',
  6. 'app',
  7. 'underscore'
  8. ],
  9. function (angular, app, _) {
  10. 'use strict';
  11. var module = angular.module('kibana.panels.annotations', []);
  12. app.useModule(module);
  13. module.controller('AnnotationsCtrl', function($scope, dashboard, annotationsSrv, $rootScope) {
  14. $scope.panelMeta = {
  15. status : "Stable",
  16. description : "Annotations"
  17. };
  18. // Set and populate defaults
  19. var _d = {
  20. };
  21. _.defaults($scope.panel,_d);
  22. $scope.init = function() {
  23. $scope.annotationList = annotationsSrv.annotationList;
  24. };
  25. $scope.hideAll = function () {
  26. $scope.panel.hideAll = !$scope.panel.hideAll;
  27. _.each($scope.annotationList, function(annotation) {
  28. annotation.enabled = !$scope.panel.hideAll;
  29. });
  30. };
  31. $scope.hide = function (annotation) {
  32. annotation.enabled = !annotation.enabled;
  33. $scope.panel.hideAll = !annotation.enabled;
  34. $rootScope.$broadcast('refresh');
  35. };
  36. });
  37. });