submenu.ts 1.0 KB

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