Skip to content

Commit

Permalink
[customIntegrations] async load all components
Browse files Browse the repository at this point in the history
  • Loading branch information
spalger committed Nov 14, 2022
1 parent 19c4e19 commit 5ae32f2
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
11 changes: 11 additions & 0 deletions src/plugins/custom_integrations/public/language_components.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

export { SampleClientReadme } from './components/fleet_integration/sample/sample_client_readme';
export { ElasticsearchJsClientReadme } from './components/fleet_integration/elasticsearch_js/elasticsearch_js_readme';
export { ElasticsearchPyClientReadme } from './components/fleet_integration/elasticsearch_py/elasticsearch_py_readme';
16 changes: 9 additions & 7 deletions src/plugins/custom_integrations/public/plugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ import {

import { CustomIntegrationsServicesProvider } from './services';
import { servicesFactory } from './services/kibana';
import { SampleClientReadme } from './components/fleet_integration/sample/sample_client_readme';
import { ElasticsearchJsClientReadme } from './components/fleet_integration/elasticsearch_js/elasticsearch_js_readme';
import { ElasticsearchPyClientReadme } from './components/fleet_integration/elasticsearch_py/elasticsearch_py_readme';

export class CustomIntegrationsPlugin
implements Plugin<CustomIntegrationsSetup, CustomIntegrationsStart>
{
Expand All @@ -49,9 +45,15 @@ export class CustomIntegrationsPlugin
const services = servicesFactory({ coreStart, startPlugins });

const languageClientsUiComponents = {
sample: SampleClientReadme,
javascript: ElasticsearchJsClientReadme,
python: ElasticsearchPyClientReadme,
sample: React.lazy(async () => ({
default: (await import('./language_components')).SampleClientReadme,
})),
javascript: React.lazy(async () => ({
default: (await import('./language_components')).ElasticsearchJsClientReadme,
})),
python: React.lazy(async () => ({
default: (await import('./language_components')).ElasticsearchPyClientReadme,
})),
};

const ContextProvider: React.FC = ({ children }) => (
Expand Down

0 comments on commit 5ae32f2

Please sign in to comment.