submenu.ts 1.0 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, 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
  37. .module("grafana.directives")
  38. .directive("dashboardSubmenu", submenuDirective);