Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UIBULKED-210: Improve user errors for invalid data - IncorrectTokenCo… #482

Merged
merged 8 commits into from
Feb 19, 2024
9 changes: 6 additions & 3 deletions src/components/ProgressBar/ProgressBar.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useContext, useEffect } from 'react';
import React, { useContext, useEffect } from 'react';
import { useParams } from 'react-router';
import { useLocation } from 'react-router-dom';
import { FormattedMessage, useIntl } from 'react-intl';
Expand All @@ -8,7 +8,7 @@
import { useShowCallout } from '@folio/stripes-acq-components';

import { useBulkOperationDetails } from '../../hooks/api';
import { JOB_STATUSES } from '../../constants';
import { ERRORS, JOB_STATUSES } from '../../constants';
import { getBulkOperationStep } from './utils';

import css from './ProgressBar.css';
Expand All @@ -33,14 +33,17 @@
});

const status = bulkDetails?.status;
const errorMessage = bulkDetails?.errorMessage;
const progressPercentage = bulkDetails
? (bulkDetails.processedNumOfRecords / bulkDetails.totalNumOfRecords) * 100
: 0;

const swwCallout = () => {
callout({
type: 'error',
message: intl.formatMessage({ id: 'ui-bulk-edit.error.sww' }),
message:errorMessage?.includes(ERRORS.TOKEN) ? <FormattedMessage id="ui-bulk-edit.error.incorrectFormatted" values={{ fileName:title }} />
UladzislauKutarkin marked this conversation as resolved.
Show resolved Hide resolved
:
intl.formatMessage({ id: 'ui-bulk-edit.error.sww' }),
});
};

Expand All @@ -55,7 +58,7 @@
swwCallout();
clearIntervalAndRedirect('/bulk-edit', '');
}
}, [status]);

Check warning on line 61 in src/components/ProgressBar/ProgressBar.js

View workflow job for this annotation

GitHub Actions / github-actions-ci

React Hook useEffect has missing dependencies: 'bulkDetails', 'clearIntervalAndRedirect', 'id', and 'swwCallout'. Either include them or remove the dependency array

Check warning on line 61 in src/components/ProgressBar/ProgressBar.js

View workflow job for this annotation

GitHub Actions / github-actions-ci

React Hook useEffect has missing dependencies: 'bulkDetails', 'clearIntervalAndRedirect', 'id', and 'swwCallout'. Either include them or remove the dependency array

return (
<div className={css.progressBar}>
Expand Down
Loading