Skip to content

Commit

Permalink
UIBULKED-497: "Are you sure" preview displays outdated values after U…
Browse files Browse the repository at this point in the history
…ser changed selection on bulk edit form and clicked "Confirm changes"
  • Loading branch information
UladzislauKutarkin committed Oct 23, 2024
1 parent 2c74c98 commit cf68908
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 26 deletions.
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 {
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}
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}>
<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

0 comments on commit cf68908

Please sign in to comment.