submenuCtrl.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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 = $scope.dashboard.templating.list;
  18. };
  19. $scope.disableAnnotation = function (annotation) {
  20. annotation.enable = !annotation.enable;
  21. $rootScope.$broadcast('refresh');
  22. };
  23. $scope.getValuesForTag = function(variable, tagKey) {
  24. return templateValuesSrv.getValuesForTag(variable, tagKey);
  25. };
  26. $scope.variableUpdated = function(variable) {
  27. templateValuesSrv.variableUpdated(variable).then(function() {
  28. dynamicDashboardSrv.update($scope.dashboard);
  29. $rootScope.$broadcast('refresh');
  30. });
  31. };
  32. $scope.init();
  33. });
  34. });