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

UIEH-1420 Agreements accordion - Revise Are you sure you want to unassign agreement? message #1719

Merged
merged 1 commit into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change history for ui-eholdings

## [9.2.0] (IN PROGRESS)

* Agreements accordion - Revise Are you sure you want to unassign agreement? message. (UIEH-1420)

## [9.1.1] (https://github.com/folio-org/ui-eholdings/tree/v9.1.1) (2024-03-24)

* Add erm 7.0 interface support
Expand Down
2 changes: 1 addition & 1 deletion src/components/agreements-list/agreements-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ const AgreementsList = ({
name: ({ name }) => name,
actions: agreement => (
<Tooltip
text={<FormattedMessage id="ui-eholdings.agreements.unlink" />}
text={<FormattedMessage id="ui-eholdings.agreements.delete" />}
id={`unassign-agreement-${agreement.id}-tooltip`}
>
{({ ref, ariaIds }) => (
Expand Down
4 changes: 3 additions & 1 deletion src/components/route-history/route-history.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ const RouteHistoryContextProvider = ({ children }) => {
updateRouteHistory(routeHistory => {
const lastEholdingsPage = routeHistory.findIndex(page => page.pathname.startsWith('/eholdings'));

routeHistory[lastEholdingsPage].leavingEholdings = true;
if (lastEholdingsPage !== -1) {
routeHistory[lastEholdingsPage].leavingEholdings = true;
}

return routeHistory;
});
Expand Down
15 changes: 6 additions & 9 deletions src/features/agreements-accordion/agreements-accordion.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,32 +199,29 @@ const AgreementsAccordion = ({
<Modal
open={showModal}
size="small"
label={<FormattedMessage id="ui-eholdings.agreements.unassignModal.header" />}
id="unassign-agreement-confirmation-modal"
label={<FormattedMessage id="ui-eholdings.agreements.deleteModal.header" />}
id="delete-agreement-confirmation-modal"
footer={(
<ModalFooter>
<Button
data-test-eholdings-agreements-unassign-modal-yes
buttonStyle="primary"
buttonStyle="danger"
marginBottom0
onClick={handleUnassignConfirm}
>
<FormattedMessage id="ui-eholdings.agreements.unassignModal.unassign" />
<FormattedMessage id="ui-eholdings.agreements.deleteModal.delete" />
</Button>
<Button
data-test-eholdings-agreements-unassign-modal-no
marginBottom0
onClick={closeModal}
>
<FormattedMessage id="ui-eholdings.agreements.unassignModal.cancel" />
<FormattedMessage id="ui-eholdings.agreements.deleteModal.cancel" />
</Button>
</ModalFooter>
)}
>
<FormattedMessage
id="ui-eholdings.agreements.unassignModal.description"
id="ui-eholdings.agreements.deleteModal.description"
values={{
agreementName: currentAgreement.name,
recordName: refName,
}}
/>
Expand Down
10 changes: 5 additions & 5 deletions src/features/agreements-accordion/agreements-accordion.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,9 @@ describe('Given AgreementsAccordion', () => {
getByText,
} = renderAgreementsAccordion();

fireEvent.click(getAllByLabelText('ui-eholdings.agreements.unlink')[0]);
fireEvent.click(getAllByLabelText('ui-eholdings.agreements.delete')[0]);

expect(getByText('ui-eholdings.agreements.unassignModal.header')).toBeDefined();
expect(getByText('ui-eholdings.agreements.deleteModal.header')).toBeDefined();
});
});

Expand All @@ -133,11 +133,11 @@ describe('Given AgreementsAccordion', () => {
getByText,
} = renderAgreementsAccordion();

fireEvent.click(getAllByLabelText('ui-eholdings.agreements.unlink')[0]);
fireEvent.click(getByText('ui-eholdings.agreements.unassignModal.unassign'));
fireEvent.click(getAllByLabelText('ui-eholdings.agreements.delete')[0]);
fireEvent.click(getByText('ui-eholdings.agreements.deleteModal.delete'));

await waitFor(() => {
expect(queryByText('ui-eholdings.agreements.unassignModal.header')).toBeNull();
expect(queryByText('ui-eholdings.agreements.deleteModal.header')).toBeNull();
});
});
});
Expand Down
10 changes: 5 additions & 5 deletions translations/ui-eholdings/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
"shortcut.find": "Find",
"agreements": "Agreements",
"agreements.notFound": "No agreements found",
"agreements.unlink": "Unlink agreement from this record.",
"agreements.unassignModal.header": "Unassign an agreement from this record",
"agreements.unassignModal.description": "Are you sure you want to unassign <strong>{agreementName}</strong> from <strong>{recordName}</strong>? Once you unsassign, the agreement will no longer be attached to this record.",
"agreements.unassignModal.cancel": "Cancel",
"agreements.unassignModal.unassign": "Unassign",
"agreements.delete": "Delete agreement line",
"agreements.deleteModal.header": "Delete agreement line",
"agreements.deleteModal.description": "Are you sure you want to delete this agreement line: <strong>{recordName}</strong>?",
"agreements.deleteModal.cancel": "Cancel",
"agreements.deleteModal.delete": "Delete",
"usageConsolidation": "Usage & analysis",
"usageConsolidation.filters.year": "Year",
"usageConsolidation.filters.platformType": "Platform",
Expand Down
Loading