Skip to content

Commit

Permalink
[Security Solution][Endpoint][Host Isolation] Removes empty comment b…
Browse files Browse the repository at this point in the history
…ox for host isolation (#105642)
  • Loading branch information
parkiino committed Jul 19, 2021
1 parent 4043375 commit 47c30c3
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@ 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';
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;
Expand Down Expand Up @@ -371,21 +371,13 @@ export const getActionAttachment = ({
isLoadingIds,
getCaseDetailHrefWithCommentId,
actionsNavigation,
manageMarkdownEditIds,
handleManageMarkdownEditId,
handleManageQuote,
handleSaveComment,
action,
}: {
comment: Comment & CommentRequestActionsType;
userCanCrud: boolean;
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: (
Expand All @@ -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}
Expand All @@ -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>
),
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
`}
`;

Expand Down Expand Up @@ -467,10 +475,6 @@ export const UserActionTree = React.memo(
isLoadingIds,
getCaseDetailHrefWithCommentId,
actionsNavigation,
manageMarkdownEditIds,
handleManageMarkdownEditId,
handleManageQuote,
handleSaveComment,
action,
}),
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}`};
`;

Expand Down

0 comments on commit 47c30c3

Please sign in to comment.