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

UIREQ-1171: Feature toggle #1224

Merged
merged 38 commits into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from 37 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
d9545bf
Use settings/entries endpoint to get settings data (#1139)
artem-blazhko Feb 19, 2024
dd50eaf
Update UXPROD-4559-ECS in accordance with master brahcn
artem-blazhko Mar 4, 2024
a4c16bf
Merge branch 'master' into UXPROD-4559-ECS
artem-blazhko Mar 15, 2024
e0fb403
Merge branch 'master' into UXPROD-4559-ECS
artem-blazhko May 2, 2024
251f6d9
Requests app.: Moving request (ECS with mod-tlr enabled). Refs UIREQ-…
Dmitriy-Litvinenko May 16, 2024
83454c0
Merge pull request #1162 from folio-org/UIREQ-1100
Dmitriy-Litvinenko May 17, 2024
77e9e23
UIREQ-1105: Hide Action menu on secondary requests (ECS + mod-tlr)
Dmitriy-Litvinenko May 20, 2024
25dcf96
Merge pull request #1163 from folio-org/UIREQ-1105
Dmitriy-Litvinenko May 21, 2024
593afed
Merge branch 'master' into UXPROD-4559-ECS
artem-blazhko May 22, 2024
0542a6f
Use `circulation/items-by-instance` endpoint (#1164)
artem-blazhko Jun 20, 2024
077f629
Merge branch 'master' into UXPROD-4559-ECS
artem-blazhko Jun 20, 2024
07a75ce
Merge branch 'master' into UXPROD-4559-ECS
artem-blazhko Aug 19, 2024
92faed3
Hide Duplicate and Move action buttons in ECS env with mod-tlr enable…
artem-blazhko Aug 23, 2024
43c2134
Merge branch 'master' into UXPROD-4559-ECS
artem-blazhko Sep 3, 2024
4dd62be
Add circulation.items-by-instance.get permission (#1193)
artem-blazhko Sep 6, 2024
3dd43f4
Use new endpoints to get request types and to create new request (#1201)
artem-blazhko Sep 17, 2024
9fdbd0d
Merge branch 'master' into UXPROD-4559-ECS
artem-blazhko Oct 2, 2024
e9582ea
Use `instanceId` param for ILR from items response (#1210)
artem-blazhko Oct 10, 2024
f9a2562
Merge branch 'master' into UXPROD-4559-ECS
artem-blazhko Oct 14, 2024
c24e59e
Send `holdingsRecordId` param for Item level requests (#1213)
artem-blazhko Oct 15, 2024
039115a
Add missed `tlr.settings.get` permission (#1217)
artem-blazhko Oct 28, 2024
7dc9c19
Merge branch 'master' into UXPROD-4559-ECS
artem-blazhko Oct 28, 2024
8aea1b7
Add `mod-settings.global.read.circulation` permission (#1218)
artem-blazhko Oct 29, 2024
1219eaf
Merge branch 'master' into UXPROD-4559-ECS
artem-blazhko Nov 6, 2024
26e2eca
Add `mod-settings.entries.collection.get` permission (#1223)
artem-blazhko Nov 8, 2024
90bdf08
UIREQ-1134: Migrate from mod-circulation endpoint to mod-circulation-…
artem-blazhko Nov 9, 2024
22ca2d0
Basic functionality for feature toggles
artem-blazhko Nov 12, 2024
6039912
Basic functionality for feature toggles
artem-blazhko Nov 12, 2024
4f5e73a
Merge branch 'master' into UXPROD-4559-ECS
artem-blazhko Nov 13, 2024
aa47cab
Merge branch 'UIREQ-1171' of https://github.com/folio-org/ui-requests…
artem-blazhko Nov 13, 2024
02759d9
Merge branch 'UXPROD-4559-ECS' into UIREQ-1171
artem-blazhko Nov 13, 2024
528a945
Add permissions
artem-blazhko Nov 13, 2024
4852148
Use feature flag from config
artem-blazhko Nov 13, 2024
17ee98e
Merge branch 'UIREQ-1171' of https://github.com/folio-org/ui-requests…
artem-blazhko Nov 13, 2024
1c6cb69
Fix tests
artem-blazhko Nov 13, 2024
0e612ca
Change constant name
artem-blazhko Nov 15, 2024
d51aa7e
Change approach of DOMPurify using
artem-blazhko Nov 15, 2024
893ae8e
Merge branch 'master' into UIREQ-1171
artem-blazhko Nov 18, 2024
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
19 changes: 18 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,24 @@
# 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.
* Fix DOMPurify import. Refs UIREQ-1180.
* Implement feature toggle for ECS and not ECS envs. Refs UIREQ-1171.

## [10.0.0] (https://github.com/folio-org/ui-requests/tree/v10.0.0) (2024-10-31)
[Full Changelog](https://github.com/folio-org/ui-requests/compare/v9.1.2...v10.0.0)
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
Loading