[Security Solution][Endpoint][Host Isolation] Removes empty comment box for host isolation (#105642)

This commit is contained in:
Candace Park 2021-07-19 12:13:56 -04:00 committed by GitHub
parent 404337514e
commit 47c30c35cd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 38 deletions

View file

@ -22,9 +22,8 @@ import { parseString } from '../../containers/utils';
import { Tags } from '../tag_list/tags';
import { UserActionUsernameWithAvatar } from './user_action_username_with_avatar';
import { UserActionTimestamp } from './user_action_timestamp';
import { UserActionContentToolbar } from './user_action_content_toolbar';
import { UserActionCopyLink } from './user_action_copy_link';
import { UserActionMarkdown } from './user_action_markdown';
import { ContentWrapper } from './user_action_markdown';
import { UserActionMoveToReference } from './user_action_move_to_reference';
import { Status, statuses } from '../status';
import { UserActionShowAlert } from './user_action_show_alert';
@ -32,6 +31,7 @@ import * as i18n from './translations';
import { AlertCommentEvent } from './user_action_alert_comment_event';
import { CasesNavigation } from '../links';
import { HostIsolationCommentEvent } from './user_action_host_isolation_comment_event';
import { MarkdownRenderer } from '../markdown_editor';
interface LabelTitle {
action: CaseUserActions;
@ -371,10 +371,6 @@ export const getActionAttachment = ({
isLoadingIds,
getCaseDetailHrefWithCommentId,
actionsNavigation,
manageMarkdownEditIds,
handleManageMarkdownEditId,
handleManageQuote,
handleSaveComment,
action,
}: {
comment: Comment & CommentRequestActionsType;
@ -382,10 +378,6 @@ export const getActionAttachment = ({
isLoadingIds: string[];
getCaseDetailHrefWithCommentId: (commentId: string) => string;
actionsNavigation?: ActionsNavigation;
manageMarkdownEditIds: string[];
handleManageMarkdownEditId: (id: string) => void;
handleManageQuote: (id: string) => void;
handleSaveComment: ({ id, version }: { id: string; version: string }, content: string) => void;
action: CaseUserActions;
}): EuiCommentProps => ({
username: (
@ -394,9 +386,7 @@ export const getActionAttachment = ({
fullName={comment.createdBy.fullName}
/>
),
className: classNames({
isEdit: manageMarkdownEditIds.includes(comment.id),
}),
className: classNames('comment-action', { 'empty-comment': comment.comment.trim().length === 0 }),
event: (
<HostIsolationCommentEvent
type={comment.actions.type}
@ -409,28 +399,15 @@ export const getActionAttachment = ({
timestamp: <UserActionTimestamp createdAt={action.actionAt} />,
timelineIcon: comment.actions.type === 'isolate' ? 'lock' : 'lockOpen',
actions: (
<UserActionContentToolbar
getCaseDetailHrefWithCommentId={getCaseDetailHrefWithCommentId}
<UserActionCopyLink
id={comment.id}
editLabel={i18n.EDIT_COMMENT}
quoteLabel={i18n.QUOTE}
userCanCrud={userCanCrud}
isLoading={isLoadingIds.includes(comment.id)}
onEdit={handleManageMarkdownEditId.bind(null, comment.id)}
onQuote={handleManageQuote.bind(null, comment.comment)}
getCaseDetailHrefWithCommentId={getCaseDetailHrefWithCommentId}
/>
),
children: (
<UserActionMarkdown
id={comment.id}
content={comment.comment}
isEditable={manageMarkdownEditIds.includes(comment.id)}
onChangeEditable={handleManageMarkdownEditId}
onSaveContent={handleSaveComment.bind(null, {
id: comment.id,
version: comment.version,
})}
/>
children: comment.comment.trim().length > 0 && (
<ContentWrapper data-test-subj="user-action-markdown">
<MarkdownRenderer>{comment.comment}</MarkdownRenderer>
</ContentWrapper>
),
});

View file

@ -107,13 +107,21 @@ const MyEuiCommentList = styled(EuiCommentList)`
& .comment-alert .euiCommentEvent {
background-color: ${theme.eui.euiColorLightestShade};
border: ${theme.eui.euiFlyoutBorder};
padding: 10px;
padding: ${theme.eui.paddingSizes.s};
border-radius: ${theme.eui.paddingSizes.xs};
}
& .comment-alert .euiCommentEvent__headerData {
flex-grow: 1;
}
& .comment-action.empty-comment .euiCommentEvent--regular {
box-shadow: none;
.euiCommentEvent__header {
padding: ${theme.eui.euiSizeM} ${theme.eui.paddingSizes.s};
border-bottom: 0;
}
}
`}
`;
@ -467,10 +475,6 @@ export const UserActionTree = React.memo(
isLoadingIds,
getCaseDetailHrefWithCommentId,
actionsNavigation,
manageMarkdownEditIds,
handleManageMarkdownEditId,
handleManageQuote,
handleSaveComment,
action,
}),
]

View file

@ -14,7 +14,7 @@ import { Form, useForm, UseField } from '../../common/shared_imports';
import { schema, Content } from './schema';
import { MarkdownRenderer, MarkdownEditorForm } from '../markdown_editor';
const ContentWrapper = styled.div`
export const ContentWrapper = styled.div`
padding: ${({ theme }) => `${theme.eui.euiSizeM} ${theme.eui.euiSizeL}`};
`;