forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
more aggressive lazy loading for ingest_manager (elastic#79633) (elas…
…tic#79713) * slim ingest_manager * revert registerPackagePolicyComponent export
- Loading branch information
Showing
8 changed files
with
98 additions
and
40 deletions.
There are no files selected for viewing
7 changes: 0 additions & 7 deletions
7
...ns/ingest_manager/public/applications/ingest_manager/components/home_integration/index.ts
This file was deleted.
Oops, something went wrong.
39 changes: 39 additions & 0 deletions
39
...s/ingest_manager/public/applications/ingest_manager/components/home_integration/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
import React from 'react'; | ||
import type { | ||
TutorialDirectoryNoticeComponent, | ||
TutorialDirectoryHeaderLinkComponent, | ||
TutorialModuleNoticeComponent, | ||
} from 'src/plugins/home/public'; | ||
import { EuiLoadingSpinner } from '@elastic/eui'; | ||
|
||
const TutorialDirectoryNoticeLazy = React.lazy(() => import('./tutorial_directory_notice')); | ||
export const TutorialDirectoryNotice: TutorialDirectoryNoticeComponent = () => ( | ||
<React.Suspense fallback={<EuiLoadingSpinner />}> | ||
<TutorialDirectoryNoticeLazy /> | ||
</React.Suspense> | ||
); | ||
|
||
const TutorialDirectoryHeaderLinkLazy = React.lazy( | ||
() => import('./tutorial_directory_header_link') | ||
); | ||
export const TutorialDirectoryHeaderLink: TutorialDirectoryHeaderLinkComponent = () => ( | ||
<React.Suspense fallback={<EuiLoadingSpinner />}> | ||
<TutorialDirectoryHeaderLinkLazy /> | ||
</React.Suspense> | ||
); | ||
|
||
const TutorialModuleNoticeLazy = React.lazy(() => import('./tutorial_module_notice')); | ||
export const TutorialModuleNotice: TutorialModuleNoticeComponent = ({ | ||
moduleName, | ||
}: { | ||
moduleName: string; | ||
}) => ( | ||
<React.Suspense fallback={<EuiLoadingSpinner />}> | ||
<TutorialModuleNoticeLazy moduleName={moduleName} /> | ||
</React.Suspense> | ||
); |
45 changes: 45 additions & 0 deletions
45
...pplications/ingest_manager/components/home_integration/tutorial_directory_header_link.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
import React, { memo, useState, useEffect } from 'react'; | ||
import { BehaviorSubject } from 'rxjs'; | ||
import { FormattedMessage } from '@kbn/i18n/react'; | ||
import { EuiButtonEmpty } from '@elastic/eui'; | ||
import type { TutorialDirectoryHeaderLinkComponent } from 'src/plugins/home/public'; | ||
import { useLink, useCapabilities } from '../../hooks'; | ||
|
||
const tutorialDirectoryNoticeState$ = new BehaviorSubject({ | ||
settingsDataLoaded: false, | ||
hasSeenNotice: false, | ||
}); | ||
|
||
const TutorialDirectoryHeaderLink: TutorialDirectoryHeaderLinkComponent = memo(() => { | ||
const { getHref } = useLink(); | ||
const { show: hasIngestManager } = useCapabilities(); | ||
const [noticeState, setNoticeState] = useState({ | ||
settingsDataLoaded: false, | ||
hasSeenNotice: false, | ||
}); | ||
|
||
useEffect(() => { | ||
const subscription = tutorialDirectoryNoticeState$.subscribe((value) => setNoticeState(value)); | ||
return () => { | ||
subscription.unsubscribe(); | ||
}; | ||
}, []); | ||
|
||
return hasIngestManager && noticeState.settingsDataLoaded && noticeState.hasSeenNotice ? ( | ||
<EuiButtonEmpty size="s" iconType="link" flush="right" href={getHref('overview')}> | ||
<FormattedMessage | ||
id="xpack.ingestManager.homeIntegration.tutorialDirectory.ingestManagerAppButtonText" | ||
defaultMessage="Try Ingest Manager Beta" | ||
/> | ||
</EuiButtonEmpty> | ||
) : null; | ||
}); | ||
|
||
// Needed for React.lazy | ||
// eslint-disable-next-line import/no-default-export | ||
export default TutorialDirectoryHeaderLink; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters