Skip to content

Commit

Permalink
Release v8.0.3 (#1662)
Browse files Browse the repository at this point in the history
* UIDATIMP-1679: Allow central tenant to create action profile for Orders and Invoices (#1657)

(cherry picked from commit eb823c7)

* UIDATIMP-1686: Replace `_/proxy/tenants/${tenant}/modules` with `stripes.discovery.modules` object (#1661)

(cherry picked from commit 9ae7e0b)

* Release v8.0.3

---------

Co-authored-by: Oleksandr Hladchenko <[email protected]>
  • Loading branch information
mariia-aloshyna and OleksandrHladchenko1 authored Dec 5, 2024
1 parent 09569da commit 9c6b6df
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 30 deletions.
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Change history for ui-data-import

## [8.0.3](https://github.com/folio-org/ui-data-import/tree/v8.0.3) (2024-12-04)

### Bugs fixed:
* Allow central tenant to create action profile for Orders and Invoices. (UIDATIMP-1679)
* Replace `_/proxy/tenants/${tenant}/modules` with `stripes.discovery.modules` object. (UIDATIMP-1686)

## [8.0.2](https://github.com/folio-org/ui-data-import/tree/v8.0.2) (2024-11-21)

### Bugs fixed:
Expand Down Expand Up @@ -37,6 +43,16 @@
* Add missing `source-storage.sourceRecords.get` permission. (UIDATIMP-1652)
* Display correctly "Percentage" and "Currency" fields for orders and invoices. (UIDATIMP-1666)

## [7.1.10](https://github.com/folio-org/ui-data-import/tree/v7.1.10) (2024-11-12)

### Bugs fixed:
* Change endpoint to get actual SRS MARC data (UIDATIMP-1597)

## [7.1.9](https://github.com/folio-org/ui-data-import/tree/v7.1.9) (2024-09-16)

### Bugs fixed:
* Implement new Donor information section for Order field mapping profiles (UIDATIMP-1656)

## [7.1.8](https://github.com/folio-org/ui-data-import/tree/v7.1.8) (2024-05-09)

### Bugs fixed:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@folio/data-import",
"version": "8.0.2",
"version": "8.0.3",
"description": "Data Import manager",
"main": "src/index.js",
"repository": "folio-org/ui-data-import",
Expand Down
2 changes: 2 additions & 0 deletions src/settings/ActionProfiles/ActionProfilesForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ export const ActionProfilesFormComponent = ({
const RECORD_TYPES = isUserInCentralTenant
? pick(ACTION_PROFILES_FORM_FOLIO_RECORD_TYPES, [
ACTION_PROFILES_FORM_FOLIO_RECORD_TYPES.INSTANCE.type,
ACTION_PROFILES_FORM_FOLIO_RECORD_TYPES.INVOICE.type,
ACTION_PROFILES_FORM_FOLIO_RECORD_TYPES.ORDER.type,
ACTION_PROFILES_FORM_FOLIO_RECORD_TYPES.MARC_BIBLIOGRAPHIC.type,
ACTION_PROFILES_FORM_FOLIO_RECORD_TYPES.MARC_AUTHORITY.type,
])
Expand Down
6 changes: 3 additions & 3 deletions src/settings/ActionProfiles/ActionProfilesForm.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,19 +161,19 @@ describe('ActionProfilesForm component', () => {
});

describe('when user is in central tenant', () => {
it('should render "Instance", "MARC Bibliographic" and "MARC Authority" record types', () => {
it('should render "Instance", "Order", "Invoice", "MARC Bibliographic" and "MARC Authority" record types', () => {
spyOnCheckIfUserInCentralTenant.mockReturnValue(true);

const { container } = renderActionProfilesForm(actionProfilesFormProps());

expect(container.querySelector('[value="INSTANCE"]')).toBeDefined();
expect(container.querySelector('[value="ORDER"]')).toBeDefined();
expect(container.querySelector('[value="INVOICE"]')).toBeDefined();
expect(container.querySelector('[value="MARC_BIBLIOGRAPHIC"]')).toBeDefined();
expect(container.querySelector('[value="MARC_HOLDINGS"]')).toBeDefined();

expect(container.querySelector('[value="HOLDINGS"]')).not.toBeInTheDocument();
expect(container.querySelector('[value="ITEM"]')).not.toBeInTheDocument();
expect(container.querySelector('[value="ORDER"]')).not.toBeInTheDocument();
expect(container.querySelector('[value="INVOICE"]')).not.toBeInTheDocument();
});
});

Expand Down
22 changes: 6 additions & 16 deletions src/settings/MatchProfiles/MatchProfiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,16 +237,6 @@ export class MatchProfiles extends Component {
staticFallback: { params: {} },
},
},
modules: {
type: 'okapi',
path: (queryParams, pathComponents, resourceData, logger, props) => {
const { stripes: { okapi: { tenant } } } = props;

return `_/proxy/tenants/${tenant}/modules`;
},
throwErrors: false,
GET: { params: { full: true } },
},
});

static propTypes = {
Expand Down Expand Up @@ -308,17 +298,17 @@ export class MatchProfiles extends Component {
};

async componentDidUpdate(prevProps) {
if (!isEqual(prevProps.resources.modules, this.props.resources.modules)
&& !isEmpty(this.props.resources.modules.records)) {
if (!isEqual(prevProps.stripes.discovery.modules, this.props.stripes.discovery.modules)
&& !isEmpty(this.props.stripes.discovery.modules)) {
const {
stripes,
stripes: { okapi },
resources: { modules: { records } },
stripes: { discovery: { modules } },
} = this.props;

const inventoryModuleVersion = getModuleVersion(records, 'Inventory Storage Module');
const ordersModuleVersion = getModuleVersion(records, 'Orders Business Logic Module');
const invoiceModuleVersion = getModuleVersion(records, 'Invoice business logic module');
const inventoryModuleVersion = getModuleVersion(modules, 'Inventory Storage Module');
const ordersModuleVersion = getModuleVersion(modules, 'Orders Business Logic Module');
const invoiceModuleVersion = getModuleVersion(modules, 'Invoice business logic module');

const requestsToInstance = INSTANCE_RESOURCE_PATHS.map(path => fetchJsonSchema(path, inventoryModuleVersion, okapi));
const requestsToHoldings = HOLDINGS_RESOURCE_PATHS.map(path => fetchJsonSchema(path, inventoryModuleVersion, okapi));
Expand Down
4 changes: 2 additions & 2 deletions src/utils/fetchJsonShemas.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export const getModuleVersion = (modules, moduleName) => {
const version = modules.find(module => module.name === moduleName);
const version = Object.keys(modules).find(key => modules[key] === moduleName);

return version ? version.id : undefined;
return version || undefined;
};

export const fetchJsonSchema = async (path, module, okapi) => {
Expand Down
13 changes: 5 additions & 8 deletions src/utils/tests/fetchJsonSchemas.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,12 @@ import { STATUS_CODES } from '../constants';

describe('getModuleVersion function', () => {
it('returns module version of a module with given name', () => {
const testModules = [{
name: 'module1',
id: 'testId1',
}, {
name: 'module2',
id: 'testId2',
}];
const testModules = {
testId1: 'module1',
testId2: 'module2',
};

expect(getModuleVersion(testModules, 'module2')).toBe(testModules[1].id);
expect(getModuleVersion(testModules, 'module2')).toBe('testId2');
expect(getModuleVersion(testModules, 'module3')).toBeUndefined();
});
});
Expand Down

0 comments on commit 9c6b6df

Please sign in to comment.