diff --git a/CHANGELOG.md b/CHANGELOG.md index 841dc0db..0b8fc4fc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -64,6 +64,7 @@ * [UIBULKED-555](https://folio-org.atlassian.net/browse/UIBULKED-555)Rearrange item statuses order. * [UIBULKED-559](https://folio-org.atlassian.net/browse/UIBULKED-559) Update subfield validation in MARC form. * [UIBULKED-558](https://folio-org.atlassian.net/browse/UIBULKED-558) Add translation for new "Member" column. +* [UIBULKED-556](https://folio-org.atlassian.net/browse/UIBULKED-556) ECS - remove link to affected record in Optimistic error for holdings and items. ## [4.1.4](https://github.com/folio-org/ui-bulk-edit/tree/v4.1.4) (2024-05-29) diff --git a/src/components/BulkEditPane/BulkEditListResult/Preview/ErrorsAccordion/ErrorsAccordion.js b/src/components/BulkEditPane/BulkEditListResult/Preview/ErrorsAccordion/ErrorsAccordion.js index a2e7f29d..5f310dd1 100644 --- a/src/components/BulkEditPane/BulkEditListResult/Preview/ErrorsAccordion/ErrorsAccordion.js +++ b/src/components/BulkEditPane/BulkEditListResult/Preview/ErrorsAccordion/ErrorsAccordion.js @@ -9,37 +9,15 @@ import { Icon, TextLink, } from '@folio/stripes/components'; +import { useStripes } from '@folio/stripes/core'; import css from '../Preview.css'; import { useSearchParams } from '../../../../../hooks'; -import { CRITERIA, ERROR_PARAMETERS_KEYS } from '../../../../../constants'; +import { CAPABILITIES, CRITERIA, ERROR_PARAMETERS_KEYS } from '../../../../../constants'; const visibleColumns = ['key', 'message']; const getParam = (error, key) => error.parameters.find(param => param.key === key)?.value; -const resultsFormatter = { - key: error => getParam(error, ERROR_PARAMETERS_KEYS.IDENTIFIER), - message: error => { - const link = getParam(error, ERROR_PARAMETERS_KEYS.LINK); - - return ( -
- {error.message} - {' '} - {!!link && ( - - - - - - - - )} -
- ); - }, -}; - const columnMapping = { key: , message: , @@ -52,6 +30,36 @@ const ErrorsAccordion = ({ matched, isInitial, }) => { + const { user, okapi } = useStripes(); + const centralTenant = user?.user?.consortium?.centralTenantId; + const tenantId = okapi.tenant; + const isCentralTenant = tenantId === centralTenant; + const { capabilities } = useSearchParams(); + const isLinkAvailable = (isCentralTenant && capabilities === CAPABILITIES.INSTANCE) || !isCentralTenant; + + const resultsFormatter = { + key: error => getParam(error, ERROR_PARAMETERS_KEYS.IDENTIFIER), + message: error => { + const link = getParam(error, ERROR_PARAMETERS_KEYS.LINK); + + return ( +
+ {error.message} + {' '} + {!!link && isLinkAvailable && ( + + + + + + + + )} +
+ ); + }, + }; + const location = useLocation(); const { criteria } = useSearchParams(); const fileName = new URLSearchParams(location.search).get('fileName');