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.
[Security Solution][Notes] - add note block to alert defaitls flyout …
…header (elastic#193373)
- Loading branch information
1 parent
ef5aee1
commit 258adf5
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.