Skip to content

Commit

Permalink
Release v10.0.1 (#2329)
Browse files Browse the repository at this point in the history
* UIIN-2453: Instance 3rd pane: Adjust behaviour when returning to instance from holdings/item full screen (#2305)

(cherry picked from commit b7c19d1)

* UIIN-2629: Consortial holdings accordion is not appearing after the sharing of Instance (#2312)

(cherry picked from commit e03476f)

* UIIN-2531 Reset CheckboxFacet state.more when user resets search form and fewer facet options are loaded. (#2310)

(cherry picked from commit 749fead)

* UIIN-2588: Edit instance success toast no longer shows the instance HRID (#2313)

(cherry picked from commit dc738d2)

* UIIN-2533: Show facet options, if they exist, after clicking the +More button. (#2309)

(cherry picked from commit 1b6dca3)

* UIIN-2608: If Shared & Held by facets were selected in the Browse search, then retain them in the Search lookup after clicking the record. (#2307)

(cherry picked from commit 79771fb)

* UIIN-2600: Remove error message after switch from Instance Edit screen to another app (#2311)

(cherry picked from commit 3411d72)

* Release v10.0.1

---------

Co-authored-by: Denys Bohdan <[email protected]>
Co-authored-by: Dmytro-Melnyshyn <[email protected]>
Co-authored-by: Oleksandr Hladchenko <[email protected]>
  • Loading branch information
4 people authored Nov 3, 2023
1 parent 5973004 commit 2f82212
Show file tree
Hide file tree
Showing 34 changed files with 622 additions and 246 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Change history for ui-inventory

## [10.0.1](https://github.com/folio-org/ui-inventory/tree/v10.0.1) (2023-11-03)
[Full Changelog](https://github.com/folio-org/ui-inventory/compare/v10.0.0...v10.0.1)

* Instance 3rd pane: Adjust behavior when returning to instance from holdings/item full screen. Refs UIIN-2453.
* Consortial holdings accordion is not appearing after the sharing of Instance. Fixes UIIN-2629.
* Reset CheckboxFacet state.more when user resets search form and fewer facet options are loaded. Fixes UIIN-2531.
* Edit instance success toast no longer shows the instance HRID. Fixes UIIN-2588.
* Show facet options, if they exist, after clicking the +More button. Refs UIIN-2533.
* If Shared & Held by facets were selected in the Browse search, then retain them in the Search lookup after clicking the record. Refs UIIN-2608.
* Remove error message after switch from Instance Edit screen to another app. Fixes UIIN-2600.

## [10.0.0](https://github.com/folio-org/ui-inventory/tree/v10.0.0) (2023-10-13)
[Full Changelog](https://github.com/folio-org/ui-inventory/compare/v9.4.12...v10.0.0)

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/inventory",
"version": "10.0.0",
"version": "10.0.1",
"description": "Inventory manager",
"repository": "folio-org/ui-inventory",
"publishConfig": {
Expand Down
7 changes: 7 additions & 0 deletions src/Instance/HoldingsList/Holding/Holding.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ const Holding = ({
isDraggable,
isItemsDroppable,
tenantId,
instanceId,
pathToAccordionsState,
}) => {
return (
<div>
Expand Down Expand Up @@ -49,6 +51,8 @@ const Holding = ({
onViewHolding={onViewHolding}
onAddItem={onAddItem}
tenantId={tenantId}
instanceId={instanceId}
pathToAccordionsState={pathToAccordionsState}
>
<ItemsListContainer
holding={holding}
Expand All @@ -66,6 +70,7 @@ Holding.propTypes = {
holding: PropTypes.object.isRequired,
onViewHolding: PropTypes.func.isRequired,
onAddItem: PropTypes.func.isRequired,
instanceId: PropTypes.string.isRequired,
holdings: PropTypes.arrayOf(PropTypes.object),
draggable: PropTypes.bool,
droppable: PropTypes.bool,
Expand All @@ -74,10 +79,12 @@ Holding.propTypes = {
isHoldingDragSelected: PropTypes.func,
isItemsDroppable: PropTypes.bool,
tenantId: PropTypes.string,
pathToAccordionsState: PropTypes.arrayOf(PropTypes.string),
};

Holding.defaultProps = {
isItemsDroppable: true,
pathToAccordionsState: [],
};

export default Holding;
2 changes: 2 additions & 0 deletions src/Instance/HoldingsList/Holding/Holding.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const HoldingSetup = () => (
<Router>
<Holding
holding={holding}
instanceId="instanceId"
onViewHolding={onViewHolding}
onAddItem={onAddItem}
holdings={holdings}
Expand All @@ -38,6 +39,7 @@ const HoldingSetup = () => (
isHoldingDragSelected={isHoldingDragSelected}
isDraggable={isDraggable}
isItemsDroppable={isItemsDroppable}
pathToAccordionsState={['holdings']}
/>
</Router>
);
Expand Down
14 changes: 12 additions & 2 deletions src/Instance/HoldingsList/Holding/HoldingAccordion.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ import {
import { callNumberLabel } from '../../../utils';
import HoldingButtonsGroup from './HoldingButtonsGroup';
import useHoldingItemsQuery from '../../../hooks/useHoldingItemsQuery';
import { useLocationsQuery } from '../../../hooks';
import {
useHoldingsAccordionState,
useLocationsQuery,
} from '../../../hooks';

const HoldingAccordion = ({
children,
Expand All @@ -23,13 +26,16 @@ const HoldingAccordion = ({
onAddItem,
withMoveDropdown,
tenantId,
instanceId,
pathToAccordionsState,
}) => {
const searchParams = {
limit: 0,
offset: 0,
};

const [open, setOpen] = useState(false);
const pathToAccordion = [...pathToAccordionsState, holding?.id];
const [open, setOpen] = useHoldingsAccordionState({ instanceId, pathToAccordion });
const [openFirstTime, setOpenFirstTime] = useState(false);
const { totalRecords, isFetching } = useHoldingItemsQuery(holding.id, { searchParams, key: 'itemCount', tenantId });
const { data: locations } = useLocationsQuery({ tenantId });
Expand Down Expand Up @@ -113,10 +119,14 @@ HoldingAccordion.propTypes = {
holding: PropTypes.object.isRequired,
onViewHolding: PropTypes.func.isRequired,
onAddItem: PropTypes.func.isRequired,
instanceId: PropTypes.string.isRequired,
holdings: PropTypes.arrayOf(PropTypes.object),
withMoveDropdown: PropTypes.bool,
children: PropTypes.object,
tenantId: PropTypes.string,
pathToAccordionsState: PropTypes.arrayOf(PropTypes.string),
};

HoldingAccordion.defaultProps = { pathToAccordionsState: [] };

export default HoldingAccordion;
2 changes: 2 additions & 0 deletions src/Instance/HoldingsList/Holding/HoldingAccordion.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ const HoldingAccordionSetup = () => (
onViewHolding={noop}
onAddItem={noop}
withMoveDropdown={false}
instanceId="instanceId"
pathToAccordionsState={['holdings']}
>
<></>
</HoldingAccordion>
Expand Down
16 changes: 16 additions & 0 deletions src/Instance/HoldingsList/Holding/HoldingContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ const DraggableHolding = ({
onViewHolding,
onAddItem,
tenantId,
instanceId,
pathToAccordionsState,
...rest
}) => {
const rowStyles = useMemo(() => (
Expand Down Expand Up @@ -68,6 +70,8 @@ const DraggableHolding = ({
onViewHolding={onViewHolding}
onAddItem={onAddItem}
tenantId={tenantId}
instanceId={instanceId}
pathToAccordionsState={pathToAccordionsState}
/>
)
}
Expand All @@ -83,12 +87,16 @@ DraggableHolding.propTypes = {
draggingHoldingsCount: PropTypes.number,
provided: PropTypes.object.isRequired,
snapshot: PropTypes.object.isRequired,
instanceId: PropTypes.string.isRequired,
holding: PropTypes.object,
onViewHolding: PropTypes.func,
onAddItem: PropTypes.func,
tenantId: PropTypes.string,
pathToAccordionsState: PropTypes.arrayOf(PropTypes.string),
};

DraggableHolding.defaultProps = { pathToAccordionsState: [] };

const HoldingContainer = ({
location,
history,
Expand All @@ -99,6 +107,7 @@ const HoldingContainer = ({
holdingIndex,
draggingHoldingsCount,
tenantId,
pathToAccordionsState,
...rest
}) => {
const onViewHolding = useCallback(() => {
Expand Down Expand Up @@ -130,6 +139,8 @@ const HoldingContainer = ({
onViewHolding={onViewHolding}
onAddItem={onAddItem}
tenantId={tenantId}
instanceId={instance?.id}
pathToAccordionsState={pathToAccordionsState}
{...rest}
/>
)}
Expand All @@ -141,6 +152,8 @@ const HoldingContainer = ({
onViewHolding={onViewHolding}
onAddItem={onAddItem}
tenantId={tenantId}
instanceId={instance?.id}
pathToAccordionsState={pathToAccordionsState}
/>
);
};
Expand All @@ -157,6 +170,9 @@ HoldingContainer.propTypes = {
isDraggable: PropTypes.bool,
draggingHoldingsCount: PropTypes.number,
tenantId: PropTypes.string,
pathToAccordionsState: PropTypes.arrayOf(PropTypes.string),
};

HoldingContainer.defaultProps = { pathToAccordionsState: [] };

export default withRouter(HoldingContainer);
1 change: 1 addition & 0 deletions src/Instance/HoldingsList/Holding/HoldingContainer.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ const renderHoldingContainer = (props = {}) => renderWithIntl(
provided={{ draggableProps: { style: true } }}
onViewHolding={jest.fn()}
onAddItem={jest.fn()}
pathToAccordionsState={['holdings']}
{...props}
/>
</DnDContext.Provider>
Expand Down
4 changes: 4 additions & 0 deletions src/Instance/HoldingsList/HoldingsList.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const HoldingsList = ({
instance,
holdings,
tenantId,
pathToAccordionsState,

draggable,
droppable,
Expand All @@ -19,20 +20,23 @@ const HoldingsList = ({
droppable={droppable}
holdings={holdings}
tenantId={tenantId}
pathToAccordionsState={pathToAccordionsState}
/>
));

HoldingsList.propTypes = {
instance: PropTypes.object.isRequired,
holdings: PropTypes.arrayOf(PropTypes.object),
tenantId: PropTypes.string,
pathToAccordionsState: PropTypes.arrayOf(PropTypes.string),

draggable: PropTypes.bool,
droppable: PropTypes.bool,
};

HoldingsList.defaultProps = {
holdings: [],
pathToAccordionsState: [],
};

export default HoldingsList;
10 changes: 7 additions & 3 deletions src/Instance/HoldingsList/HoldingsListContainer.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';

import {
Loading,
} from '@folio/stripes/components';
import { Loading } from '@folio/stripes/components';

import HoldingsList from './HoldingsList';
import { HoldingsListMovement } from '../InstanceMovement/HoldingMovementList';
Expand All @@ -13,6 +11,7 @@ const HoldingsListContainer = ({
instance,
isHoldingsMove,
tenantId,
pathToAccordionsState,
...rest
}) => {
const { holdingsRecords: holdings, isLoading } = useInstanceHoldingsQuery(instance.id, { tenantId });
Expand All @@ -26,13 +25,15 @@ const HoldingsListContainer = ({
holdings={holdings}
instance={instance}
tenantId={tenantId}
pathToAccordionsState={pathToAccordionsState}
/>
) : (
<HoldingsList
{...rest}
holdings={holdings}
instance={instance}
tenantId={tenantId}
pathToAccordionsState={pathToAccordionsState}
/>
)
);
Expand All @@ -42,6 +43,9 @@ HoldingsListContainer.propTypes = {
instance: PropTypes.object.isRequired,
isHoldingsMove: PropTypes.bool,
tenantId: PropTypes.string,
pathToAccordionsState: PropTypes.arrayOf(PropTypes.string),
};

HoldingsListContainer.defaultProps = { pathToAccordionsState: [] };

export default HoldingsListContainer;
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import React, { useContext } from 'react';
import React, {
useContext,
useEffect,
useRef,
} from 'react';
import PropTypes from 'prop-types';
import { FormattedMessage } from 'react-intl';

Expand All @@ -13,13 +17,29 @@ import {

import { MemberTenantHoldings } from '../MemberTenantHoldings';
import { DataContext } from '../../../contexts';
import { useSearchForShadowInstanceTenants } from '../../../hooks';
import {
useHoldingsAccordionState,
useSearchForShadowInstanceTenants,
} from '../../../hooks';

const ConsortialHoldings = ({ instance }) => {
const pathToAccordion = ['consortialHoldings', '_state'];
const instanceId = instance?.id;

const stripes = useStripes();
const prevInstanceId = useRef(instanceId);
const { consortiaTenantsById } = useContext(DataContext);
const { tenants } = useSearchForShadowInstanceTenants({ instanceId });
const [isConsortialAccOpen, setConsortialAccOpen] = useHoldingsAccordionState({ instanceId, pathToAccordion });

useEffect(() => {
if (instanceId !== prevInstanceId.current) {
setConsortialAccOpen(false);
prevInstanceId.current = instanceId;
}
}, [instanceId]);

const { tenants } = useSearchForShadowInstanceTenants({ instanceId: instance?.id });
if (!consortiaTenantsById) return null;

const memberTenants = tenants
.map(tenant => consortiaTenantsById[tenant.id])
Expand All @@ -31,15 +51,16 @@ const ConsortialHoldings = ({ instance }) => {
<Accordion
id="consortial-holdings"
label={<FormattedMessage id="ui-inventory.consortialHoldings" />}
closedByDefault
open={isConsortialAccOpen}
onToggle={() => setConsortialAccOpen(prevState => !prevState)}
>
{!memberTenants.length
? <FormattedMessage id="stripes-components.tableEmpty" />
: (
<AccordionSet>
{memberTenants.map(memberTenant => (
<MemberTenantHoldings
key={memberTenant.id}
key={`${memberTenant.id}.${instanceId}`}
memberTenant={memberTenant}
instance={instance}
/>
Expand Down
4 changes: 3 additions & 1 deletion src/Instance/InstanceDetails/InstanceDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ const InstanceDetails = forwardRef(({
);
}

const isConsortialHoldingsVisible = instance?.shared || isInstanceShadowCopy(instance?.source);

const renderPaneTitle = () => {
const isInstanceShared = Boolean(isShared || isInstanceShadowCopy(instance?.source));

Expand Down Expand Up @@ -196,7 +198,7 @@ const InstanceDetails = forwardRef(({
<InstanceNewHolding instance={instance} />
)}

{instance?.shared && (
{isConsortialHoldingsVisible && (
<ConsortialHoldings instance={instance} />
)}

Expand Down
Loading

0 comments on commit 2f82212

Please sign in to comment.