Skip to content

Commit

Permalink
[Security Solution][Detections]Exceptions modal bugs (#72471)
Browse files Browse the repository at this point in the history
  • Loading branch information
dplumlee committed Jul 20, 2020
1 parent 0f964f6 commit 4ccf1ae
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -67,6 +68,7 @@ interface AddExceptionModalProps {
};
onCancel: () => void;
onConfirm: (didCloseAlert: boolean) => void;
alertStatus?: Status;
}

const Modal = styled(EuiModal)`
Expand Down Expand Up @@ -105,6 +107,7 @@ export const AddExceptionModal = memo(function AddExceptionModal({
alertData,
onCancel,
onConfirm,
alertStatus,
}: AddExceptionModalProps) {
const { http } = useKibana().services;
const [comment, setComment] = useState('');
Expand Down Expand Up @@ -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
);
}
}, [
Expand Down Expand Up @@ -335,7 +339,7 @@ export const AddExceptionModal = memo(function AddExceptionModal({
</ModalBodySection>
<EuiHorizontalRule />
<ModalBodySection>
{alertData !== undefined && (
{alertData !== undefined && alertStatus !== 'closed' && (
<EuiFormRow fullWidth>
<EuiCheckbox
id="close-alert-on-add-add-exception-checkbox"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import {
entryHasListType,
entryHasNonEcsType,
} from '../helpers';
import { Loader } from '../../loader';

interface EditExceptionModalProps {
ruleName: string;
Expand Down Expand Up @@ -124,7 +125,8 @@ export const EditExceptionModal = memo(function EditExceptionModal({
if (indexPatternLoading === false && isSignalIndexLoading === false) {
setShouldDisableBulkClose(
entryHasListType(exceptionItemsToAdd) ||
entryHasNonEcsType(exceptionItemsToAdd, indexPatterns)
entryHasNonEcsType(exceptionItemsToAdd, indexPatterns) ||
exceptionItemsToAdd.length === 0
);
}
}, [
Expand Down Expand Up @@ -204,7 +206,11 @@ export const EditExceptionModal = memo(function EditExceptionModal({
</ModalHeaderSubtitle>
</ModalHeader>

{!isSignalIndexLoading && (
{(addExceptionIsLoading || indexPatternLoading || isSignalIndexLoading) && (
<Loader data-test-subj="loadingEditExceptionModal" size="xl" />
)}

{!isSignalIndexLoading && !addExceptionIsLoading && !indexPatternLoading && (
<>
<ModalBodySection className="builder-section">
<EuiText>{i18n.EXCEPTION_BUILDER_INFO}</EuiText>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,7 @@ export const AlertsTableComponent: React.FC<AlertsTableComponentProps> = ({
alertData={addExceptionModalState.alertData}
onCancel={onAddExceptionCancel}
onConfirm={onAddExceptionConfirm}
alertStatus={filterGroup}
/>
)}
</>
Expand Down

0 comments on commit 4ccf1ae

Please sign in to comment.