Skip to content

Commit

Permalink
Merge branch 'master' into UIREQ-1190
Browse files Browse the repository at this point in the history
  • Loading branch information
Terala-Priyanka committed Dec 4, 2024
2 parents f24ebbd + 7edd21a commit 4170c4d
Show file tree
Hide file tree
Showing 60 changed files with 13,318 additions and 401 deletions.
38 changes: 37 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,45 @@
# Change history for ui-requests

## 11.0.0 IN PROGRESS
## [11.1.0] IN PROGRESS

* Migrate from `mod-circulation` to `mod-circulation-bff` for `Print pick slips` and `Print search slips`. Refs UIREQ-1154.

## [11.0.1] (https://github.com/folio-org/ui-requests/tree/v11.0.1) (2024-12-02)
[Full Changelog](https://github.com/folio-org/ui-requests/compare/v11.0.0...v11.0.1)

* Remove "circulation-bff-requests" okapi interface. Refs UIREQ-1203.

## [11.0.0] (https://github.com/folio-org/ui-requests/tree/v11.0.0) (2024-11-30)
[Full Changelog](https://github.com/folio-org/ui-requests/compare/v10.0.2...v11.0.0)

* Consistency update permission after change them in mod-circulation. Refs UIREQ-1194.
* Use settings/entries endpoint to get settings information. Refs UIREQ-1062.
* Requests app.: Editing requests (ECS with mod-tlr enabled). Refs UIREQ-1088.
* Requests app.: Cancelling request (ECS with mod-tlr enabled). Refs UIREQ-1090.
* Requests app.: Reorder request queue (ECS with mod-tlr enabled). Refs UIREQ-1098.
* Requests app.: Moving request (ECS with mod-tlr enabled). Refs UIREQ-1100.
* Hide Action menu on secondary requests (ECS + mod-tlr). Refs UIREQ-1105.
* *BREAKING* Use `circulation/items-by-instance` endpoint to get item and instance information. Refs UIREQ-1091.
* Hide Duplicate and Move action buttons in ECS env with mod-tlr enabled. Refs UIREQ-1127, UIREQ-1125.
* Update permissions set to be able to get item/instance information. Refs UIREQ-1148.
* *BREAKING* Migrate to new endpoints to get request types and to create a new request. Refs UIREQ-1113.
* Use `instanceId` param for ILR from items response. Refs UIREQ-1149.
* Send `holdingsRecordId` param for Item level requests. Refs UIREQ-1167.
* Add `tlr.settings.get` permission. Refs UIREQ-1169.
* Add `mod-settings.global.read.circulation` permission. Refs UIREQ-1170.
* Add `mod-settings.entries.collection.get` permission. Refs UIREQ-1177.
* *BREAKING* Migrate to new `mod-circulation-bff` endpoints. Refs UIREQ-1134.
* Implement feature toggle for ECS and not ECS envs. Refs UIREQ-1171.
* Hide proxy functionality for ECS with mod-tlr enabled. Refs UIREQ-1185.
* Update permission after mod-patron-blocks permission changes. Refs UIREQ-1201.

## [10.0.2] (https://github.com/folio-org/ui-requests/tree/v10.0.2) (2024-11-22)
[Full Changelog](https://github.com/folio-org/ui-requests/compare/v10.0.1...v10.0.2)
* Update permission checks of ui-users. Refs UIREQ-1187.

## [10.0.1] (https://github.com/folio-org/ui-requests/tree/v10.0.1) (2024-11-13)
[Full Changelog](https://github.com/folio-org/ui-requests/compare/v10.0.0...v10.0.1)

* Fix DOMPurify import. Refs UIREQ-1180.

## [10.0.0] (https://github.com/folio-org/ui-requests/tree/v10.0.0) (2024-10-31)
Expand Down
33 changes: 24 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@folio/requests",
"version": "11.0.0",
"version": "11.1.0",
"description": "Requests manager",
"repository": "folio-org/ui-requests",
"publishConfig": {
Expand Down Expand Up @@ -55,9 +55,12 @@
"replaces": ["ui-requests.reorderQueue"],
"visible": true,
"subPermissions": [
"circulation.requests.queue.collection.get",
"circulation.requests.queue.reorder.collection.post",
"circulation.requests.queue-item.collection.get",
"circulation.requests.queue-instance.collection.get",
"circulation.requests.queue.item-reorder.collection.post",
"circulation.requests.queue.instance-reorder.collection.post",
"circulation.requests.allowed-service-points.get",
"circulation-bff.requests.allowed-service-points.get",
"circulation.rules.request-policy.get"
]
},
Expand All @@ -80,7 +83,6 @@
"subPermissions": [
"module.requests.enabled",
"circulation.loans.collection.get",
"circulation.settings.collection.get",
"circulation.settings.item.get",
"circulation.requests.collection.get",
"circulation.requests.item.get",
Expand Down Expand Up @@ -108,7 +110,11 @@
"inventory-storage.instances.item.get",
"inventory-storage.instances.collection.get",
"manualblocks.collection.get",
"circulation.requests.hold-shelf-clearance-report.get"
"circulation.requests.hold-shelf-clearance-report.get",
"circulation.settings.collection.get",
"tlr.settings.get",
"mod-settings.global.read.circulation",
"mod-settings.entries.collection.get"
],
"visible": true
},
Expand All @@ -118,15 +124,21 @@
"subPermissions": [
"ui-requests.view",
"automated-patron-blocks.collection.get",
"patron-blocks.automated-patron-blocks.collection.get",
"circulation.requests.item.post",
"circulation.requests.allowed-service-points.get",
"circulation-bff.requests.allowed-service-points.get",
"circulation-storage.requests.item.post",
"circulation-storage.request-preferences.collection.get",
"circulation-storage.staff-slips.collection.get",
"circulation.pick-slips.get",
"circulation.search-slips.get",
"circulation-bff.pick-slips.collection.get",
"circulation-bff.search-slips.collection.get",
"circulation.print-events-entry.item.post",
"inventory-storage.locations.item.get"
"inventory-storage.locations.item.get",
"circulation-bff.requests.search-instances.get",
"circulation-bff.requests.post"
],
"visible": true
},
Expand All @@ -137,8 +149,11 @@
"ui-requests.view",
"circulation.pick-slips.get",
"circulation.search-slips.get",
"circulation-bff.pick-slips.collection.get",
"circulation-bff.search-slips.collection.get",
"circulation.requests.item.put",
"circulation.requests.allowed-service-points.get",
"circulation-bff.requests.allowed-service-points.get",
"circulation.print-events-entry.item.post",
"circulation-storage.staff-slips.collection.get",
"circulation-storage.requests.collection.delete",
Expand Down Expand Up @@ -169,10 +184,10 @@
"@babel/plugin-transform-runtime": "^7.13.10",
"@folio/eslint-config-stripes": "^7.0.0",
"@folio/jest-config-stripes": "^2.0.0",
"@folio/stripes": "^9.0.0",
"@folio/stripes": "^9.2.5",
"@folio/stripes-cli": "^3.0.0",
"@folio/stripes-components": "^12.0.0",
"@folio/stripes-core": "^10.0.0",
"@folio/stripes-core": "^10.2.3",
"@folio/stripes-testing": "^4.4.0",
"@formatjs/cli": "^6.1.3",
"core-js": "^3.6.4",
Expand Down Expand Up @@ -202,7 +217,7 @@
"react-to-print": "^2.9.0"
},
"peerDependencies": {
"@folio/stripes": "^9.0.0",
"@folio/stripes": "^9.2.5",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-intl": "^6.4.4",
Expand Down
1 change: 1 addition & 0 deletions src/ItemDetail.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import ItemDetail from './ItemDetail';
import { INVALID_REQUEST_HARDCODED_ID } from './constants';

jest.mock('react-router-dom', () => ({
...jest.requireActual('react-router-dom'),
Link: jest.fn(({ to, children }) => <a href={to}>{children}</a>),
}));

Expand Down
45 changes: 11 additions & 34 deletions src/ItemsDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,28 +86,17 @@ const ItemsDialog = ({
const [items, setItems] = useState([]);
const { formatMessage } = useIntl();

const fetchHoldings = () => {
const query = `instanceId==${instanceId}`;
mutator.holdings.reset();
const fetchItems = () => {
const query = `id==${instanceId}`;

return mutator.holdings.GET({ params: { query, limit: MAX_RECORDS } });
};

const fetchItems = async (holdings) => {
const chunkedItems = chunk(holdings, CHUNK_SIZE);
const data = [];

for (const itemChunk of chunkedItems) {
const query = itemChunk.map(i => `holdingsRecordId==${i.id}`).join(' or ');

mutator.items.reset();
// eslint-disable-next-line no-await-in-loop
const result = await mutator.items.GET({ params: { query, limit: MAX_RECORDS } });

data.push(...result);
}
mutator.items.reset();

return data;
return mutator.items.GET({
params: {
query,
limit: MAX_RECORDS,
},
});
};

const fetchRequests = async (itemsList) => {
Expand Down Expand Up @@ -136,8 +125,7 @@ const ItemsDialog = ({
const getItems = async () => {
setAreItemsBeingLoaded(true);

const holdings = await fetchHoldings();
let itemsList = await fetchItems(holdings);
let itemsList = await fetchItems();

if (skippedItemId) {
itemsList = itemsList.filter(item => requestableItemStatuses.includes(item.status?.name));
Expand Down Expand Up @@ -229,17 +217,10 @@ const ItemsDialog = ({
};

ItemsDialog.manifest = {
holdings: {
type: 'okapi',
records: 'holdingsRecords',
path: 'holdings-storage/holdings',
accumulate: true,
fetch: false,
},
items: {
type: 'okapi',
records: 'items',
path: 'inventory/items',
path: 'circulation-bff/requests/search-instances',
accumulate: true,
fetch: false,
},
Expand All @@ -265,10 +246,6 @@ ItemsDialog.propTypes = {
skippedItemId: PropTypes.string,
onRowClick: PropTypes.func,
mutator: PropTypes.shape({
holdings: PropTypes.shape({
GET: PropTypes.func.isRequired,
reset: PropTypes.func.isRequired,
}).isRequired,
items: PropTypes.shape({
GET: PropTypes.func.isRequired,
reset: PropTypes.func.isRequired,
Expand Down
17 changes: 0 additions & 17 deletions src/ItemsDialog.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,6 @@ describe('ItemsDialog', () => {
const testTitle = 'testTitle';
const testInstanceId = 'testInstanceId';
const testMutator = {
holdings: {
GET: jest.fn(() => (new Promise((resolve) => {
setTimeout(() => {
resolve(
[{
id: '1',
}, {
id: '2',
}]
);
});
}))),
reset: jest.fn(),
},
items: {
GET: jest.fn(() => (new Promise((resolve) => {
setTimeout(() => {
Expand Down Expand Up @@ -120,8 +106,6 @@ describe('ItemsDialog', () => {
Paneset.mockClear();
Loading.mockClear();
onClose.mockClear();
testMutator.holdings.GET.mockClear();
testMutator.holdings.reset.mockClear();
testMutator.items.GET.mockClear();
testMutator.items.reset.mockClear();
testMutator.requests.GET.mockClear();
Expand Down Expand Up @@ -272,7 +256,6 @@ describe('ItemsDialog', () => {
});
const allItemStatuses = Object.values(itemStatuses);
const newMutator = {
...testMutator,
items: {
GET: jest.fn(() => (new Promise((resolve) => {
setTimeout(() => {
Expand Down
2 changes: 1 addition & 1 deletion src/MoveRequestManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ class MoveRequestManager extends React.Component {
token: stripes.store.getState().okapi.token,
})
};
const url = `${stripes.okapi.url}/circulation/requests/allowed-service-points?requestId=${request.id}&itemId=${selectedItem.id}&operation=${REQUEST_OPERATIONS.MOVE}`;
const url = `${stripes.okapi.url}/circulation-bff/requests/allowed-service-points?requestId=${request.id}&itemId=${selectedItem.id}&operation=${REQUEST_OPERATIONS.MOVE}`;

this.setState({
isRequestTypesLoading: true,
Expand Down
2 changes: 1 addition & 1 deletion src/MoveRequestManager.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ describe('MoveRequestManager', () => {
});

it('should trigger fetch with correct argument', () => {
const expectedUrl = `${basicProps.stripes.okapi.url}/circulation/requests/allowed-service-points?requestId=${basicProps.request.id}&itemId=${selectedItem.id}&operation=${REQUEST_OPERATIONS.MOVE}`;
const expectedUrl = `${basicProps.stripes.okapi.url}/circulation-bff/requests/allowed-service-points?requestId=${basicProps.request.id}&itemId=${selectedItem.id}&operation=${REQUEST_OPERATIONS.MOVE}`;

expect(global.fetch).toHaveBeenCalledWith(expectedUrl, {});
});
Expand Down
6 changes: 3 additions & 3 deletions src/PatronBlockModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
Modal,
Row
} from '@folio/stripes/components';
import { IfPermission } from '@folio/stripes/core';
import { IfAnyPermission } from '@folio/stripes/core';

const PatronBlockModal = ({
open,
Expand Down Expand Up @@ -55,14 +55,14 @@ const PatronBlockModal = ({
<Col xs={6}>
<Row end="xs">
<Col>
<IfPermission perm="ui-users.overridePatronBlock">
<IfAnyPermission perm="ui-users.overridePatronBlock,ui-users.override-patron-block.execute">
<Button
data-test-override-patron-block
onClick={onOverride}
>
<FormattedMessage id="ui-requests.override" />
</Button>
</IfPermission>
</IfAnyPermission>
<Button onClick={onClose}>
<FormattedMessage id="ui-requests.close" />
</Button>
Expand Down
1 change: 1 addition & 0 deletions src/PositionLink.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
import PositionLink from './PositionLink';

jest.mock('react-router-dom', () => ({
...jest.requireActual('react-router-dom'),
Link: jest.fn(({ to, children }) => <a href={to}>{children}</a>),
}));

Expand Down
Loading

0 comments on commit 4170c4d

Please sign in to comment.