submenuCtrl.js 1.0 KB

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