-
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.
[8.x] [Security Solution][Notes] - add note block to alert defaitls f…
…lyout header (#193373) (#193502) # Backport This will backport the following commits from `main` to `8.x`: - [[Security Solution][Notes] - add note block to alert defaitls flyout header (#193373)](#193373) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Philippe Oberti","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-09-20T00:39:28Z","message":"[Security Solution][Notes] - add note block to alert defaitls flyout header (#193373)","sha":"258adf533561b11d0cc0dae8c2fc2a1acc0d8e02","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","Team:Threat Hunting:Investigations","backport:prev-minor","v8.16.0"],"title":"[Security Solution][Notes] - add note block to alert defaitls flyout header","number":193373,"url":"https://github.com/elastic/kibana/pull/193373","mergeCommit":{"message":"[Security Solution][Notes] - add note block to alert defaitls flyout header (#193373)","sha":"258adf533561b11d0cc0dae8c2fc2a1acc0d8e02"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/193373","number":193373,"mergeCommit":{"message":"[Security Solution][Notes] - add note block to alert defaitls flyout header (#193373)","sha":"258adf533561b11d0cc0dae8c2fc2a1acc0d8e02"}},{"branch":"8.x","label":"v8.16.0","branchLabelMappingKey":"^v8.16.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Philippe Oberti <[email protected]>
- Loading branch information
1 parent
ab6d783
commit 808b48f
Showing
14 changed files
with
465 additions
and
101 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
...rity_solution/public/flyout/document_details/right/components/alert_header_block.test.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,27 @@ | ||
/* | ||
* 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 { render } from '@testing-library/react'; | ||
import { AlertHeaderBlock } from './alert_header_block'; | ||
|
||
const title = <div>{'title'}</div>; | ||
const children = <div data-test-subj={'CHILDREN_TEST_ID'}>{'children'}</div>; | ||
const dataTestSubj = 'TITLE_TEST_ID'; | ||
|
||
describe('<AlertHeaderBlock />', () => { | ||
it('should render component', () => { | ||
const { getByTestId } = render( | ||
<AlertHeaderBlock title={title} data-test-subj={dataTestSubj}> | ||
{children} | ||
</AlertHeaderBlock> | ||
); | ||
|
||
expect(getByTestId('TITLE_TEST_ID')).toHaveTextContent('title'); | ||
expect(getByTestId('CHILDREN_TEST_ID')).toBeInTheDocument(); | ||
}); | ||
}); |
45 changes: 45 additions & 0 deletions
45
.../security_solution/public/flyout/document_details/right/components/alert_header_block.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 | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import type { ReactElement, ReactNode, VFC } from 'react'; | ||
import React, { memo } from 'react'; | ||
import { EuiFlexGroup, EuiFlexItem, EuiPanel, EuiTitle } from '@elastic/eui'; | ||
|
||
export interface AlertHeaderBlockProps { | ||
/** | ||
* React component to render as the title | ||
*/ | ||
title: ReactElement; | ||
/** | ||
* React component to render as the value | ||
*/ | ||
children: ReactNode; | ||
/** | ||
* data-test-subj to use for the title | ||
*/ | ||
['data-test-subj']?: string; | ||
} | ||
|
||
/** | ||
* Reusable component for rendering a block with rounded edges, show a title and value below one another | ||
*/ | ||
export const AlertHeaderBlock: VFC<AlertHeaderBlockProps> = memo( | ||
({ title, children, 'data-test-subj': dataTestSubj }) => ( | ||
<EuiPanel hasShadow={false} hasBorder paddingSize="s"> | ||
<EuiFlexGroup direction="column" gutterSize="xs" responsive={false}> | ||
<EuiFlexItem grow={false}> | ||
<EuiTitle size="xxs" data-test-subj={dataTestSubj}> | ||
<h3>{title}</h3> | ||
</EuiTitle> | ||
</EuiFlexItem> | ||
<EuiFlexItem grow={false}>{children}</EuiFlexItem> | ||
</EuiFlexGroup> | ||
</EuiPanel> | ||
) | ||
); | ||
|
||
AlertHeaderBlock.displayName = 'AlertHeaderBlock'; |
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
Oops, something went wrong.