Skip to content

Commit

Permalink
Merge branch 'master' into UIREQ-1187
Browse files Browse the repository at this point in the history
  • Loading branch information
Terala-Priyanka authored Nov 19, 2024
2 parents f2ed2ad + e1d9180 commit 0e9fc0e
Show file tree
Hide file tree
Showing 52 changed files with 13,130 additions and 348 deletions.
20 changes: 19 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,29 @@
# Change history for ui-requests

## 11.0.0 IN PROGRESS
## 11.0.0 (IN PROGRESS)
* 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.

* 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
17 changes: 13 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
"request-storage": "6.0",
"pick-slips": "0.1",
"search-slips": "0.1",
"automated-patron-blocks": "0.1"
"automated-patron-blocks": "0.1",
"circulation-bff-requests": "1.0"
},
"permissionSets": [
{
Expand All @@ -58,6 +59,7 @@
"circulation.requests.queue.collection.get",
"circulation.requests.queue.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 +82,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 +109,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 @@ -120,13 +125,16 @@
"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.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 @@ -139,6 +147,7 @@
"circulation.search-slips.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
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
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 0e9fc0e

Please sign in to comment.