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-497: "Are you sure" preview displays outdated values after User changed selection on bulk edit form and clicked "Confirm changes" #619

Merged
merged 4 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
* [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.
* [UIBULKED-497](https://folio-org.atlassian.net/browse/UIBULKED-497) "Are you sure" preview displays outdated values after User changed selection on bulk edit form and clicked "Confirm changes".

## [4.1.4](https://github.com/folio-org/ui-bulk-edit/tree/v4.1.4) (2024-05-29)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
max-width: 1024px;
}

.previewLoading {
UladzislauKutarkin marked this conversation as resolved.
Show resolved Hide resolved
display: flex;
justify-content: center;
align-items: center;
}

.previewModalFooter {
width: 100%;
display: flex;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
APPROACHES,
EDITING_STEPS,
FILE_KEYS,
JOB_STATUSES,
} from '../../../../constants';
import {
useBulkOperationStart,
Expand Down Expand Up @@ -74,8 +75,8 @@ export const BulkEditPreviewModal = ({
<BulkEditPreviewModalFooter
downloadLabel={downloadLabel}
bulkOperationId={bulkDetails?.id}
isCommitBtnDisabled={!hasLinkForDownload || isPreviewLoading}
isDownloadBtnDisabled={!hasLinkForDownload || isPreviewLoading}
isCommitBtnDisabled={!hasLinkForDownload || isPreviewLoading || bulkDetails?.status === JOB_STATUSES.DATA_MODIFICATION_IN_PROGRESS}
UladzislauKutarkin marked this conversation as resolved.
Show resolved Hide resolved
isDownloadBtnDisabled={!hasLinkForDownload || isPreviewLoading || bulkDetails?.status === JOB_STATUSES.DATA_MODIFICATION_IN_PROGRESS}
onSave={handleBulkOperationStart}
onDownload={onDownload}
onKeepEditing={onKeepEditing}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
} from 'react-intl';

import {
Loading,
MessageBanner,
MultiColumnList
} from '@folio/stripes/components';
Expand All @@ -21,6 +22,7 @@ import { usePagination } from '../../../../hooks/usePagination';
import {
CAPABILITIES,
EDITING_STEPS,
JOB_STATUSES,
PAGINATION_CONFIG
} from '../../../../constants';
import {
Expand Down Expand Up @@ -58,7 +60,7 @@ export const BulkEditPreviewModalList = ({
step: EDITING_STEPS.EDIT,
capabilities: currentRecordType,
queryOptions: {
enabled: isPreviewEnabled,
enabled: isPreviewEnabled && bulkDetails?.status !== JOB_STATUSES.DATA_MODIFICATION_IN_PROGRESS,
onError: () => {
callout({
type: 'error',
Expand Down Expand Up @@ -89,31 +91,41 @@ export const BulkEditPreviewModalList = ({
};

return (
<>
{renderMessageBanner()}
bulkDetails?.status !== JOB_STATUSES.DATA_MODIFICATION_IN_PROGRESS ?
(
<>
{renderMessageBanner()}

<strong className={css.previewModalSubtitle}><FormattedMessage id="ui-bulk-edit.previewModal.previewToBeChanged" /></strong>
<strong className={css.previewModalSubtitle}><FormattedMessage
id="ui-bulk-edit.previewModal.previewToBeChanged"
/>
</strong>

<MultiColumnList
striped
contentData={contentData}
columnMapping={columnMapping}
visibleColumns={visibleColumnKeys}
maxHeight={300}
columnIdPrefix="in-app"
columnWidths={PREVIEW_COLUMN_WIDTHS}
loading={isFetching}
/>
<MultiColumnList
striped
contentData={contentData}
columnMapping={columnMapping}
visibleColumns={visibleColumnKeys}
maxHeight={300}
columnIdPrefix="in-app"
columnWidths={PREVIEW_COLUMN_WIDTHS}
loading={isFetching}
/>

{contentData.length > 0 && (
<PrevNextPagination
{...pagination}
totalCount={bulkDetails?.processedNumOfRecords}
disabled={false}
onChange={changePage}
/>
)}
</>
{contentData.length > 0 && (
<PrevNextPagination
{...pagination}
totalCount={bulkDetails?.processedNumOfRecords}
disabled={false}
onChange={changePage}
/>
)}
</>
)
:
<div className={css.previewLoading}>
UladzislauKutarkin marked this conversation as resolved.
Show resolved Hide resolved
<Loading size="large" />
</div>
);
};

Expand Down
1 change: 1 addition & 0 deletions src/constants/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export const JOB_STATUSES = {
CANCELLED: 'CANCELLED',
SCHEDULED: 'SCHEDULED',
FAILED: 'FAILED',
DATA_MODIFICATION_IN_PROGRESS: 'DATA_MODIFICATION_IN_PROGRESS',
};

export const EDITING_STEPS = {
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useConfirmChanges.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const useConfirmChanges = ({
const [isPreviewModalOpened, setIsPreviewModalOpened] = useState(false);
const [isPreviewLoading, setIsPreviewLoading] = useState(false);

const { bulkDetails } = useBulkOperationDetails({ id: bulkOperationId });
const { bulkDetails } = useBulkOperationDetails({ id: bulkOperationId, interval: 1000 * 3 });
const { bulkOperationStart } = useBulkOperationStart();

const totalRecords = bulkDetails?.totalNumOfRecords;
Expand Down
Loading