From 3557e9e3109856582dad38b05b8a3bde6fcc33fe Mon Sep 17 00:00:00 2001 From: Mariia Aloshyna <55138456+mariia-aloshyna@users.noreply.github.com> Date: Wed, 4 Dec 2024 13:56:43 +0200 Subject: [PATCH] Release v12.0.5 (#2690) * UIIN-3127: Display informative error message when editing same instance, holdings, item in two tabs (#2672) (cherry picked from commit c0f11762327ab1521c29d71d4ae6390fb46ca401) * UIIN-3147 User can edit Source consortium "Holdings sources" in member tenant but not in Consortia manager (#2681) (cherry picked from commit 034df6221aa9f508585ff04a4e042540c4b1ca7a) * UIIN-3143: Set the previously used offset by executing 'resultOffset.replace' when changing the segment. (#2680) (cherry picked from commit d9f70e32ad436816c216a4ccf9ffc843e561acda) * Release v12.0.5 --------- Co-authored-by: Oleksandr Hladchenko <85172747+OleksandrHladchenko1@users.noreply.github.com> Co-authored-by: Mikita Siadykh Co-authored-by: Dmytro-Melnyshyn <77053927+Dmytro-Melnyshyn@users.noreply.github.com> --- CHANGELOG.md | 7 +++++++ package.json | 2 +- src/components/InstancesList/InstancesList.js | 8 +++++++ .../InstancesList/InstancesList.test.js | 21 +++++++++++++++++++ src/settings/HoldingsSourcesSettings.js | 2 +- src/utils.js | 2 +- 6 files changed, 39 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ffd31663..55b4dd861 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Change history for ui-inventory +## [12.0.5](https://github.com/folio-org/ui-inventory/tree/v12.0.5) (2024-12-04) +[Full Changelog](https://github.com/folio-org/ui-inventory/compare/v12.0.4...v12.0.5) + +* Display informative error message when editing same instance, holdings, item in two tabs. Fixes UIIN-3127. +* User can edit Source consortium "Holdings sources" in member tenant but not in Consortia manager. Refs UIIN-3147. +* Set the previously used offset by executing `resultOffset.replace` when changing the segment. Fixes UIIN-3143. + ## [12.0.4](https://github.com/folio-org/ui-inventory/tree/v12.0.4) (2024-12-03) [Full Changelog](https://github.com/folio-org/ui-inventory/compare/v12.0.3...v12.0.4) diff --git a/package.json b/package.json index 8b4933afb..2e5238517 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@folio/inventory", - "version": "12.0.4", + "version": "12.0.5", "description": "Inventory manager", "repository": "folio-org/ui-inventory", "publishConfig": { diff --git a/src/components/InstancesList/InstancesList.js b/src/components/InstancesList/InstancesList.js index f8ec0537b..91c606f30 100644 --- a/src/components/InstancesList/InstancesList.js +++ b/src/components/InstancesList/InstancesList.js @@ -265,6 +265,8 @@ class InstancesList extends React.Component { data, location, segment, + parentMutator, + getLastSearchOffset, } = this.props; const sortBy = this.getSortFromParams(); @@ -297,6 +299,12 @@ class InstancesList extends React.Component { searchParams.set('sort', data.displaySettings.defaultSort); this.redirectToSearchParams(searchParams); } + + if (prevProps.segment !== segment) { + const lastSearchOffset = getLastSearchOffset(segment); + + parentMutator.resultOffset.replace(lastSearchOffset); + } } componentWillUnmount() { diff --git a/src/components/InstancesList/InstancesList.test.js b/src/components/InstancesList/InstancesList.test.js index 70bb386c4..26eea8776 100644 --- a/src/components/InstancesList/InstancesList.test.js +++ b/src/components/InstancesList/InstancesList.test.js @@ -448,6 +448,27 @@ describe('InstancesList', () => { expect(mockStoreLastSearchOffset).toHaveBeenCalledWith(offset, 'instances'); }); }); + + describe('and segment has been changed', () => { + it('should apply offset from storage', () => { + const lastSearchOffset = 200; + + const { rerender } = renderInstancesList({ + segment: segments.instances, + }); + + mockStoreLastSearchOffset.mockClear(); + mockResultOffsetReplace.mockClear(); + mockGetLastSearchOffset.mockReturnValueOnce(lastSearchOffset); + + rerender(getInstancesListTree({ + segment: segments.holdings, + })); + + expect(mockGetLastSearchOffset).toHaveBeenCalledWith(segments.holdings); + expect(mockResultOffsetReplace).toHaveBeenCalledWith(lastSearchOffset); + }); + }); }); describe('when user clicks Reset all', () => { diff --git a/src/settings/HoldingsSourcesSettings.js b/src/settings/HoldingsSourcesSettings.js index f8b957aed..0af79eeb2 100644 --- a/src/settings/HoldingsSourcesSettings.js +++ b/src/settings/HoldingsSourcesSettings.js @@ -27,7 +27,7 @@ class HoldingsSourcesSettings extends React.Component { render() { const hasPerm = this.props.stripes.hasPerm('ui-inventory.settings.holdings-sources'); - const suppress = getSourceSuppressor(RECORD_SOURCE.FOLIO); + const suppress = getSourceSuppressor([RECORD_SOURCE.FOLIO, RECORD_SOURCE.CONSORTIUM]); return ( diff --git a/src/utils.js b/src/utils.js index 11a9127fb..70697919b 100644 --- a/src/utils.js +++ b/src/utils.js @@ -702,7 +702,7 @@ export const parseHttpError = async httpError => { let jsonError = {}; try { - if (contentType === 'text/plain') { + if (contentType.includes('text/plain')) { jsonError.message = await httpError.text(); } else { jsonError = await httpError.json();