From 4ed7088d291bf738e2b1e58b8aed6c4eec8b4aaf Mon Sep 17 00:00:00 2001 From: Mike Taylor Date: Thu, 19 Oct 2023 18:12:35 +0100 Subject: [PATCH] No errors when inventory-related interfaces are not present We now check for the presence of relevant interfaces at run-time, and no make unsupported settings pages available when the relevant interfaces are not present. Those interfaces (all to do with inventory) are now marked as optional in the package file. It will be possible to simplify this code if/when support for the `iface` element is added to the `` component, but the present fix does not depend on that future change: see https://github.com/folio-org/stripes-smart-components/pull/1401#issuecomment-1771403292 Fixes UITEN-266. --- CHANGELOG.md | 4 +++- package.json | 8 ++++---- src/settings/index.js | 15 ++++++++++++++- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 423fe261..88fbcaa4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ # Change history for ui-tenant-settings -## IN PROGRESS +## 8.0.1 (IN PROGRESS) + +* [UITEN-266](https://issues.folio.org/browse/UITEN-266) No longer displays non-working inventory-related pages when the inventory interfaces are not present. ## [8.0.0](https://github.com/folio-org/ui-tenant-settings/tree/v8.0.0)(2023-10-13) [Full Changelog](https://github.com/folio-org/ui-tenant-settings/compare/v7.4.0...v8.0.0) diff --git a/package.json b/package.json index cb445cdc..8bb5ae01 100644 --- a/package.json +++ b/package.json @@ -17,15 +17,15 @@ "route": "/tenant-settings", "okapiInterfaces": { "configuration": "2.0", - "location-units": "2.0", - "locations": "3.0", "login-saml": "2.0", - "service-points": "3.0", "users": "15.0 16.0" }, "optionalOkapiInterfaces": { + "location-units": "2.0", + "locations": "3.0", "remote-storage-configurations": "1.0", - "remote-storage-mappings": "1.0 2.0" + "remote-storage-mappings": "1.0 2.0", + "service-points": "3.0" }, "permissionSets": [ { diff --git a/src/settings/index.js b/src/settings/index.js index 593ccabb..dbec672e 100644 --- a/src/settings/index.js +++ b/src/settings/index.js @@ -61,6 +61,7 @@ class Organization extends React.Component { label: , component: ServicePoints, perm: 'ui-tenant-settings.settings.servicepoints.view', + iface: 'service-points', }, ], }, @@ -72,24 +73,28 @@ class Organization extends React.Component { label: , component: LocationInstitutions, perm: 'ui-tenant-settings.settings.location.view', + iface: 'location-units', }, { route: 'location-campuses', label: , component: LocationCampuses, perm: 'ui-tenant-settings.settings.location.view', + iface: 'location-units', }, { route: 'location-libraries', label: , component: LocationLibraries, perm: 'ui-tenant-settings.settings.location.view', + iface: 'location-units', }, { route: 'location-locations', label: , component: LocationLocations, perm: 'ui-tenant-settings.settings.location.view', + iface: 'location-units', }, ], } @@ -109,10 +114,18 @@ class Organization extends React.Component { */ render() { + // If this PR is accepted, we will not need to do this filtering by hand: + // https://github.com/folio-org/stripes-smart-components/pull/1401#issuecomment-1771334495 + // But for now ... + const sections = this.sections.map(section => ({ + label: section.label, + pages: section.pages.filter(page => !page.iface || this.props.stripes.hasInterface(page.iface)), + })); + return ( } /> );