submenu.ts 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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 templateSrv,
  12. private $location) {
  13. this.annotations = this.dashboard.templating.list;
  14. this.variables = this.variableSrv.variables;
  15. }
  16. annotationStateChanged() {
  17. this.$rootScope.$broadcast('refresh');
  18. }
  19. variableUpdated(variable) {
  20. this.variableSrv.variableUpdated(variable, true);
  21. }
  22. openEditView(editview) {
  23. var search = _.extend(this.$location.search(), {editview: editview});
  24. this.$location.search(search);
  25. }
  26. }
  27. export function submenuDirective() {
  28. return {
  29. restrict: 'E',
  30. templateUrl: 'public/app/features/dashboard/submenu/submenu.html',
  31. controller: SubmenuCtrl,
  32. bindToController: true,
  33. controllerAs: 'ctrl',
  34. scope: {
  35. dashboard: "=",
  36. }
  37. };
  38. }
  39. angular.module('grafana.directives').directive('dashboardSubmenu', submenuDirective);