-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[7.5] [Logs UI] Fix chart and table state loss due to loading… (#49606)
Backports the following commits to 7.5: - [Logs UI] Fix chart and table state loss due to loading indica… (#49356)
- Loading branch information
1 parent
7f72b71
commit b76f1a4
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.