Skip to content

Commit

Permalink
Merge branch 'master' into UIREQMED-27
Browse files Browse the repository at this point in the history
  • Loading branch information
artem-blazhko committed Jul 8, 2024
2 parents 84a26bb + 66980c6 commit 7342761
Show file tree
Hide file tree
Showing 51 changed files with 897 additions and 144 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* Add caret to `react` peer dependency. Refs UIREQMED-23.
* Add Search field for Mediated requests activity page. Refs UIREQMED-3.
* Add Filters for Mediated requests actions page. Refs UIREQMED-4.
* Update permission for Mediated requests. Refs UIREQMED-29.
* Implement `Create mediated request` form with basic functionality. Refs UIREQMED-27.

## 1.0.0
Expand Down
43 changes: 36 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,31 +91,60 @@
"mod-settings.global.read.circulation",
"mod-settings.entries.collection.get",
"mod-settings.entries.item.get",
"settings.requests-mediated.enabled"
"settings.requests-mediated.enabled",

"circulation.items-by-instance.get",
"circulation.loans.collection.get",
"circulation.requests.collection.get",
"circulation.requests.item.get",
"circulation-storage.loans.collection.get",
"circulation-storage.loans.item.get",
"circulation-storage.requests.collection.get",
"circulation-storage.requests.item.get",
"users.collection.get",
"users.item.get",
"configuration.entries.collection.get"
],
"visible": true
},
{
"permissionName": "ui-requests-mediated.view-create",
"displayName": "Mediated requests: View, create",
"permissionName": "ui-requests-mediated.view-create-edit",
"displayName": "Mediated requests: View, create, edit",
"subPermissions": [
"ui-requests-mediated.view",

"circulation.requests.item.post",
"circulation.requests.item.put",
"circulation.requests.allowed-service-points.get",
"circulation-storage.requests.item.post",
"circulation-storage.requests.item.put",
"circulation-storage.requests.item.delete",
"circulation-storage.request-preferences.collection.get"
],
"visible": true
},
{
"permissionName": "ui-requests-mediated.view-decline",
"displayName": "Mediated requests: View, decline",
"subPermissions": [
"ui-requests-mediated.view"
],
"visible": true
},
{
"permissionName": "ui-requests-mediated.view-edit-cancel",
"displayName": "Mediated requests: View, edit, cancel",
"permissionName": "ui-requests-mediated.view-edit-decline",
"displayName": "Mediated requests: View, edit, decline",
"subPermissions": [
"ui-requests-mediated.view-create"
"ui-requests-mediated.view-decline"
],
"visible": true
},
{
"permissionName": "ui-requests-mediated.all",
"displayName": "Mediated requests: All permissions",
"subPermissions": [
"ui-requests-mediated.view-edit-cancel"
"ui-requests-mediated.view-create-edit",
"ui-requests-mediated.view-decline"
],
"visible": true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ describe('ItemsDialog', () => {
visibleColumns: COLUMN_NAMES,
columnMapping: COLUMN_MAP,
columnWidths: COLUMN_WIDTHS,
formatter: formatter,
formatter,
maxHeight: MAX_HEIGHT,
onRowClick: defaultProps.onRowClick,
interactive: true,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import PropTypes from 'prop-types';

import {
MediatedRequestLevelFilter,
MediatedRequestStatusFilter,
Expand All @@ -7,6 +9,7 @@ import {
import {
getIsTitleLevelRequestsFeatureEnabled,
} from '../../../../utils';
import MediatedRequestsSettings from "../../../../settings";

Check warning on line 12 in src/components/MediatedRequestsActivities/components/MediatedRequestsFilters/MediatedRequestsFilters.js

View workflow job for this annotation

GitHub Actions / build-npm

'MediatedRequestsSettings' is defined but never used. Allowed unused vars must match /React/u

Check failure on line 12 in src/components/MediatedRequestsActivities/components/MediatedRequestsFilters/MediatedRequestsFilters.js

View workflow job for this annotation

GitHub Actions / build-npm

Strings must use singlequote

Check warning on line 12 in src/components/MediatedRequestsActivities/components/MediatedRequestsFilters/MediatedRequestsFilters.js

View workflow job for this annotation

GitHub Actions / build-npm

'MediatedRequestsSettings' is defined but never used. Allowed unused vars must match /React/u

Check failure on line 12 in src/components/MediatedRequestsActivities/components/MediatedRequestsFilters/MediatedRequestsFilters.js

View workflow job for this annotation

GitHub Actions / build-npm

Strings must use singlequote

const MediatedRequestsFilters = ({ settings }) => {
const isTitleLevelRequestsFeatureEnabled = getIsTitleLevelRequestsFeatureEnabled(settings);
Expand All @@ -30,4 +33,8 @@ const MediatedRequestsFilters = ({ settings }) => {
);
};

MediatedRequestsFilters.propTypes = {
settings: PropTypes.object.isRequired,
};

export default MediatedRequestsFilters;
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ class RequestForm extends React.Component {
handleSubmit: PropTypes.func.isRequired,
findResource: PropTypes.func.isRequired,
request: PropTypes.object.isRequired,
settings: PropTypes.shape({
items: PropTypes.arrayOf(PropTypes.object),
}),
initialValues: PropTypes.object.isRequired,
location: PropTypes.shape({
search: PropTypes.string,
Expand All @@ -56,7 +59,7 @@ class RequestForm extends React.Component {
onSetSelectedInstance: PropTypes.func.isRequired,
pristine: PropTypes.bool,
submitting: PropTypes.bool,
patronGroups: PropTypes.arrayOf(PropTypes.object), // todo ddddd
patronGroups: PropTypes.arrayOf(PropTypes.object),
selectedItem: PropTypes.object,
selectedInstance: PropTypes.object,
selectedUser: PropTypes.object,
Expand All @@ -73,7 +76,7 @@ class RequestForm extends React.Component {
const {
request,
settings,
} = props;
} = props;
const { loan } = (request || {});
const { titleLevelRequestsFeatureEnabled } = getTlrSettings(settings?.items[0]?.value);

Expand All @@ -88,33 +91,6 @@ class RequestForm extends React.Component {
}

componentDidMount() {
const { location } = this.props;
const {
userId,
userBarcode,
itemBarcode,
itemId,
instanceId,
} = parse(location?.search);

if (userBarcode) {
this.findUser(RESOURCE_KEYS.BARCODE, userBarcode);
} else if (userId) {
this.findUser(RESOURCE_KEYS.ID, userId);
}

if (itemBarcode) {
this.findItem(RESOURCE_KEYS.BARCODE, itemBarcode);
}

if (itemId) {
this.findItem(RESOURCE_KEYS.ID, itemId);
}

if (instanceId && !itemBarcode && !itemId) {
this.findInstance(instanceId);
}

this.setTlrCheckboxInitialState();
}

Expand All @@ -124,29 +100,13 @@ class RequestForm extends React.Component {
request,
onSetSelectedItem,
onSetSelectedUser,
location,
settings,
} = this.props;
const {
initialValues: prevInitialValues,
request: prevRequest,
location: prevLocation,
settings: prevSettings,
} = prevProps;
const {
userId,
userBarcode,
itemBarcode,
itemId,
instanceId,
} = parse(location?.search);
const {
userId: prevUserId,
userBarcode: prevUserBarcode,
itemBarcode: prevItemBarcode,
itemId: prevItemId,
instanceId: prevInstanceId,
} = parse(prevLocation?.search);
const newSettings = settings?.items[0]?.value;

if (
Expand All @@ -160,27 +120,6 @@ class RequestForm extends React.Component {
this.setState({ selectedLoan: request.loan });
}

if (prevUserBarcode !== userBarcode) {
this.findUser(RESOURCE_KEYS.BARCODE, userBarcode);
}

if (prevUserId !== userId) {
this.findUser(RESOURCE_KEYS.ID, userId);
}

if (prevItemBarcode !== itemBarcode) {
this.findItem(RESOURCE_KEYS.BARCODE, itemBarcode);
}

if (prevItemId !== itemId) {
this.findItem(RESOURCE_KEYS.ID, itemId);
}

if (prevInstanceId !== instanceId) {
this.findInstance(instanceId);
this.setTlrCheckboxInitialState();
}

if (prevSettings?.items[0]?.value !== newSettings) {
const { titleLevelRequestsFeatureEnabled } = getTlrSettings(newSettings);

Expand Down Expand Up @@ -512,7 +451,7 @@ class RequestForm extends React.Component {
const { onCancel } = this.props;
const keepEditBtn = document.getElementById('clickable-cancel-editing-confirmation-confirm');

if (isItemsDialogOpen){
if (isItemsDialogOpen) {
handleKeyCommand(this.handleItemsDialogClose);
} else if (keepEditBtn) {
keepEditBtn.click();
Expand Down
Loading

0 comments on commit 7342761

Please sign in to comment.