Skip to content

Commit

Permalink
Merge branch 'master' into UIREQMED-64
Browse files Browse the repository at this point in the history
  • Loading branch information
artem-blazhko committed Dec 4, 2024
2 parents 8f7f593 + c69ba12 commit 05bb5d5
Show file tree
Hide file tree
Showing 19 changed files with 37 additions and 26 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Change history for ui-requests-mediated

## [2.1.0] IN PROGRESS
## 2.1.0 (IN PROGRESS)
* Minor improvements and code fixes. Refs UIREQMED-65.
* Create a solution to not display "Are you sure?" modal when no changes have been made, increase code coverage. Refs UIREQMED-64.

## [2.0.0] (https://github.com/folio-org/ui-requests-mediated/tree/v2.0.0) (2024-11-30)
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@folio/requests-mediated",
"version": "2.0.0",
"version": "2.1.0",
"description": "Mediated requests",
"main": "src/index.js",
"repository": "folio-org/ui-requests-mediated",
Expand Down Expand Up @@ -77,7 +77,8 @@
"requests-mediated": "2.0",
"requests-mediated-actions": "1.0",
"request-preference-storage": "2.0",
"circulation": "14.2"
"circulation": "14.4",
"users": "16.3"
},
"permissionSets": [
{
Expand Down
6 changes: 3 additions & 3 deletions src/components/ConfirmItem/ConfirmItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import {
const ConfirmItem = ({
pristine,
paneTitle,
navigationMenuFunction,
navigationMenuUrl,
confirmItemType,
contentData,
handleSubmit,
Expand All @@ -52,7 +52,7 @@ const ConfirmItem = ({
defaultWidth={FILTER_PANE_WIDTH}
paneTitle={paneTitle}
>
<NavigationMenu value={navigationMenuFunction} />
<NavigationMenu value={navigationMenuUrl} />
</Pane>
<Pane
data-testid="confirmItemPane"
Expand Down Expand Up @@ -104,7 +104,7 @@ const ConfirmItem = ({
ConfirmItem.propTypes = {
pristine: PropTypes.bool,
paneTitle: PropTypes.node.isRequired,
navigationMenuFunction: PropTypes.func.isRequired,
navigationMenuUrl: PropTypes.string.isRequired,
confirmItemType: PropTypes.oneOf([CONFIRM_ITEM_TYPES.CONFIRM_ITEM_ARRIVAL, CONFIRM_ITEM_TYPES.SEND_ITEM_IN_TRANSIT]).isRequired,
contentData: PropTypes.arrayOf(PropTypes.object),
handleSubmit: PropTypes.func.isRequired,
Expand Down
4 changes: 2 additions & 2 deletions src/components/ConfirmItem/ConfirmItem.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const labelIds = {
const basicProps = {
pristine: false,
paneTitle: 'paneTitle',
navigationMenuFunction: jest.fn(),
navigationMenuUrl: 'confirmItem',
confirmItemType: CONFIRM_ITEM_TYPES.CONFIRM_ITEM_ARRIVAL,
contentData: [],
handleSubmit: jest.fn(),
Expand Down Expand Up @@ -77,7 +77,7 @@ describe('ConfirmItem', () => {

it('should render navigation menu with correct props', () => {
expect(NavigationMenu).toHaveBeenCalledWith(expect.objectContaining({
value: basicProps.navigationMenuFunction,
value: basicProps.navigationMenuUrl,
}), {});
});

Expand Down
2 changes: 1 addition & 1 deletion src/components/ConfirmItemArrival/ConfirmItemArrival.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const ConfirmItemArrival = () => {
<>
<ConfirmItem
paneTitle={intl.formatMessage({ id: 'ui-requests-mediated.confirmItemArrival.paneTitle' })}
navigationMenuFunction={getConfirmItemArrivalUrl()}
navigationMenuUrl={getConfirmItemArrivalUrl()}
confirmItemType={CONFIRM_ITEM_TYPES.CONFIRM_ITEM_ARRIVAL}
contentData={confirmItemArrivalData}
onSubmit={handleSubmit}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ describe('ConfirmItemArrival', () => {
it('should render ConfirmItem with correct props', () => {
expect(ConfirmItem).toHaveBeenCalledWith(expect.objectContaining({
paneTitle: messageIds.paneTitle,
navigationMenuFunction: getConfirmItemArrivalUrl(),
navigationMenuUrl: getConfirmItemArrivalUrl(),
confirmItemType: CONFIRM_ITEM_TYPES.CONFIRM_ITEM_ARRIVAL,
contentData: [],
onSubmit: expect.any(Function),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ MediatedRequestsFilters.propTypes = {
...MEDIATED_REQUEST_LEVEL_PROP_TYPES,
}).isRequired,
searchValue: PropTypes.shape({
query: PropTypes.string.isRequired,
query: PropTypes.string,
}).isRequired,
getSearchHandlers: PropTypes.func.isRequired,
resetAll: PropTypes.func.isRequired,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
import PropTypes from 'prop-types';
import {
FormattedMessage,
useIntl,
} from 'react-intl';
import {
isEmpty,
Expand All @@ -30,6 +31,7 @@ const Search = ({
resetAll,
activeFilters,
}) => {
const intl = useIntl();
const handleChange = useCallback((e) => {
if (e.target.value) {
getSearchHandlers().query(e);
Expand All @@ -47,6 +49,7 @@ const Search = ({
className={styles.searchFieldContainer}
>
<SearchField
aria-label={intl.formatMessage({ id: 'stripes-smart-components.search' })}
data-testid="mediatedRequestsActivitiesSearch"
autoFocus
autoComplete="off"
Expand Down Expand Up @@ -88,7 +91,7 @@ Search.propTypes = {
...MEDIATED_REQUEST_LEVEL_PROP_TYPES,
}).isRequired,
searchValue: PropTypes.shape({
query: PropTypes.string.isRequired,
query: PropTypes.string,
}).isRequired,
getSearchHandlers: PropTypes.func.isRequired,
resetAll: PropTypes.func.isRequired,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ const MediatedRequestsList = ({
};

MediatedRequestsList.propTypes = {
visibleColumns: PropTypes.object,
visibleColumns: PropTypes.arrayOf(PropTypes.string).isRequired,
contentData: PropTypes.arrayOf(PropTypes.object).isRequired,
source: PropTypes.shape({
totalCount: PropTypes.func,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,11 @@ class RequestForm extends React.Component {
this.setEditFormValue(MEDIATED_REQUEST_FORM_FIELD_NAMES.INSTANCE_HRID, request.instance.hrid);
} else if (request.item?.barcode) {
this.setEditFormValue(MEDIATED_REQUEST_FORM_FIELD_NAMES.ITEM_BARCODE, request.item.barcode);
this.setEditFormValue(MEDIATED_REQUEST_FORM_FIELD_NAMES.ITEM_ID, request.itemId);
}

this.setEditFormValue(MEDIATED_REQUEST_FORM_FIELD_NAMES.REQUESTER_BARCODE, request.requester?.barcode);
this.setEditFormValue(MEDIATED_REQUEST_FORM_FIELD_NAMES.REQUESTER_ID, request.requesterId);
this.setEditFormValue(MEDIATED_REQUEST_FORM_FIELD_NAMES.PATRON_COMMENTS, request.patronComments);

Promise.allSettled([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,10 @@ const RequestFormContainer = ({

RequestFormContainer.propTypes = {
settings: PropTypes.object.isRequired,
patronGroups: PropTypes.object.isRequired,
patronGroups: PropTypes.arrayOf(PropTypes.shape({
id: PropTypes.string,
group: PropTypes.string,
})).isRequired,
isEditMode: PropTypes.bool.isRequired,
setRequest: PropTypes.func,
request: PropTypes.object,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const UserHighlightBox = ({
};

UserHighlightBox.propTypes = {
title: PropTypes.string.isRequired,
title: PropTypes.node.isRequired,
name: PropTypes.string.isRequired,
id: PropTypes.string.isRequired,
barcode: PropTypes.string.isRequired,
Expand Down
1 change: 1 addition & 0 deletions src/components/NavigationMenu/NavigationMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ const NavigationMenu = ({
return (
<>
<Select
aria-label={intl.formatMessage({ id: 'ui-requests-mediated.app.filterPane.selectActivity' })}
data-testid="navigationMenu"
value={value}
disabled={isNavigationMenuDisabled(stripes)}
Expand Down
2 changes: 1 addition & 1 deletion src/components/SendItemInTransit/SendItemInTransit.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ const SendItemInTransit = () => {
<>
<ConfirmItem
paneTitle={intl.formatMessage({ id: 'ui-requests-mediated.sendItemInTransit.paneTitle' })}
navigationMenuFunction={getSendItemInTransitUrl()}
navigationMenuUrl={getSendItemInTransitUrl()}
confirmItemType={CONFIRM_ITEM_TYPES.SEND_ITEM_IN_TRANSIT}
contentData={sendItemInTransitData}
onSubmit={handleSubmit}
Expand Down
4 changes: 2 additions & 2 deletions src/components/SendItemInTransit/SendItemInTransit.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jest.mock('../ErrorModal', () => jest.fn(({
}) => {
return (
<button
role="button"
type="button"
data-testid={testIds.closeModalButton}
onClick={onClose}
>
Expand Down Expand Up @@ -86,7 +86,7 @@ describe('SendItemInTransit', () => {
it('should render ConfirmItem with correct props', () => {
expect(ConfirmItem).toHaveBeenCalledWith(expect.objectContaining({
paneTitle: messageIds.paneTitle,
navigationMenuFunction: getSendItemInTransitUrl(),
navigationMenuUrl: getSendItemInTransitUrl(),
confirmItemType: CONFIRM_ITEM_TYPES.SEND_ITEM_IN_TRANSIT,
contentData: [],
onSubmit: expect.any(Function),
Expand Down
4 changes: 2 additions & 2 deletions src/constants/mediatedRequestsActivities.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export const MEDIATED_REQUEST_STATUS_TRANSLATIONS = [
];

export const MEDIATED_REQUEST_STATUS_PROP_TYPES = {
[MEDIATED_REQUEST_FILTER_TYPES.MEDIATED_REQUEST_STATUS]: PropTypes.arrayOf(PropTypes.shape({
[MEDIATED_REQUEST_FILTER_TYPES.MEDIATED_REQUEST_STATUS]: PropTypes.arrayOf(PropTypes.oneOf({
[MEDIATED_REQUEST_STATUS.CLOSED_CANCELLED]: PropTypes.string,
[MEDIATED_REQUEST_STATUS.CLOSED_DECLINED]: PropTypes.string,
[MEDIATED_REQUEST_STATUS.CLOSED_FILLED]: PropTypes.string,
Expand All @@ -129,7 +129,7 @@ export const MEDIATED_REQUEST_LEVEL_TRANSLATIONS = [
];

export const MEDIATED_REQUEST_LEVEL_PROP_TYPES = {
[MEDIATED_REQUEST_FILTER_TYPES.MEDIATED_REQUEST_LEVELS]: PropTypes.arrayOf(PropTypes.shape({
[MEDIATED_REQUEST_FILTER_TYPES.MEDIATED_REQUEST_LEVELS]: PropTypes.oneOf(PropTypes.shape({
[MEDIATED_REQUEST_LEVEL.TITLE]: PropTypes.string,
[MEDIATED_REQUEST_LEVEL.ITEM]: PropTypes.string,
})),
Expand Down
2 changes: 1 addition & 1 deletion src/routes/MediatedRequestsActivitiesContainer.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ const props = {
resources,
mutator,
settings,
children: <div/>,
children: <div />,
};

describe('MediatedRequestsActivitiesContainer', () => {
Expand Down
4 changes: 2 additions & 2 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,8 @@ export const getDeliveryAddressForCsvRecords = (address) => {
return [addressLine1, city, region, postalCode, countryId].filter(Boolean).join(' ');
};

export const isProxyFunctionalityAvailable = () => IS_PROXY_AVAILABLE;

export const modifyRecordsToExport = (records) => {
return records.map(record => {
const {
Expand Down Expand Up @@ -516,5 +518,3 @@ export const convertToSlipData = (source, intl, timeZone, locale) => {

return slipData;
};

export const isProxyFunctionalityAvailable = () => IS_PROXY_AVAILABLE;
6 changes: 3 additions & 3 deletions translations/ui-requests-mediated/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"form.requester.inputLabel": "Requester barcode",
"form.requester.lookupLabel": "Znajdź rezerwującego",
"form.requesterLookup.name": "Requester name",
"form.requesterLookup.patronGroup": "Requester patron group",
"form.requesterLookup.patronGroup": "Grupa czytelnika rezerwującego",
"form.requesterLookup.username": "Nazwa użytkownika",
"form.requesterLookup.barcode": "Barcode",
"form.errors.selectInstance": "Please select an instance and hit enter",
Expand Down Expand Up @@ -56,7 +56,7 @@
"instanceDetails.publicationDate": "Publication date",
"instanceDetails.edition": "Edition",
"instanceDetails.identifiers": "ISBN(s)",
"requesterDetails.patronGroup": "Requester patron group",
"requesterDetails.patronGroup": "Grupa czytelnika rezerwującego",
"requesterDetails.barcode": "Barcode",
"item.status.agedToLost": "Aged to lost",
"item.status.available": "Available",
Expand Down Expand Up @@ -167,7 +167,7 @@
"report.item.copyNumber": "Item Copy",
"report.requester.name": "Requester name",
"report.requester.barcode": "Requester barcode",
"report.requester.patronGroup.group": "Requester patron group",
"report.requester.patronGroup.group": "Grupa czytelnika rezerwującego",
"report.fulfillmentPreference": "Request fulfillment preference",
"report.pickupServicePoint.name": "Pickup service point",
"report.deliveryAddress": "Delivery address",
Expand Down

0 comments on commit 05bb5d5

Please sign in to comment.