Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
vashjs committed Dec 23, 2024
1 parent b5381fc commit fd122a1
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ const renderErrorMessage = (error, isLinkAvailable) => {
);
};

const getResultsFormatter = ({ isLinkAvailable }) => ({
type: () => <FormattedMessage id="ui-bulk-edit.list.errors.table.status.ERROR" />,
key: error => getParam(error, ERROR_PARAMETERS_KEYS.IDENTIFIER),
message: error => renderErrorMessage(error, isLinkAvailable),
});

const ErrorsAccordion = ({
errors = [],
countOfErrors,
Expand All @@ -58,13 +64,7 @@ const ErrorsAccordion = ({
const isCentralTenant = tenantId === centralTenant;
const { capabilities } = useSearchParams();
const isLinkAvailable = (isCentralTenant && capabilities === CAPABILITIES.INSTANCE) || !isCentralTenant;

const resultsFormatter = {
type: () => <FormattedMessage id="ui-bulk-edit.list.errors.table.status.ERROR" />,
key: error => getParam(error, ERROR_PARAMETERS_KEYS.IDENTIFIER),
message: error => renderErrorMessage(error, isLinkAvailable),
};

const resultsFormatter = getResultsFormatter({ isLinkAvailable });
const errorLength = errors.length;

const [opened, setOpened] = useState(!!errorLength);
Expand Down

0 comments on commit fd122a1

Please sign in to comment.