grafana/public/app/features/dashboard/submenuCtrl.js

40 lines
1.0 KiB
JavaScript
Raw Normal View History

2014-02-09 12:31:06 -06:00
define([
'angular',
],
function (angular) {
2014-02-09 12:31:06 -06:00
'use strict';
2014-07-28 11:11:52 -05:00
var module = angular.module('grafana.controllers');
2014-02-09 12:31:06 -06:00
2015-03-17 15:04:08 -05:00
module.controller('SubmenuCtrl', function($scope, $q, $rootScope, templateValuesSrv, dynamicDashboardSrv) {
2014-02-09 12:31:06 -06:00
2014-06-06 23:38:33 -05:00
$scope.init = function() {
$scope.panel = $scope.pulldown;
$scope.row = $scope.pulldown;
$scope.annotations = $scope.dashboard.templating.list;
$scope.variables = $scope.dashboard.templating.list;
};
$scope.disableAnnotation = function (annotation) {
annotation.enable = !annotation.enable;
$rootScope.$broadcast('refresh');
};
$scope.getValuesForTag = function(variable, tagKey) {
return templateValuesSrv.getValuesForTag(variable, tagKey);
};
2015-03-19 22:09:50 -05:00
$scope.variableUpdated = function(variable) {
templateValuesSrv.variableUpdated(variable).then(function() {
2015-03-17 15:04:08 -05:00
dynamicDashboardSrv.update($scope.dashboard);
$rootScope.$emit('template-variable-value-updated');
2015-03-17 15:04:08 -05:00
$rootScope.$broadcast('refresh');
});
};
2014-06-06 23:38:33 -05:00
$scope.init();
2014-02-09 12:31:06 -06:00
2014-06-06 23:38:33 -05:00
});
2014-02-09 12:31:06 -06:00
});