Skip to content

Commit c82e380

Browse files
Expose xy chart types component (#95275) (#95664)
Co-authored-by: Shahzad <shahzad.muhammad@elastic.co>
1 parent 41555f3 commit c82e380

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

x-pack/plugins/lens/public/mocks.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ const createStartContract = (): Start => {
1414
EmbeddableComponent: jest.fn(() => null),
1515
canUseEditor: jest.fn(() => true),
1616
navigateToPrefilledEditor: jest.fn(),
17+
getXyVisTypes: jest.fn(),
1718
};
1819
return startContract;
1920
};

x-pack/plugins/lens/public/plugin.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ import {
4242
VISUALIZE_FIELD_TRIGGER,
4343
} from '../../../../src/plugins/ui_actions/public';
4444
import { APP_ID, getEditPath, NOT_INTERNATIONALIZED_PRODUCT_NAME } from '../common';
45-
import { EditorFrameStart } from './types';
45+
import type { EditorFrameStart, VisualizationType } from './types';
4646
import { getLensAliasConfig } from './vis_type_alias';
4747
import { visualizeFieldAction } from './trigger_actions/visualize_field_actions';
4848
import { getSearchProvider } from './search_provider';
@@ -101,6 +101,11 @@ export interface LensPublicStart {
101101
* Method which returns true if the user has permission to use Lens as defined by application capabilities.
102102
*/
103103
canUseEditor: () => boolean;
104+
105+
/**
106+
* Method which returns xy VisualizationTypes array keeping this async as to not impact page load bundle
107+
*/
108+
getXyVisTypes: () => Promise<VisualizationType[]>;
104109
}
105110

106111
export class LensPlugin {
@@ -257,6 +262,10 @@ export class LensPlugin {
257262
canUseEditor: () => {
258263
return Boolean(core.application.capabilities.visualize?.show);
259264
},
265+
getXyVisTypes: async () => {
266+
const { visualizationTypes } = await import('./xy_visualization/types');
267+
return visualizationTypes;
268+
},
260269
};
261270
}
262271

0 commit comments

Comments
 (0)