panel_editor_tab.ts 848 B

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