From 9c27217697e367a6aad449430eb8ab9f0b3e1b0d Mon Sep 17 00:00:00 2001 From: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Date: Fri, 25 Aug 2023 16:53:20 -0400 Subject: [PATCH] [8.10] [Security Solution]Expandable flyout - Alert reason formatting fix (#164861) (#164888) # Backport This will backport the following commits from `main` to `8.10`: - [[Security Solution]Expandable flyout - Alert reason formatting fix (#164861)](https://github.com/elastic/kibana/pull/164861) ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) Co-authored-by: Jatin Kathuria --- .../components/alert_reason_preview.tsx | 33 +++++++++++++++---- 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/x-pack/plugins/security_solution/public/flyout/preview/components/alert_reason_preview.tsx b/x-pack/plugins/security_solution/public/flyout/preview/components/alert_reason_preview.tsx index 4fd912cbfbeec..d8791beb7bfd2 100644 --- a/x-pack/plugins/security_solution/public/flyout/preview/components/alert_reason_preview.tsx +++ b/x-pack/plugins/security_solution/public/flyout/preview/components/alert_reason_preview.tsx @@ -7,12 +7,21 @@ import React, { useMemo } from 'react'; import { EuiPanel, EuiSpacer, EuiTitle } from '@elastic/eui'; +import styled from '@emotion/styled'; +import { euiThemeVars } from '@kbn/ui-theme'; import { ALERT_REASON_TITLE } from './translations'; import { ALERT_REASON_PREVIEW_BODY_TEST_ID } from './test_ids'; import { usePreviewPanelContext } from '../context'; import { getRowRenderer } from '../../../timelines/components/timeline/body/renderers/get_row_renderer'; import { defaultRowRenderers } from '../../../timelines/components/timeline/body/renderers'; +const ReasonPreviewContainerWrapper = styled.div` + overflow-x: auto; + padding-block: ${euiThemeVars.euiSizeS}; +`; + +const ReasonPreviewContainer = styled.div``; + /** * Alert reason renderer on a preview panel on top of the right section of expandable flyout */ @@ -27,6 +36,19 @@ export const AlertReasonPreview: React.FC = () => { [dataAsNestedObject] ); + const rowRenderer = useMemo( + () => + renderer && dataAsNestedObject + ? renderer.renderRow({ + contextId: 'event-details', + data: dataAsNestedObject, + isDraggable: false, + scopeId: 'global', + }) + : null, + [renderer, dataAsNestedObject] + ); + if (!dataAsNestedObject || !renderer) { return null; } @@ -37,12 +59,11 @@ export const AlertReasonPreview: React.FC = () => {
{ALERT_REASON_TITLE}
- {renderer.renderRow({ - contextId: 'event-details', - data: dataAsNestedObject, - isDraggable: false, - scopeId: 'global', - })} + + + {rowRenderer} + + ); };