Skip to content

Commit

Permalink
Merge branch 'master' into UIIN-1745
Browse files Browse the repository at this point in the history
  • Loading branch information
VSnehalatha authored Jul 17, 2023
2 parents 8a0f6aa + 0504a00 commit a77d1a0
Show file tree
Hide file tree
Showing 294 changed files with 7,580 additions and 2,352 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/build-npm-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,12 @@ jobs:
run: yarn lint
continue-on-error: true

- name: Get number of CPU cores
id: cpu-cores
uses: SimenB/github-actions-cpu-cores@v1

- name: Run yarn test
run: xvfb-run --server-args="-screen 0 1024x768x24" yarn test $YARN_TEST_OPTIONS
run: xvfb-run --server-args="-screen 0 1024x768x24" yarn test $YARN_TEST_OPTIONS --max-workers ${{ steps.cpu-cores.outputs.count }}

- name: Run yarn formatjs-compile
if : ${{ env.COMPILE_TRANSLATION_FILES == 'true' }}
Expand Down Expand Up @@ -222,6 +226,7 @@ jobs:

- name: Exclude some CI-generated artifacts in package
run: |
echo "artifacts" >> .npmignore
echo ".github" >> .npmignore
echo ".scannerwork" >> .npmignore
cat .npmignore
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/build-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,12 @@ jobs:
run: yarn lint
continue-on-error: true

- name: Get number of CPU cores
id: cpu-cores
uses: SimenB/github-actions-cpu-cores@v1

- name: Run yarn test
run: xvfb-run --server-args="-screen 0 1024x768x24" yarn test $YARN_TEST_OPTIONS
run: xvfb-run --server-args="-screen 0 1024x768x24" yarn test $YARN_TEST_OPTIONS --max-workers ${{ steps.cpu-cores.outputs.count }}

- name: Run yarn formatjs-compile
if: ${{ env.COMPILE_TRANSLATION_FILES == 'true' }}
Expand Down Expand Up @@ -168,6 +172,7 @@ jobs:
- name: Exclude some CI-generated artifacts in package
if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' }}
run: |
echo "artifacts" >> .npmignore
echo ".github" >> .npmignore
echo ".scannerwork" >> .npmignore
cat .npmignore
Expand Down
61 changes: 59 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Change history for ui-inventory

## 9.5.0 IN PROGRESS
## 10.0.0 IN PROGRESS
* Added a new option in the "Actions" dropdown within the Inventory app search page for "+New MARC Bib Record". Refs UIIN-2356.
* Change the url for the "New MARC Bib Record" page. Refs UIIN-2380.
* Avoid private paths in stripes-core imports. Refs UIIN-2367.
Expand All @@ -11,7 +11,56 @@
* Holdings Create/Edit screens: Replace custom RepeatableField with component from stripes. Refs UIIN-2398.
* Holdings Create/Edit screens: Repeatable field trashcan is not aligned with the data row. Fixes UIIN-2373.
* Holdings view source: Print button not visible with "View MARC holdings record" permission. Refs UIIN-2405.

* The 'Missing' and 'Withdrawn' options in the actions menu are absent after clicking on the 'Actions' button for item status "In process". Fixes UIIN-2338.
* Item Create/Edit screens: Replace custom RepeatableField with component from stripes. Refs UIIN-2397.
* Item Create/Edit screens: Repeatable field trashcan is not aligned with the data row. Fixes UIIN-2374.
* Chronology not displayed in receiving history. Fixes UIIN-2411.
* Also support `circulation` `14.0`. Refs UIIN-2412.
* Instance/Holdings/Item notes, administrative notes character limit to 32K. Refs UIIN-2354.
* Import testing-library deps from `@folio/jest-config-stripes`. Refs UIIN-2427.
* Bump zustand to v4. Refs UIIN-2353.
* Fix the `records-editor/records` request by adding `_actionType`. Refs UIIN-2431.
* Navigating away and back to item-edit or holdings-edit screen throws NPE. Fixes UIIN-2112.
* ISRI: Adjust jobProfiles GET request to fetch profiles by ids. Refs UIIN-2428.
* Sorting of profiles is not executed in alphabetical order in the Z39.50 target profiles View. Fixes UIIN-2424.
* Added sort options in Actions for Instance/Holdings/Item. Refs UIIN-2357.
* Statistical code empty field error. Refs UIIN-2420.
* Hide the `Actions` button for the view page if there are no permissions. Refs UIIN-2360.
* When duplicating an item, the circulation history is duplicated when it should not be. Fixes UIIN-2419.
* Don't reset browse query when on Browse route and click Browse segment. Fixes UIIN-2434.
* Prevent double-escaping of query when Browsing. Fixes UIIN-2435.
* When adding items, cursor is in the barcode field as default. Refs UIIN-2205.
* Quick export from instance detail view. Refs UIIN-2430.
* Escape quotes to search for Subjects and Contributor. Refs UIIN-2445.
* Fix Search and Browse navigation and determining if the button is active. Refs UIIN-2444.
* Scrolling within Inventory facets. Refs UIIN-2377.
* When removing the dead icons in the Item record, then the displayed text looks inconsistent. Fixes UIIN-1392.
* Adjust the sentence case for some Inventory action options. Refs UIIN-2436.
* Adjust the Instance Edit screen header. Refs UIIN-2437.
* Inventory: Retain Search/Browse query/options/filter and facet selections UNLESS user resets/clear selections. Refs UIIN-2433.
* Statistical Code dropdown "contains" type ahead functionality needed (Instance/Holdings/Items). Refs UIIN-2466.
* Fix problem with a large number of items on a single holdings record. Refs UIIN-2478.
* Decrease rerenders for TargetProfileDetail component to avoid errors when view the target profile. Fixes UIIN-2467.
* leverage cookie-based authentication in all API requests. Refs UIIN-2282.
* Restrict modifying and deleting system call number types. Refs UIIN-2385.
* Prevent editing of shared settings from outside "Consortium manager". Refs UIIN-2482.
* Add new browse options to limit browse by call number type. Fixes UIIN-2467.
* Implement Advanced search modal. Refs UIIN-1920.

## [9.4.8](https://github.com/folio-org/ui-inventory/tree/v9.4.8) (2023-06-30)
[Full Changelog](https://github.com/folio-org/ui-inventory/compare/v9.4.7...v9.4.8)

* Fix useBoundWithHoldings for 100+ items. Fixes UIIN-2478.

## [9.4.7](https://github.com/folio-org/ui-inventory/tree/v9.4.7) (2023-06-27)
[Full Changelog](https://github.com/folio-org/ui-inventory/compare/v9.4.6...v9.4.7)

* When duplicating an item, the circulation history is duplicated when it should not be. Fixes UIIN-2469.

## [9.4.6](https://github.com/folio-org/ui-inventory/tree/v9.4.6) (2023-06-19)
[Full Changelog](https://github.com/folio-org/ui-inventory/compare/v9.4.5...v9.4.6)

* Rename `hrid` qindex for item to avoid collisions with holdings and instances. Fixes UIIN-2443.

## [9.4.5](https://github.com/folio-org/ui-inventory/tree/v9.4.5) (2023-04-03)
[Full Changelog](https://github.com/folio-org/ui-inventory/compare/v9.4.4...v9.4.5)
Expand Down Expand Up @@ -128,6 +177,14 @@
* Moved the print button from QuickMarkView, into the ViewSource. Due to the folio-org/ui-quick-marc#468. Refs UIIN-2324.
* Change title for the print popup. Refs UIIN-2329.
* Move @testing-library/* to dev-deps. Refs UIIN-2309.
* Rename `hrid` qindex for item to avoid collisions with holdings and instances. Fixes UIIN-2443.
* Reset `<BoundWithModal>` when modal is closed. Fixes UIIN-2401.

## [9.2.9](https://github.com/folio-org/ui-inventory/tree/v9.2.9) (2023-06-27)
[Full Changelog](https://github.com/folio-org/ui-inventory/compare/v9.2.8...v9.2.9)

* Use correct reference to item resource. Fixes UIIN-2418.
* When duplicating an item, the circulation history is duplicated when it should not be. Fixes UIIN-2470.

## [9.2.0](https://github.com/folio-org/ui-inventory/tree/v9.2.0) (2022-10-27)
[Full Changelog](https://github.com/folio-org/ui-inventory/compare/v9.1.0...v9.2.0)
Expand Down
17 changes: 9 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@folio/inventory",
"version": "9.4.5",
"version": "10.0.0",
"description": "Inventory manager",
"repository": "folio-org/ui-inventory",
"publishConfig": {
Expand Down Expand Up @@ -51,7 +51,7 @@
"alternative-title-types": "1.0",
"call-number-types": "1.0",
"browse": "0.6 1.0",
"circulation": "9.0 10.0 11.0 12.0 13.0",
"circulation": "9.0 10.0 11.0 12.0 13.0 14.0",
"classification-types": "1.1",
"configuration": "2.0",
"contributor-name-types": "1.2",
Expand Down Expand Up @@ -836,7 +836,7 @@
"lint": "eslint .",
"test": "yarn run test:unit",
"test:jest": "jest",
"test:unit": "jest --silent --ci --coverage",
"test:unit": "jest --ci --coverage",
"test:unit:watch": "jest --watch --coverage",
"test:e2e": "stripes test karma",
"test:e2e:ci": "stripes test karma --karma.singleRun --karma.browsers ChromeDocker --karma.reporters mocha junit --coverage",
Expand Down Expand Up @@ -880,10 +880,11 @@
"react-query": "^3.6.0",
"react-router-dom": "^5.0.1",
"regenerator-runtime": "^0.13.3",
"sinon": "^7.0.0"
"sinon": "^7.0.0",
"zustand": "^4.1.1"
},
"dependencies": {
"@folio/quick-marc": "^6.0.0",
"@folio/quick-marc": "^7.0.0",
"@folio/stripes-acq-components": "^4.0.0",
"file-saver": "^2.0.0",
"final-form": "^4.18.2",
Expand All @@ -900,16 +901,16 @@
"react-final-form-arrays": "^3.1.0",
"react-final-form-listeners": "^1.0.2",
"react-router-prop-types": "^1.0.4",
"redux-form": "^8.3.7",
"zustand": "^3.7.2"
"redux-form": "^8.3.7"
},
"peerDependencies": {
"@folio/stripes": "^8.0.0",
"react": "^17.0.2",
"react-intl": "^5.8.0",
"react-query": "^3.6.0",
"react-router": "^5.0.1",
"react-router-dom": "^5.0.1"
"react-router-dom": "^5.0.1",
"zustand": "^4.1.1"
},
"optionalDependencies": {
"@folio/plugin-create-inventory-records": "^3.0.0",
Expand Down
2 changes: 1 addition & 1 deletion src/Holding/DuplicateHolding/DuplicateHolding.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import '../../../test/jest/__mock__';

import { MemoryRouter } from 'react-router-dom';
import { QueryClient, QueryClientProvider } from 'react-query';
import { render, screen } from '@testing-library/react';
import { render, screen } from '@folio/jest-config-stripes/testing-library/react';

import { instance } from '../../../test/fixtures/instance';
import {
Expand Down
2 changes: 1 addition & 1 deletion src/Holding/EditHolding/EditHolding.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import '../../../test/jest/__mock__';

import { MemoryRouter } from 'react-router-dom';
import { QueryClient, QueryClientProvider } from 'react-query';
import { render, screen } from '@testing-library/react';
import { render, screen } from '@folio/jest-config-stripes/testing-library/react';

import { instance } from '../../../test/fixtures/instance';
import {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { BrowserRouter as Router } from 'react-router-dom';

import { screen } from '@testing-library/react';
import { screen } from '@folio/jest-config-stripes/testing-library/react';

import '../../../../test/jest/__mock__';
import renderWithIntl from '../../../../test/jest/helpers/renderWithIntl';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
QueryClient,
QueryClientProvider,
} from 'react-query';
import { renderHook } from '@testing-library/react-hooks';
import { renderHook } from '@folio/jest-config-stripes/testing-library/react-hooks';

import '../../../../test/jest/__mock__';

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

import { screen } from '@testing-library/react';
import { screen } from '@folio/jest-config-stripes/testing-library/react';

import '../../../../test/jest/__mock__';
import renderWithIntl from '../../../../test/jest/helpers/renderWithIntl';
Expand Down
27 changes: 14 additions & 13 deletions src/Holding/ViewHolding/HoldingBoundWith/useBoundWithHoldings.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
import { useQuery } from 'react-query';

import { useOkapiKy, useNamespace } from '@folio/stripes/core';
import useChunkedCQLFetch from '../../../hooks/useChunkedCQLFetch';

const useBoundWithHoldings = (boundWithItems) => {
const ky = useOkapiKy();
const [namespace] = useNamespace({ key: 'boundWithHoldings' });
let holdingsRecordIds = boundWithItems?.map(x => x.holdingsRecordId);

const holdingRecordIds = boundWithItems?.map(x => x.holdingsRecordId);
const queryIds = holdingRecordIds.join(' or ');
// De-dup the list of holdingsRecordIds for efficiency
holdingsRecordIds = [...new Set(holdingsRecordIds)];

const { data, isLoading } = useQuery(
[namespace, queryIds],
() => ky.get(`holdings-storage/holdings?query=id=(${queryIds})`).json(),
{ enabled: Boolean(queryIds) }
);
const { items: holdingsRecords, isLoading } = useChunkedCQLFetch({
ids: holdingsRecordIds,
endpoint: 'holdings-storage/holdings',
reduceFunction: (holdingQueries) => (
holdingQueries.reduce((acc, curr) => {
return [...acc, ...(curr?.data?.holdingsRecords ?? [])];
}, [])
)
});

return {
isLoading,
boundWithHoldings: data?.holdingsRecords || [],
boundWithHoldings: holdingsRecords,
};
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
QueryClient,
QueryClientProvider,
} from 'react-query';
import { renderHook } from '@testing-library/react-hooks';
import { renderHook } from '@folio/jest-config-stripes/testing-library/react-hooks';

import '../../../../test/jest/__mock__';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
QueryClient,
QueryClientProvider,
} from 'react-query';
import { renderHook } from '@testing-library/react-hooks';
import { renderHook } from '@folio/jest-config-stripes/testing-library/react-hooks';

import '../../../../test/jest/__mock__';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,25 @@ const columnMapping = {
'caption': <FormattedMessage id="ui-inventory.caption" />,
'copyNumber': <FormattedMessage id="ui-inventory.copyNumber" />,
'enumeration': <FormattedMessage id="ui-inventory.enumeration" />,
'chronology': <FormattedMessage id="ui-inventory.chronology" />,
'receivedDate': <FormattedMessage id="ui-inventory.receivingHistory.receivedDate" />,
'comment': <FormattedMessage id="ui-inventory.receivingHistory.comment" />,
'source': <FormattedMessage id="ui-inventory.receivingHistory.source" />,
};
const visibleColumns = ['caption', 'copyNumber', 'enumeration', 'receivedDate', 'comment', 'source'];
const visibleColumns = ['caption', 'copyNumber', 'enumeration', 'chronology', 'receivedDate', 'comment', 'source'];
const columnFormatter = {
'caption': i => i.caption || <NoValue />,
'copyNumber': i => i.copyNumber || <NoValue />,
'enumeration': i => i.enumeration || <NoValue />,
'chronology': i => i.chronology || <NoValue />,
'receivedDate': i => (i.receivedDate ? <FormattedDate value={i.receivedDate} /> : <NoValue />),
'comment': i => i.comment || <NoValue />,
'source': i => <FormattedMessage id={`ui-inventory.receivingHistory.source.${i.source || 'user'}`} />,
};
const sorters = {
'caption': ({ caption }) => caption,
'copyNumber': ({ copyNumber }) => copyNumber,
'chronology': ({ chronology }) => chronology,
'enumeration': ({ enumeration }) => enumeration,
'receivedDate': ({ receivedDate }) => receivedDate,
'source': ({ source }) => source,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';

import user from '@testing-library/user-event';
import { screen } from '@testing-library/react';
import user from '@folio/jest-config-stripes/testing-library/user-event';
import { screen } from '@folio/jest-config-stripes/testing-library/react';

import '../../../../test/jest/__mock__';
import renderWithIntl from '../../../../test/jest/helpers/renderWithIntl';
Expand All @@ -28,6 +28,7 @@ describe('HoldingReceivingHistory', () => {
renderHoldingReceivingHistory({ id: 'holdingUid' });

expect(screen.getByText(receivingHistory[0].enumeration)).toBeInTheDocument();
expect(screen.getByText(receivingHistory[0].chronology)).toBeInTheDocument();
});

it('should apply sort by a column', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
QueryClient,
QueryClientProvider,
} from 'react-query';
import { renderHook } from '@testing-library/react-hooks';
import { renderHook } from '@folio/jest-config-stripes/testing-library/react-hooks';

import '../../../../test/jest/__mock__';

Expand Down
2 changes: 1 addition & 1 deletion src/Instance/DnDContext.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { render } from '@testing-library/react';
import { render } from '@folio/jest-config-stripes/testing-library/react';
import DnDContext from './DnDContext';

describe('DnDContext', () => {
Expand Down
4 changes: 2 additions & 2 deletions src/Instance/HoldingsList/Holding/Holding.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { BrowserRouter as Router } from 'react-router-dom';
import { screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { screen } from '@folio/jest-config-stripes/testing-library/react';
import userEvent from '@folio/jest-config-stripes/testing-library/user-event';

import '../../../../test/jest/__mock__';

Expand Down
4 changes: 2 additions & 2 deletions src/Instance/HoldingsList/Holding/HoldingAccordion.test.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React from 'react';
import { BrowserRouter as Router } from 'react-router-dom';
import { noop } from 'lodash';
import userEvent from '@testing-library/user-event';
import userEvent from '@folio/jest-config-stripes/testing-library/user-event';
import { act } from 'react-dom/test-utils';
import { screen, waitFor } from '@testing-library/react';
import { screen, waitFor } from '@folio/jest-config-stripes/testing-library/react';

import '../../../../test/jest/__mock__';

Expand Down
4 changes: 2 additions & 2 deletions src/Instance/HoldingsList/Holding/HoldingButtonsGroup.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { BrowserRouter as Router } from 'react-router-dom';
import { screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { screen } from '@folio/jest-config-stripes/testing-library/react';
import userEvent from '@folio/jest-config-stripes/testing-library/user-event';

import '../../../../test/jest/__mock__';

Expand Down
4 changes: 2 additions & 2 deletions src/Instance/HoldingsList/Holding/HoldingContainer.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { render, screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { render, screen } from '@folio/jest-config-stripes/testing-library/react';
import userEvent from '@folio/jest-config-stripes/testing-library/user-event';
import '../../../../test/jest/__mock__';
import { IntlProvider } from 'react-intl';
import { MemoryRouter } from 'react-router-dom';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { screen } from '@folio/jest-config-stripes/testing-library/react';
import userEvent from '@folio/jest-config-stripes/testing-library/user-event';
import { Router } from 'react-router';
import { createMemoryHistory } from 'history';
import { DataContext } from '../../../../contexts';
Expand Down
Loading

0 comments on commit a77d1a0

Please sign in to comment.