submenuCtrl.js 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. define([
  2. 'angular',
  3. 'lodash'
  4. ],
  5. function (angular, _) {
  6. 'use strict';
  7. var module = angular.module('grafana.controllers');
  8. module.controller('SubmenuCtrl', function($scope, $q, $rootScope, templateValuesSrv, dynamicDashboardSrv) {
  9. var _d = {
  10. enable: true
  11. };
  12. _.defaults($scope.pulldown,_d);
  13. $scope.init = function() {
  14. $scope.panel = $scope.pulldown;
  15. $scope.row = $scope.pulldown;
  16. $scope.annotations = $scope.dashboard.templating.list;
  17. $scope.variables = _.map($scope.dashboard.templating.list, function(variable) {
  18. return variable;
  19. });
  20. };
  21. $scope.disableAnnotation = function (annotation) {
  22. annotation.enable = !annotation.enable;
  23. $rootScope.$broadcast('refresh');
  24. };
  25. $scope.variableUpdated = function(variable) {
  26. templateValuesSrv.variableUpdated(variable).then(function() {
  27. dynamicDashboardSrv.update($scope.dashboard);
  28. $rootScope.$broadcast('refresh');
  29. });
  30. };
  31. $scope.init();
  32. });
  33. });