Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[customIntegrations] async load all components #145166

Merged
merged 4 commits into from
Nov 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/kbn-optimizer/limits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pageLoadAssetSize:
controls: 40000
core: 435325
crossClusterReplication: 65408
customIntegrations: 44305
customIntegrations: 22034
dashboard: 82025
dashboardEnhanced: 65646
data: 454087
Expand Down
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