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