2014-02-09 12:31:06 -06:00
|
|
|
define([
|
|
|
|
'angular',
|
2014-08-07 07:35:19 -05:00
|
|
|
'lodash'
|
2014-02-09 12:31:06 -06:00
|
|
|
],
|
2014-09-24 10:15:58 -05:00
|
|
|
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-06-06 23:38:33 -05:00
|
|
|
var _d = {
|
|
|
|
enable: true
|
|
|
|
};
|
2014-02-09 12:31:06 -06:00
|
|
|
|
2014-06-06 23:38:33 -05:00
|
|
|
_.defaults($scope.pulldown,_d);
|
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;
|
2014-08-28 05:44:01 -05:00
|
|
|
$scope.variables = $scope.dashboard.templating.list;
|
2015-02-20 05:20:10 -06:00
|
|
|
$scope.annotations = $scope.dashboard.templating.list;
|
2014-08-25 08:36:44 -05:00
|
|
|
};
|
|
|
|
|
2014-08-26 03:16:21 -05:00
|
|
|
$scope.disableAnnotation = function (annotation) {
|
|
|
|
annotation.enable = !annotation.enable;
|
|
|
|
$rootScope.$broadcast('refresh');
|
|
|
|
};
|
|
|
|
|
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.$broadcast('refresh');
|
|
|
|
});
|
2014-08-27 10:58:49 -05:00
|
|
|
};
|
|
|
|
|
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
|
|
|
|
2014-08-25 06:31:31 -05:00
|
|
|
});
|