submenu.ts 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. ///<reference path="../../../headers/common.d.ts" />
  2. import angular from 'angular';
  3. import _ from 'lodash';
  4. export class SubmenuCtrl {
  5. annotations: any;
  6. variables: any;
  7. dashboard: any;
  8. /** @ngInject */
  9. constructor(private $rootScope,
  10. private variableSrv,
  11. private $location) {
  12. this.annotations = this.dashboard.templating.list;
  13. this.variables = this.variableSrv.variables;
  14. }
  15. annotationStateChanged() {
  16. this.$rootScope.$broadcast('refresh');
  17. }
  18. variableUpdated(variable) {
  19. this.variableSrv.variableUpdated(variable, true);
  20. }
  21. openEditView(editview) {
  22. var search = _.extend(this.$location.search(), {editview: editview});
  23. this.$location.search(search);
  24. }
  25. }
  26. export function submenuDirective() {
  27. return {
  28. restrict: 'E',
  29. templateUrl: 'public/app/features/dashboard/submenu/submenu.html',
  30. controller: SubmenuCtrl,
  31. bindToController: true,
  32. controllerAs: 'ctrl',
  33. scope: {
  34. dashboard: "=",
  35. }
  36. };
  37. }
  38. angular.module('grafana.directives').directive('dashboardSubmenu', submenuDirective);