-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Logs] Amend lazy imports in logs_shared plugin (#164102)
## Summary As part of #161151 a [selection of component imports were made lazy](https://github.com/elastic/kibana/blob/main/x-pack/plugins/logs_shared/public/index.ts#L52) and wrapped with a [`dynamic` wrapper component](https://github.com/elastic/kibana/blob/main/x-pack/plugins/logs_shared/common/dynamic.tsx#L22). Unfortunately some of these imports did not adhere to the rules of React's `lazy` imports (needing a `default` export, no named imports etc), and the `dynamic` wrapper seems to have suppressed error information that would have been available via using `lazy` directly. Only the anomaly and categories log entry examples (in the expanded rows) were affected by this, as the stream and embeddable import from locations that were backed by a `default` export (and those top level components don't import from that particular index file lower in the hierarchy). For imports that weren't backed by a `default` I've added them, and where necessary moved components to new files if needed (since it's one `default` per file). Also open to suggestions of ways we can alter the `<dynamic />` component and maintain the error safety 🤔 ## Examples Without these changes: ![Screenshot 2023-08-16 at 17 35 50](https://github.com/elastic/kibana/assets/471693/78aa0300-109e-40b5-b64f-6574a547cbf3) Warning using `lazy` directly without the `dynamic` wrapper: ![Screenshot 2023-08-16 at 17 36 27](https://github.com/elastic/kibana/assets/471693/a71e3c72-cf3a-4846-9ee9-df70c1729b03) ## Testing - Check all instances render correctly (stream, embeddable uses, and ML page log entry examples).
- Loading branch information
Showing
13 changed files
with
103 additions
and
55 deletions.
There are no files selected for viewing
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
30 changes: 30 additions & 0 deletions
30
.../plugins/logs_shared/public/components/logging/log_text_stream/column_headers_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,30 @@ | ||
/* | ||
* 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 { euiStyled } from '@kbn/kibana-react-plugin/common'; | ||
import { transparentize } from 'polished'; | ||
import { ASSUMED_SCROLLBAR_WIDTH } from './vertical_scroll_panel'; | ||
|
||
export const LogColumnHeadersWrapper = euiStyled.div.attrs((props) => ({ | ||
role: props.role ?? 'row', | ||
}))` | ||
align-items: stretch; | ||
display: flex; | ||
flex-direction: row; | ||
flex-wrap: nowrap; | ||
justify-content: flex-start; | ||
overflow: hidden; | ||
padding-right: ${ASSUMED_SCROLLBAR_WIDTH}px; | ||
border-bottom: ${(props) => props.theme.eui.euiBorderThin}; | ||
box-shadow: 0 2px 2px -1px ${(props) => | ||
transparentize(0.3, props.theme.eui.euiColorLightShade)}; | ||
position: relative; | ||
z-index: 1; | ||
`; | ||
|
||
// eslint-disable-next-line import/no-default-export | ||
export default LogColumnHeadersWrapper; |
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
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
37 changes: 37 additions & 0 deletions
37
...k/plugins/logs_shared/public/components/logging/log_text_stream/log_entry_row_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,37 @@ | ||
/* | ||
* 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 { euiStyled } from '@kbn/kibana-react-plugin/common'; | ||
import { TextScale } from '../../../../common/log_text_scale'; | ||
import { highlightedContentStyle, hoveredContentStyle, monospaceTextStyle } from './text_styles'; | ||
|
||
export const LogEntryRowWrapper = euiStyled.div.attrs(() => ({ | ||
role: 'row', | ||
}))<LogEntryRowWrapperProps>` | ||
align-items: stretch; | ||
color: ${(props) => props.theme.eui.euiTextColor}; | ||
display: flex; | ||
flex-direction: row; | ||
flex-wrap: nowrap; | ||
justify-content: flex-start; | ||
overflow: hidden; | ||
${(props) => monospaceTextStyle(props.scale)}; | ||
${(props) => (props.isHighlighted ? highlightedContentStyle : '')} | ||
&:hover { | ||
${hoveredContentStyle} | ||
} | ||
`; | ||
|
||
interface LogEntryRowWrapperProps { | ||
scale: TextScale; | ||
isHighlighted?: boolean; | ||
} | ||
|
||
// eslint-disable-next-line import/no-default-export | ||
export default LogEntryRowWrapper; |
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