[Security Solution][Exceptions] - Fix bug mislabeling edit/delete for endpoint exception items (#151532)

## Summary

Addresses https://github.com/elastic/kibana/issues/147607

Update text of edit/delete exception items to account for endpoint items
vs non-endpoint items.
This commit is contained in:
Yara Tercero 2023-02-22 10:51:30 -08:00 committed by GitHub
parent 7a7d28679b
commit 41ff95523e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 31 additions and 7 deletions

View file

@ -4,7 +4,7 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import React from 'react';
import React, { useMemo } from 'react';
import type { FC } from 'react';
import type {
ExceptionListItemIdentifiers,
@ -13,10 +13,8 @@ import type {
ViewerStatus,
} from '@kbn/securitysolution-exception-list-components';
import { ExceptionItems } from '@kbn/securitysolution-exception-list-components';
import type {
ExceptionListItemSchema,
ExceptionListTypeEnum,
} from '@kbn/securitysolution-io-ts-list-types';
import { ExceptionListTypeEnum } from '@kbn/securitysolution-io-ts-list-types';
import type { ExceptionListItemSchema } from '@kbn/securitysolution-io-ts-list-types';
import type { Pagination } from '@elastic/eui';
import { FormattedDate } from '../../../common/components/formatted_date';
@ -60,6 +58,18 @@ const ListExceptionItemsComponent: FC<ListExceptionItemsProps> = ({
onPaginationChange,
onCreateExceptionListItem,
}) => {
const editButtonText = useMemo(() => {
return listType === ExceptionListTypeEnum.ENDPOINT
? i18n.EXCEPTION_ITEM_CARD_EDIT_ENDPOINT_LABEL
: i18n.EXCEPTION_ITEM_CARD_EDIT_LABEL;
}, [listType]);
const deleteButtonText = useMemo(() => {
return listType === ExceptionListTypeEnum.ENDPOINT
? i18n.EXCEPTION_ITEM_CARD_DELETE_ENDPOINT_LABEL
: i18n.EXCEPTION_ITEM_CARD_DELETE_LABEL;
}, [listType]);
return (
<>
<ExceptionItems
@ -73,8 +83,8 @@ const ListExceptionItemsComponent: FC<ListExceptionItemsProps> = ({
emptyViewerButtonText={emptyViewerButtonText}
pagination={pagination}
lastUpdated={lastUpdated}
editActionLabel={i18n.EXCEPTION_ITEM_CARD_EDIT_LABEL}
deleteActionLabel={i18n.EXCEPTION_ITEM_CARD_DELETE_LABEL}
editActionLabel={editButtonText}
deleteActionLabel={deleteButtonText}
onPaginationChange={onPaginationChange}
onEditExceptionItem={onEditExceptionItem}
onDeleteException={onDeleteException}

View file

@ -12,6 +12,13 @@ export const EXCEPTION_ITEM_CARD_EDIT_LABEL = i18n.translate(
}
);
export const EXCEPTION_ITEM_CARD_EDIT_ENDPOINT_LABEL = i18n.translate(
'xpack.securitySolution.exceptions.list.exception.endpoint.item.card.edit.label',
{
defaultMessage: 'Edit endpoint exception',
}
);
export const EXCEPTION_ITEM_CARD_DELETE_LABEL = i18n.translate(
'xpack.securitySolution.exceptions.list.exception.item.card.delete.label',
{
@ -19,6 +26,13 @@ export const EXCEPTION_ITEM_CARD_DELETE_LABEL = i18n.translate(
}
);
export const EXCEPTION_ITEM_CARD_DELETE_ENDPOINT_LABEL = i18n.translate(
'xpack.securitySolution.exceptions.list.exception.endpoint.item.card.delete.label',
{
defaultMessage: 'Delete endpoint exception',
}
);
export const EXCEPTION_UTILITY_TITLE = i18n.translate(
'xpack.securitySolution.exceptions.list.utility.title',
{