Skip to content

Commit

Permalink
UIBULKED-556: ECS - remove link to affected record in Optimistic erro…
Browse files Browse the repository at this point in the history
…r for holdings and items.
  • Loading branch information
UladzislauKutarkin committed Oct 18, 2024
1 parent 710e38a commit 2264778
Showing 1 changed file with 21 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,26 @@ const columnMapping = {
message: <FormattedMessage id="ui-bulk-edit.list.errors.table.message" />,
};

const renderErrorMessage = (error, isLinkAvailable) => {
const link = getParam(error, ERROR_PARAMETERS_KEYS.LINK);

return (
<div>
{error.message}
{' '}
{!!link && isLinkAvailable && (
<span className={css.errorLink}>
<TextLink to={link} target="_blank">
<Icon icon="external-link" size="small" iconPosition="end">
<FormattedMessage id="ui-bulk-edit.list.errors.table.link" />
</Icon>
</TextLink>
</span>
)}
</div>
);
};

const ErrorsAccordion = ({
errors = [],
entries,
Expand All @@ -39,25 +59,7 @@ const ErrorsAccordion = ({

const resultsFormatter = {
key: error => getParam(error, ERROR_PARAMETERS_KEYS.IDENTIFIER),
message: error => {
const link = getParam(error, ERROR_PARAMETERS_KEYS.LINK);

return (
<div>
{error.message}
{' '}
{!!link && isLinkAvailable && (
<span className={css.errorLink}>
<TextLink to={link} target="_blank">
<Icon icon="external-link" size="small" iconPosition="end">
<FormattedMessage id="ui-bulk-edit.list.errors.table.link" />
</Icon>
</TextLink>
</span>
)}
</div>
);
},
message: error => renderErrorMessage(error, isLinkAvailable),
};

const location = useLocation();
Expand Down

0 comments on commit 2264778

Please sign in to comment.