Skip to content

Commit

Permalink
[Security Solution][Exceptions] - Fix bug mislabeling edit/delete for…
Browse files Browse the repository at this point in the history
… endpoint exception items (elastic#151532)

## Summary

Addresses elastic#147607

Update text of edit/delete exception items to account for endpoint items
vs non-endpoint items.

(cherry picked from commit 41ff955)
  • Loading branch information
yctercero committed Feb 22, 2023
1 parent 0c4ecdf commit 8c268ba
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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';
Expand Down Expand Up @@ -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
Expand All @@ -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}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,27 @@ 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',
{
defaultMessage: 'Delete rule exception',
}
);

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',
{
Expand Down

0 comments on commit 8c268ba

Please sign in to comment.