forked from elastic/kibana
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Infra UI] Chart load optimization (elastic#162328)
Closes elastic#161445 ## Summary This PR enhances the usage of the intersection observer to control the loading behavior of charts, improving the performance, especially noticeable during scrolling. Before https://github.com/elastic/kibana/assets/2767137/dfb1d7db-4ddb-41c3-b8ae-3b5bdf3fe36e After https://github.com/elastic/kibana/assets/2767137/f348b0b9-4e6f-4163-9eb4-99daea91bbef Besides, the intersection observer threshold has been set to 0, allowing charts to start loading as soon as they begin to enter the viewport. ### How to test - Start a local Kibana instance - Navigate to `Infrastructure > Hosts` - Scroll down and confirm that it's not laggy (same for the flyout) --------- Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
- Loading branch information
1 parent
0cc81d7
commit 0367514
Showing
20 changed files
with
231 additions
and
268 deletions.
There are no files selected for viewing
63 changes: 0 additions & 63 deletions
63
x-pack/plugins/infra/public/common/visualizations/lens/chart_loader.tsx
This file was deleted.
Oops, something went wrong.
144 changes: 0 additions & 144 deletions
144
x-pack/plugins/infra/public/common/visualizations/lens/lens_wrapper.tsx
This file was deleted.
Oops, something went wrong.
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
39 changes: 39 additions & 0 deletions
39
x-pack/plugins/infra/public/components/lens/chart_placeholder.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 | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { EuiFlexGroup, EuiProgress, EuiFlexItem, EuiLoadingChart } from '@elastic/eui'; | ||
import { useEuiTheme } from '@elastic/eui'; | ||
import { css } from '@emotion/react'; | ||
|
||
export const ChartLoadingProgress = ({ hasTopMargin = false }: { hasTopMargin?: boolean }) => { | ||
const { euiTheme } = useEuiTheme(); | ||
return ( | ||
<EuiProgress | ||
size="xs" | ||
color="accent" | ||
position="absolute" | ||
css={css` | ||
top: ${hasTopMargin ? euiTheme.size.l : 0}; | ||
z-index: ${Number(euiTheme.levels.header) - 1}; | ||
`} | ||
/> | ||
); | ||
}; | ||
|
||
export const ChartPlaceholder = ({ style }: { style?: React.CSSProperties }) => { | ||
return ( | ||
<> | ||
<ChartLoadingProgress hasTopMargin={false} /> | ||
<EuiFlexGroup style={style} justifyContent="center" alignItems="center" responsive={false}> | ||
<EuiFlexItem grow={false}> | ||
<EuiLoadingChart mono size="l" /> | ||
</EuiFlexItem> | ||
</EuiFlexGroup> | ||
</> | ||
); | ||
}; |
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,12 @@ | ||
/* | ||
* 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; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
export { ChartPlaceholder } from './chart_placeholder'; | ||
export { LensWrapper } from './lens_wrapper'; | ||
|
||
export { TooltipContent } from './metric_explanation/tooltip_content'; | ||
export { HostMetricsDocsLink } from './metric_explanation/host_metrics_docs_link'; |
Oops, something went wrong.