Skip to content

Commit

Permalink
Merge branch 'master' into UIIN-2831
Browse files Browse the repository at this point in the history
  • Loading branch information
artem-blazhko committed May 12, 2024
2 parents b984346 + c5d5f29 commit df01db5
Show file tree
Hide file tree
Showing 14 changed files with 40 additions and 179 deletions.
12 changes: 10 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,16 @@
* Add "Display to public" column to receiving history on Holdings. Refs UIIN-2826.
* Add new browse options for Instance classification numbers. Refs UIIN-2624.
* Add new Instance search option `Classification, normalized` for the `Instance` toggle and advanced search modal. Refs UIIN-2801.
* Add callout noting user's active affiliation when it changes after selecting holding or item. Refs UIIN-2831.
* Import `useUserTenantPermissions`, `getUserTenantsPermissions` from `@folio/stripes/core`. Refs UIIN-2837.
* Add callout noting user's active affiliation when it changes after selecting holding or item. Refs UIIN-2831, UIIN-2872.

## [11.0.2] (IN PROGRESS)

* Do not remove field from the form when its value is an empty string. Fixes UIIN-2787.
* ECS: Shared instance cannot be edited from member tenant, even with permissions in both Central and member tenants. Fixes UIIN-2832.
* ECS: Shared instance cannot be edited from member tenant, even with permissions in both Central and member tenants. Fixes UIIN-2845.
* Restricted status displays as Order Closed. Fixes UIIN-2821.
* Update Permission name for Inventory: Set records for deletion and staff suppress. Refs UIIN-2855.
* Include mod-search permissions to "Inventory: Module is enabled" UI permission. Refs UIIN-2860.

## [11.0.1](https://github.com/folio-org/ui-inventory/tree/v11.0.1) (2024-04-11)
[Full Changelog](https://github.com/folio-org/ui-inventory/compare/v11.0.0...v11.0.1)
Expand Down Expand Up @@ -64,6 +67,11 @@
* Increase holdings limit to 5000. Fixes UIIN-2785.
* User with "Inventory: All permissions" permission only should not be seeing the "Staff suppress" facet. Fixes UIIN-2807.

## [10.0.13](https://github.com/folio-org/ui-inventory/tree/v10.0.13) (2024-04-18)
[Full Changelog](https://github.com/folio-org/ui-inventory/compare/v10.0.12...v10.0.13)

* ECS: Shared instance cannot be edited from member tenant, even with permissions in both Central and member tenants. Fixes UIIN-2832.

## [10.0.12](https://github.com/folio-org/ui-inventory/tree/v10.0.12) (2024-04-10)
[Full Changelog](https://github.com/folio-org/ui-inventory/compare/v10.0.11...v10.0.12)

Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@
"material-types": "2.0",
"modes-of-issuance": "1.0",
"nature-of-content-terms": "1.0",
"permissions": "5.6",
"search": "0.7 1.0",
"source-storage-records": "3.0",
"statistical-code-types": "1.0",
Expand Down Expand Up @@ -119,7 +118,9 @@
"search.config.languages.collection.get",
"search.config.languages.item.delete",
"search.index.inventory.reindex.post",
"search.facets.collection.get"
"search.facets.collection.get",
"consortium-search.holdings.collection.get",
"consortium-search.items.collection.get"
]
},
{
Expand Down Expand Up @@ -722,7 +723,7 @@
},
{
"permissionName": "ui-inventory.instance.set-deletion-and-staff-suppress",
"displayName": "Inventory: Set records for deletion and staff suppress",
"displayName": "Inventory: Set records for deletion",
"subPermissions": [
"ui-inventory.instance.view",
"source-storage.records.update"
Expand Down
2 changes: 1 addition & 1 deletion src/ViewInstance.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
stripesConnect,
checkIfUserInMemberTenant,
checkIfUserInCentralTenant,
getUserTenantsPermissions,
} from '@folio/stripes/core';
import {
MenuSection,
Expand All @@ -33,7 +34,6 @@ import withLocation from './withLocation';
import InstancePlugin from './components/InstancePlugin';
import {
isUserInConsortiumMode,
getUserTenantsPermissions,
handleKeyCommand,
isInstanceShadowCopy,
isMARCSource,
Expand Down
5 changes: 0 additions & 5 deletions src/ViewInstance.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ jest.mock('react-beautiful-dnd', () => ({
const spyOncollapseAllSections = jest.spyOn(require('@folio/stripes/components'), 'collapseAllSections');
const spyOnexpandAllSections = jest.spyOn(require('@folio/stripes/components'), 'expandAllSections');

const spyOnGetUserTenantsPermissions = jest.spyOn(utils, 'getUserTenantsPermissions');
const spyOnSetRecordForDeletion = jest.spyOn(utils, 'setRecordForDeletion');

const location = {
Expand Down Expand Up @@ -288,10 +287,6 @@ describe('ViewInstance', () => {
jest.clearAllMocks();
StripesConnectedInstance.prototype.instance.mockImplementation(() => instance);
checkIfUserInCentralTenant.mockReturnValue(false);
spyOnGetUserTenantsPermissions.mockResolvedValueOnce([{
tenantId: 'testTenantId',
permissionNames: ['test permission 1'],
}]);
global.fetch
.mockResolvedValueOnce({
ok: true,
Expand Down
8 changes: 4 additions & 4 deletions src/ViewInstanceWrapper.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import React, { useMemo } from 'react';
import PropTypes from 'prop-types';

import { checkIfUserInMemberTenant } from '@folio/stripes/core';
import {
checkIfUserInMemberTenant,
useUserTenantPermissions,
} from '@folio/stripes/core';
import { withTags } from '@folio/stripes/smart-components';

import ViewInstance from './ViewInstance';
import {
useInstanceMutation,
useUserTenantPermissions,
} from './hooks';
import { useInstance } from './common';

Expand All @@ -17,7 +19,6 @@ const ViewInstanceWrapper = (props) => {
stripes,
} = props;

const userId = stripes?.user?.user?.id;
const centralTenantId = stripes.user.user?.consortium?.centralTenantId;
const consortiumId = stripes.user.user?.consortium?.id;
const {
Expand All @@ -36,7 +37,6 @@ const ViewInstanceWrapper = (props) => {
userPermissions: centralTenantPermissions,
isFetching: isCentralTenantPermissionsLoading,
} = useUserTenantPermissions({
userId,
tenantId: centralTenantId,
}, {
enabled: Boolean(isShared && checkIfUserInMemberTenant(stripes)),
Expand Down
13 changes: 11 additions & 2 deletions src/ViewInstanceWrapper.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import React from 'react';
import { MemoryRouter } from 'react-router-dom';

import {
useUserTenantPermissions
} from '@folio/stripes/core';

import '../test/jest/__mock__';
import buildStripes from '../test/jest/__mock__/stripesCore.mock';

Expand All @@ -9,14 +13,20 @@ import ViewInstanceWrapper from './ViewInstanceWrapper';
import ViewInstance from './ViewInstance';
import {
useInstanceMutation,
useUserTenantPermissions,
} from './hooks';
import { useInstance } from './common';
import {
CONSORTIUM_PREFIX,
SOURCE_VALUES,
} from './constants';

jest.mock('@folio/stripes/core', () => ({
...jest.requireActual('@folio/stripes/core'),
useUserTenantPermissions: jest.fn().mockReturnValue({
userPermissions: [],
isFetching: false,
}),
}));
jest.mock('./ViewInstance', () => jest.fn(() => <div>ViewInstance</div>));

jest.mock('./hooks', () => ({
Expand Down Expand Up @@ -95,7 +105,6 @@ describe('ViewInstanceWrapper', () => {

expect(useUserTenantPermissions).toHaveBeenCalledWith({
tenantId: 'consortia',
userId: 'b1add99d-530b-5912-94f3-4091b4d87e2c',
}, {
enabled: true,
});
Expand Down
1 change: 0 additions & 1 deletion src/hooks/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,5 @@ export { default as useInventoryBrowse } from './useInventoryBrowse';
export { default as useLocationsQuery } from './useLocationsQuery';
export { default as useLastSearchTerms } from './useLastSearchTerms';
export { default as useSearchForShadowInstanceTenants } from './useSearchForShadowInstanceTenants';
export { default as useUserTenantPermissions } from './useUserTenantPermissions';
export { default as useLocationsForTenants } from './useLocationsForTenants';
export { default as useClassificationIdentifierTypes } from './useClassificationIdentifierTypes';
1 change: 0 additions & 1 deletion src/hooks/useUserTenantPermissions/index.js

This file was deleted.

59 changes: 0 additions & 59 deletions src/hooks/useUserTenantPermissions/useUserTenantPermissions.js

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ import {
import {
TitleManager,
useStripes,
useUserTenantPermissions,
} from '@folio/stripes/core';

import {
useClassificationIdentifierTypes,
useUserTenantPermissions,
} from '../../hooks';
import getFieldComponents from './getFieldComponents';
import { CLASSIFICATION_BROWSE_COLUMNS } from './constants';
Expand All @@ -32,13 +32,10 @@ const ClassificationBrowseSettings = () => {
const { classificationTypes, isLoading: isClassificationTypesLoading } = useClassificationIdentifierTypes(centralTenantId);
const ConnectedControlledVocab = useMemo(() => stripes.connect(ControlledVocab), [stripes]);

const userId = stripes?.user?.user?.id;

const {
userPermissions: centralTenantPermissions,
isFetching: isCentralTenantPermissionsLoading,
} = useUserTenantPermissions({
userId,
tenantId: centralTenantId,
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import React from 'react';
import { MemoryRouter } from 'react-router-dom';

import { useStripes } from '@folio/stripes/core';
import {
useStripes,
useUserTenantPermissions,
} from '@folio/stripes/core';
import { runAxeTest } from '@folio/stripes-testing';

import {
Expand All @@ -16,18 +19,13 @@ import ClassificationBrowseSettings from './ClassificationBrowseSettings';

import {
useClassificationIdentifierTypes,
useUserTenantPermissions,
} from '../../hooks';

jest.unmock('@folio/stripes/components');
jest.unmock('@folio/stripes/smart-components');
jest.mock('../../hooks', () => ({
...jest.requireActual('../../hooks'),
useClassificationIdentifierTypes: jest.fn(),
useUserTenantPermissions: jest.fn().mockReturnValue({
userPermissions: [],
isFetching: false,
}),
}));
jest.mock('@folio/stripes/core', () => ({
...jest.requireActual('@folio/stripes/core'),
Expand All @@ -42,6 +40,10 @@ jest.mock('@folio/stripes/core', () => ({
get: jest.fn(),
extend: jest.fn(),
}),
useUserTenantPermissions: jest.fn().mockReturnValue({
userPermissions: [],
isFetching: false,
}),
}));

const defaultProps = {
Expand Down
Loading

0 comments on commit df01db5

Please sign in to comment.