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.
[Logs UI] Fix chart and table state loss due to loading indica… (elas…
…tic#49356) This changes the result loading indicators of the log rate analysis page such that they are rendered as an overlay to the existing panels. This has the advantage that the page layout doesn't jump during the loading process and the charts and table maintain their filter and expansion states.
- Loading branch information
1 parent
7f72b71
commit 68760bb
Showing
6 changed files
with
257 additions
and
237 deletions.
There are no files selected for viewing
45 changes: 45 additions & 0 deletions
45
x-pack/legacy/plugins/infra/public/components/loading_overlay_wrapper.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 { EuiLoadingSpinner } from '@elastic/eui'; | ||
import { transparentize } from 'polished'; | ||
import React from 'react'; | ||
|
||
import { euiStyled } from '../../../../common/eui_styled_components'; | ||
|
||
export const LoadingOverlayWrapper: React.FC< | ||
React.HTMLAttributes<HTMLDivElement> & { | ||
isLoading: boolean; | ||
loadingChildren?: React.ReactNode; | ||
} | ||
> = ({ children, isLoading, loadingChildren, ...rest }) => { | ||
return ( | ||
<RelativeDiv {...rest}> | ||
{children} | ||
{isLoading ? <Overlay>{loadingChildren}</Overlay> : null} | ||
</RelativeDiv> | ||
); | ||
}; | ||
|
||
const Overlay: React.FC = ({ children }) => ( | ||
<OverlayDiv>{children ? children : <EuiLoadingSpinner size="xl" />}</OverlayDiv> | ||
); | ||
|
||
const RelativeDiv = euiStyled.div` | ||
position: relative; | ||
`; | ||
|
||
const OverlayDiv = euiStyled.div` | ||
align-items: center; | ||
background-color: ${props => transparentize(0.3, props.theme.eui.euiColorEmptyShade)}; | ||
display: flex; | ||
height: 100%; | ||
justify-content: center; | ||
left: 0; | ||
position: absolute; | ||
top: 0; | ||
width: 100%; | ||
`; |
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
Oops, something went wrong.