mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
[Security Solution] Fix whitespace/newlines for exception comments (#208959)
## Summary Fixes https://github.com/elastic/kibana/issues/208956 ## Before  ## After 
This commit is contained in:
parent
bfa945a0ea
commit
1b8bdcff67
2 changed files with 22 additions and 2 deletions
|
@ -12,6 +12,8 @@ import { capitalize, get, omit } from 'lodash';
|
|||
import type { Moment } from 'moment';
|
||||
import moment from 'moment';
|
||||
|
||||
import { css } from '@emotion/react';
|
||||
|
||||
import type {
|
||||
CommentsArray,
|
||||
Comment,
|
||||
|
@ -74,6 +76,10 @@ export const formatOperatingSystems = (osTypes: string[]): string => {
|
|||
.join(', ');
|
||||
};
|
||||
|
||||
const commentCss = css`
|
||||
white-space: pre-wrap;
|
||||
`;
|
||||
|
||||
/**
|
||||
* Formats ExceptionItem.comments into EuiCommentList format
|
||||
*
|
||||
|
@ -85,7 +91,11 @@ export const getFormattedComments = (comments: CommentsArray): EuiCommentProps[]
|
|||
timestamp: moment(commentItem.created_at).format('on MMM Do YYYY @ HH:mm:ss'),
|
||||
event: i18n.COMMENT_EVENT,
|
||||
timelineAvatar: <EuiAvatar size="l" name={commentItem.created_by.toUpperCase()} />,
|
||||
children: <EuiText size="s">{commentItem.comment}</EuiText>,
|
||||
children: (
|
||||
<EuiText size="s" css={commentCss}>
|
||||
{commentItem.comment}
|
||||
</EuiText>
|
||||
),
|
||||
actions: (
|
||||
<WithCopyToClipboard
|
||||
data-test-subj="copy-to-clipboard"
|
||||
|
|
|
@ -11,10 +11,16 @@ import { EuiText, EuiAvatar } from '@elastic/eui';
|
|||
|
||||
import type { CommentsArray } from '@kbn/securitysolution-io-ts-list-types';
|
||||
|
||||
import { css } from '@emotion/react';
|
||||
|
||||
import moment from 'moment';
|
||||
import * as i18n from './translations';
|
||||
import { WithCopyToClipboard } from '../../common/lib/clipboard/with_copy_to_clipboard';
|
||||
|
||||
const commentCss = css`
|
||||
white-space: pre-wrap;
|
||||
`;
|
||||
|
||||
/**
|
||||
* Formats ExceptionItem.comments into EuiCommentList format
|
||||
*
|
||||
|
@ -26,7 +32,11 @@ export const getFormattedComments = (comments: CommentsArray): EuiCommentProps[]
|
|||
timestamp: moment(commentItem.created_at).format('on MMM Do YYYY @ HH:mm:ss'),
|
||||
event: i18n.COMMENT_EVENT,
|
||||
timelineAvatar: <EuiAvatar size="l" name={commentItem.created_by.toUpperCase()} />,
|
||||
children: <EuiText size="s">{commentItem.comment}</EuiText>,
|
||||
children: (
|
||||
<EuiText size="s" css={commentCss}>
|
||||
{commentItem.comment}
|
||||
</EuiText>
|
||||
),
|
||||
actions: (
|
||||
<WithCopyToClipboard
|
||||
data-test-subj="copy-to-clipboard"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue