From 4ccf1aed96600382f2ba60bdf631a0d8c7f5e257 Mon Sep 17 00:00:00 2001 From: Davis Plumlee <56367316+dplumlee@users.noreply.github.com> Date: Mon, 20 Jul 2020 15:34:26 -0400 Subject: [PATCH] [Security Solution][Detections]Exceptions modal bugs (#72471) --- .../exceptions/add_exception_modal/index.tsx | 8 ++++++-- .../exceptions/edit_exception_modal/index.tsx | 10 ++++++++-- .../detections/components/alerts_table/index.tsx | 1 + 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/x-pack/plugins/security_solution/public/common/components/exceptions/add_exception_modal/index.tsx b/x-pack/plugins/security_solution/public/common/components/exceptions/add_exception_modal/index.tsx index 79383676266f5..53c53f48f076b 100644 --- a/x-pack/plugins/security_solution/public/common/components/exceptions/add_exception_modal/index.tsx +++ b/x-pack/plugins/security_solution/public/common/components/exceptions/add_exception_modal/index.tsx @@ -21,6 +21,7 @@ import { EuiCallOut, EuiText, } from '@elastic/eui'; +import { Status } from '../../../../../common/detection_engine/schemas/common/schemas'; import { alertsIndexPattern } from '../../../../../common/endpoint/constants'; import { ExceptionListItemSchema, @@ -67,6 +68,7 @@ interface AddExceptionModalProps { }; onCancel: () => void; onConfirm: (didCloseAlert: boolean) => void; + alertStatus?: Status; } const Modal = styled(EuiModal)` @@ -105,6 +107,7 @@ export const AddExceptionModal = memo(function AddExceptionModal({ alertData, onCancel, onConfirm, + alertStatus, }: AddExceptionModalProps) { const { http } = useKibana().services; const [comment, setComment] = useState(''); @@ -183,7 +186,8 @@ export const AddExceptionModal = memo(function AddExceptionModal({ if (indexPatternLoading === false && isSignalIndexLoading === false) { setShouldDisableBulkClose( entryHasListType(exceptionItemsToAdd) || - entryHasNonEcsType(exceptionItemsToAdd, indexPatterns) + entryHasNonEcsType(exceptionItemsToAdd, indexPatterns) || + exceptionItemsToAdd.length === 0 ); } }, [ @@ -335,7 +339,7 @@ export const AddExceptionModal = memo(function AddExceptionModal({ - {alertData !== undefined && ( + {alertData !== undefined && alertStatus !== 'closed' && ( - {!isSignalIndexLoading && ( + {(addExceptionIsLoading || indexPatternLoading || isSignalIndexLoading) && ( + + )} + + {!isSignalIndexLoading && !addExceptionIsLoading && !indexPatternLoading && ( <> {i18n.EXCEPTION_BUILDER_INFO} diff --git a/x-pack/plugins/security_solution/public/detections/components/alerts_table/index.tsx b/x-pack/plugins/security_solution/public/detections/components/alerts_table/index.tsx index 30cfe2d02354f..1d4c97d85443f 100644 --- a/x-pack/plugins/security_solution/public/detections/components/alerts_table/index.tsx +++ b/x-pack/plugins/security_solution/public/detections/components/alerts_table/index.tsx @@ -458,6 +458,7 @@ export const AlertsTableComponent: React.FC = ({ alertData={addExceptionModalState.alertData} onCancel={onAddExceptionCancel} onConfirm={onAddExceptionConfirm} + alertStatus={filterGroup} /> )}