mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
[Security Solution] [Exceptions] Adds a modal to confirm deletion of exception list (#145034)
This commit is contained in:
parent
6c9cc6626b
commit
e27be55bae
3 changed files with 14 additions and 20 deletions
|
@ -32,6 +32,8 @@ export const exportExceptionList = () => {
|
|||
export const deleteExceptionListWithoutRuleReference = () => {
|
||||
cy.get(EXCEPTIONS_OVERFLOW_ACTIONS_BTN).first().click();
|
||||
cy.get(EXCEPTIONS_TABLE_DELETE_BTN).first().click();
|
||||
cy.get(EXCEPTIONS_TABLE_MODAL).should('exist');
|
||||
cy.get(EXCEPTIONS_TABLE_MODAL_CONFIRM_BTN).first().click();
|
||||
cy.get(EXCEPTIONS_TABLE_MODAL).should('not.exist');
|
||||
};
|
||||
|
||||
|
|
|
@ -129,20 +129,12 @@ export const SharedLists = React.memo(() => {
|
|||
({ id, listId, namespaceType }: { id: string; listId: string; namespaceType: NamespaceType }) =>
|
||||
async () => {
|
||||
try {
|
||||
if (exceptionsListsRef[id] != null && exceptionsListsRef[id].rules.length === 0) {
|
||||
await deleteExceptionList({
|
||||
id,
|
||||
namespaceType,
|
||||
onError: handleDeleteError,
|
||||
onSuccess: handleDeleteSuccess(listId),
|
||||
});
|
||||
|
||||
if (refreshExceptions != null) {
|
||||
refreshExceptions();
|
||||
}
|
||||
} else {
|
||||
if (exceptionsListsRef[id] != null) {
|
||||
setReferenceModalState({
|
||||
contentText: i18n.referenceErrorMessage(exceptionsListsRef[id].rules.length),
|
||||
contentText:
|
||||
exceptionsListsRef[id].rules.length > 0
|
||||
? i18n.referenceErrorMessage(exceptionsListsRef[id].rules.length)
|
||||
: i18n.defaultDeleteListMessage(exceptionsListsRef[id].name),
|
||||
rulesReferences: exceptionsListsRef[id].rules.map(({ name }) => name),
|
||||
isLoading: true,
|
||||
listId: id,
|
||||
|
@ -155,13 +147,7 @@ export const SharedLists = React.memo(() => {
|
|||
handleDeleteError(error);
|
||||
}
|
||||
},
|
||||
[
|
||||
deleteExceptionList,
|
||||
exceptionsListsRef,
|
||||
handleDeleteError,
|
||||
handleDeleteSuccess,
|
||||
refreshExceptions,
|
||||
]
|
||||
[exceptionsListsRef, handleDeleteError]
|
||||
);
|
||||
|
||||
const handleExportSuccess = useCallback(
|
||||
|
|
|
@ -133,6 +133,12 @@ export const REFERENCE_MODAL_TITLE = i18n.translate(
|
|||
}
|
||||
);
|
||||
|
||||
export const defaultDeleteListMessage = (listName: string) =>
|
||||
i18n.translate('xpack.securitySolution.exceptions.referenceModalDefaultDescription', {
|
||||
defaultMessage: 'Are you sure you wish to DELETE exception list with the name {listName}?',
|
||||
values: { listName },
|
||||
});
|
||||
|
||||
export const REFERENCE_MODAL_CANCEL_BUTTON = i18n.translate(
|
||||
'xpack.securitySolution.exceptions.referenceModalCancelButton',
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue