2016-01-18 05:19:46 -06:00
|
|
|
///<reference path="../../../headers/common.d.ts" />
|
|
|
|
|
2017-12-20 05:33:33 -06:00
|
|
|
import angular from 'angular';
|
|
|
|
import _ from 'lodash';
|
2016-01-18 05:19:46 -06:00
|
|
|
|
|
|
|
export class SubmenuCtrl {
|
|
|
|
annotations: any;
|
|
|
|
variables: any;
|
|
|
|
dashboard: any;
|
|
|
|
|
2016-01-20 04:57:56 -06:00
|
|
|
/** @ngInject */
|
2017-12-19 09:06:54 -06:00
|
|
|
constructor(private $rootScope, private variableSrv, private $location) {
|
2016-01-18 05:19:46 -06:00
|
|
|
this.annotations = this.dashboard.templating.list;
|
2016-09-15 07:53:36 -05:00
|
|
|
this.variables = this.variableSrv.variables;
|
2016-01-18 05:19:46 -06:00
|
|
|
}
|
|
|
|
|
2016-09-21 06:45:26 -05:00
|
|
|
annotationStateChanged() {
|
2017-12-20 05:33:33 -06:00
|
|
|
this.$rootScope.$broadcast('refresh');
|
2016-01-18 05:19:46 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
variableUpdated(variable) {
|
2017-08-02 09:15:22 -05:00
|
|
|
this.variableSrv.variableUpdated(variable, true);
|
2016-01-18 05:19:46 -06:00
|
|
|
}
|
2016-10-25 09:36:40 -05:00
|
|
|
|
|
|
|
openEditView(editview) {
|
2017-12-19 09:06:54 -06:00
|
|
|
var search = _.extend(this.$location.search(), { editview: editview });
|
2016-10-25 09:36:40 -05:00
|
|
|
this.$location.search(search);
|
|
|
|
}
|
2016-01-18 05:19:46 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
export function submenuDirective() {
|
|
|
|
return {
|
2017-12-20 05:33:33 -06:00
|
|
|
restrict: 'E',
|
|
|
|
templateUrl: 'public/app/features/dashboard/submenu/submenu.html',
|
2016-01-18 05:19:46 -06:00
|
|
|
controller: SubmenuCtrl,
|
|
|
|
bindToController: true,
|
2017-12-20 05:33:33 -06:00
|
|
|
controllerAs: 'ctrl',
|
2016-01-18 05:19:46 -06:00
|
|
|
scope: {
|
2017-12-20 05:33:33 -06:00
|
|
|
dashboard: '=',
|
|
|
|
},
|
2016-01-18 05:19:46 -06:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2017-12-21 01:39:31 -06:00
|
|
|
angular.module('grafana.directives').directive('dashboardSubmenu', submenuDirective);
|