panel_editor_tab.ts 886 B

123456789101112131415161718192021222324252627282930313233
  1. ///<reference path="../../headers/common.d.ts" />
  2. import angular from 'angular';
  3. import config from 'app/core/config';
  4. var directiveModule = angular.module('grafana.directives');
  5. /** @ngInject */
  6. function panelEditorTab(dynamicDirectiveSrv) {
  7. return dynamicDirectiveSrv.create({
  8. scope: {
  9. ctrl: "=",
  10. editorTab: "=",
  11. index: "=",
  12. },
  13. directive: scope => {
  14. var pluginId = scope.ctrl.pluginId;
  15. var tabIndex = scope.index;
  16. // create a wrapper for directiveFn
  17. // required for metrics tab directive
  18. // that is the same for many panels but
  19. // given different names in this function
  20. var fn = () => scope.editorTab.directiveFn();
  21. return Promise.resolve({
  22. name: `panel-editor-tab-${pluginId}${tabIndex}`,
  23. fn: fn,
  24. });
  25. }
  26. });
  27. }
  28. directiveModule.directive('panelEditorTab', panelEditorTab);