diff --git a/CHANGELOG.md b/CHANGELOG.md index 50536ef44..78f5b5911 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ * Extend `Tags` component to accept `mutateEntity` prop. Refs STSMACOM-792. * Refactor CSS away from postcss-color-function. Refs STSMACOM-791. * `` now passes the `entityType` when making PUT requests to `/custom-fields`. Refs FCFIELDS-44. +* Added `tenant` prop to ``. Refs STSMACOM-794. ## [9.0.0](https://github.com/folio-org/stripes-smart-components/tree/v9.0.0) (2023-10-11) [Full Changelog](https://github.com/folio-org/stripes-smart-components/compare/v8.0.0...v9.0.0) diff --git a/lib/ControlledVocab/ControlledVocab.js b/lib/ControlledVocab/ControlledVocab.js index 8668b57fa..d0da7463e 100644 --- a/lib/ControlledVocab/ControlledVocab.js +++ b/lib/ControlledVocab/ControlledVocab.js @@ -28,6 +28,7 @@ class ControlledVocab extends React.Component { path: '!{baseUrl}', records: '!{records}', throwErrors: false, + tenant: '%{tenant}', clientGeneratePk: '!{clientGeneratePk}', PUT: { path: '!{baseUrl}/%{activeRecord.id}', @@ -54,6 +55,7 @@ class ControlledVocab extends React.Component { type: 'okapi', records: 'users', path: 'users', + tenant: '%{tenant}', GET: { params: { query: (queryParams, pathComponents, resourceValues) => { @@ -66,6 +68,7 @@ class ControlledVocab extends React.Component { } }, updaterIds: {}, + tenant: {}, }); static propTypes = { @@ -103,6 +106,9 @@ class ControlledVocab extends React.Component { GET: PropTypes.func, reset: PropTypes.func, }), + tenant: PropTypes.shape({ + replace: PropTypes.func, + }), values: PropTypes.shape({ DELETE: PropTypes.func, GET: PropTypes.func, @@ -134,7 +140,10 @@ class ControlledVocab extends React.Component { sortby: PropTypes.string, stripes: PropTypes.shape({ connect: PropTypes.func.isRequired, - hasPerm: PropTypes.func.isRequired + hasPerm: PropTypes.func.isRequired, + okapi: PropTypes.shape({ + tenant: PropTypes.string.isRequired, + }).isRequired, }).isRequired, /* sample translation prop @@ -146,6 +155,7 @@ class ControlledVocab extends React.Component { termWillBeDeleted: "The patron group {term} will be deleted." } */ + tenant: PropTypes.string, translations: PropTypes.shape({ cannotDeleteTermHeader: PropTypes.string, cannotDeleteTermMessage: PropTypes.string, @@ -235,6 +245,16 @@ class ControlledVocab extends React.Component { return null; } + componentDidMount() { + const { + mutator, + tenant, + stripes, + } = this.props; + + mutator.tenant.replace(tenant || stripes.okapi.tenant); + } + componentDidUpdate() { // build a list of the ids of users who have updated CV items so // we can look them up all at once