Skip to content

Commit

Permalink
Merge branch 'master' into UIIN-2647
Browse files Browse the repository at this point in the history
  • Loading branch information
OleksandrHladchenko1 authored Nov 3, 2023
2 parents 6146b45 + c843e32 commit ed35074
Show file tree
Hide file tree
Showing 16 changed files with 283 additions and 233 deletions.
6 changes: 4 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# Change history for ui-inventory

## [11.0.0] IN PROGRESS

## [10.1.0] IN PROGRESS

* *BREAKING* Replace imports from quick-marc with stripes-marc-components. Refs UIIN-2636.
* Make Inventory search and browse query boxes expandable. Refs UIIN-2493.
* Added support for `containsAny` match option in Advanced search. Refs UIIN-2486.
* Inventory search/browse: Do not retain checkbox selections when toggling search segment. Refs UIIN-2477.

## [10.0.1] IN PROGRESS

Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@folio/inventory",
"version": "10.1.0",
"version": "11.0.0",
"description": "Inventory manager",
"repository": "folio-org/ui-inventory",
"publishConfig": {
Expand Down Expand Up @@ -862,6 +862,7 @@
"@folio/stripes-components": "^12.0.0",
"@folio/stripes-connect": "^9.0.0",
"@folio/stripes-core": "^10.0.0",
"@folio/stripes-marc-components": "^1.0.0",
"@folio/stripes-smart-components": "^9.0.0",
"@folio/stripes-testing": "^4.6.0",
"@folio/stripes-util": "^6.0.0",
Expand All @@ -882,7 +883,6 @@
"zustand": "^4.1.1"
},
"dependencies": {
"@folio/quick-marc": "^7.0.0",
"@folio/stripes-acq-components": "^5.0.0",
"classnames": "^2.3.2",
"file-saver": "^2.0.0",
Expand All @@ -904,6 +904,7 @@
},
"peerDependencies": {
"@folio/stripes": "^9.0.0",
"@folio/stripes-marc-components": "^1.0.0",
"react": "^18.2.0",
"react-intl": "^6.4.4",
"react-query": "^3.6.0",
Expand Down
4 changes: 2 additions & 2 deletions src/ViewHoldingsRecord.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class ViewHoldingsRecord extends React.Component {
path: 'holdings-storage/holdings/:{holdingsrecordid}',
resourceShouldRefresh: false,
accumulate: true,
tenant: '!{location.state.tenantTo}'
tenant: '!{tenantTo}',
},
items: {
type: 'okapi',
Expand All @@ -97,7 +97,7 @@ class ViewHoldingsRecord extends React.Component {
type: 'okapi',
path: 'inventory/instances/:{id}',
accumulate: true,
tenant: '!{location.state.tenantTo}'
tenant: '!{tenantTo}',
},
tagSettings: {
type: 'okapi',
Expand Down
7 changes: 6 additions & 1 deletion src/components/InstancesList/InstancesList.js
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,11 @@ class InstancesList extends React.Component {
document.getElementById('input-inventory-search').focus();
}

handleSearchSegmentChange = (segment) => {
this.refocusOnInputSearch(segment);
this.setState({ selectedRows: {} });
}

onSearchModeSwitch = () => {
const {
namespace,
Expand All @@ -415,7 +420,7 @@ class InstancesList extends React.Component {
/>
<FilterNavigation
segment={this.props.segment}
onChange={this.refocusOnInputSearch}
onChange={this.handleSearchSegmentChange}
/>
</>
);
Expand Down
16 changes: 16 additions & 0 deletions src/components/InstancesList/InstancesList.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,22 @@ describe('InstancesList', () => {
});
});

describe('when search segment is changed', () => {
it('should clear selected rows', () => {
const {
getAllByLabelText,
getByText,
} = renderInstancesList({
segment: 'instances',
});

fireEvent.click(getAllByLabelText('Select instance')[0]);
fireEvent.click(getByText('Holdings'));

expect(getAllByLabelText('Select instance')[0].checked).toBeFalsy();
});
});

describe('when a user performs a search and clicks the `Next` button in the list of records', () => {
describe('then clicks on the `Browse` lookup tab and then clicks `Search` lookup tab', () => {
it('should avoid infinity loading by resetting the records on unmounting', () => {
Expand Down
8 changes: 5 additions & 3 deletions src/components/ViewSource/ViewSource.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ import {
LoadingView,
} from '@folio/stripes/components';
import { useStripes } from '@folio/stripes/core';
import MarcView from '@folio/quick-marc/src/QuickMarcView/QuickMarcView';
import PrintPopup from '@folio/quick-marc/src/QuickMarcView/PrintPopup';
import { getHeaders } from '@folio/quick-marc/src/QuickMarcEditor/utils';
import {
MarcView,
PrintPopup,
getHeaders,
} from '@folio/stripes-marc-components';

import { useGoBack } from '../../common/hooks';

Expand Down
10 changes: 5 additions & 5 deletions src/components/ViewSource/ViewSource.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,18 +89,18 @@ describe('ViewSource', () => {
});
});

it('should render QuickMarcView', () => {
expect(screen.getByText('QuickMarcView')).toBeInTheDocument();
it('should render MarcView', () => {
expect(screen.getByText('MarcView')).toBeInTheDocument();
});

it('should initiate useGoBack with correct path', () => {
expect(useGoBack).toBeCalledWith('/inventory/view/instance-id');
});

describe('when QuickMarcView is closed', () => {
describe('when MarcView is closed', () => {
it('should call onClose with correct url', async () => {
await waitFor(() => expect(screen.getByText('QuickMarcView')).toBeInTheDocument());
act(() => fireEvent.click(screen.getByText('QuickMarcView')));
await waitFor(() => expect(screen.getByText('MarcView')).toBeInTheDocument());
act(() => fireEvent.click(screen.getByText('MarcView')));
expect(mockGoBack).toBeCalledTimes(1);
});
});
Expand Down
29 changes: 29 additions & 0 deletions src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -466,146 +466,175 @@ export const fieldSearchConfigurations = {
exactPhrase: 'keyword=="%{query.query}"',
containsAll: 'keyword all "%{query.query}"',
startsWith: 'keyword all "%{query.query}*"',
containsAny: 'keyword any "%{query.query}"',
},
contributor: {
exactPhrase: 'contributors.name=="%{query.query}"',
containsAll: 'contributors.name="*%{query.query}*"',
startsWith: 'contributors.name="%{query.query}*"',
containsAny: 'contributors.name any "*%{query.query}*"',
},
title: {
exactPhrase: 'title=="%{query.query}"',
containsAll: 'title all "%{query.query}"',
startsWith: 'title all "%{query.query}*"',
containsAny: 'title any "%{query.query}"',
},
isbn: {
exactPhrase: 'isbn=="%{query.query}"',
containsAll: 'isbn="*%{query.query}*"',
startsWith: 'isbn="%{query.query}*"',
containsAny: 'isbn any "*%{query.query}*"',
},
issn: {
exactPhrase: 'issn=="%{query.query}"',
containsAll: 'issn="*%{query.query}*"',
startsWith: 'issn="%{query.query}*"',
containsAny: 'issn any "*%{query.query}*"',
},
identifier: {
exactPhrase: 'identifiers.value=="%{query.query}"',
containsAll: 'identifiers.value="*%{query.query}*"',
startsWith: 'identifiers.value="%{query.query}*"',
containsAny: 'identifiers.value any "*%{query.query}*"',
},
oclc: {
exactPhrase: 'oclc=="%{query.query}"',
containsAll: 'oclc="*%{query.query}*"',
startsWith: 'oclc="%{query.query}*"',
containsAny: 'oclc any "*%{query.query}*"',
},
instanceNotes: {
exactPhrase: 'notes.note=="%{query.query}" or administrativeNotes=="%{query.query}"',
containsAll: 'notes.note all "%{query.query}" or administrativeNotes all "%{query.query}"',
startsWith: 'notes.note all "%{query.query}*" or administrativeNotes all "%{query.query}*"',
containsAny: 'notes.note any "%{query.query}" or administrativeNotes any "%{query.query}"',
},
instanceAdministrativeNotes: {
exactPhrase: 'administrativeNotes=="%{query.query}"',
containsAll: 'administrativeNotes all "%{query.query}"',
startsWith: 'administrativeNotes all "%{query.query}*"',
containsAny: 'administrativeNotes any "%{query.query}"',
},
subject: {
exactPhrase: 'subjects.value=="%{query.query}"',
containsAll: 'subjects.value all "%{query.query}"',
startsWith: 'subjects.value=="%{query.query}*"',
containsAny: 'subjects.value any "%{query.query}"',
},
callNumber: {
exactPhrase: 'itemEffectiveShelvingOrder=="%{query.query}"',
containsAll: 'itemEffectiveShelvingOrder="*%{query.query}*"',
startsWith: 'itemEffectiveShelvingOrder=="%{query.query}*"',
containsAny: 'itemEffectiveShelvingOrder any "*%{query.query}*"',
},
hrid: {
exactPhrase: 'hrid=="%{query.query}"',
containsAll: 'hrid=="*%{query.query}*"',
startsWith: 'hrid=="%{query.query}*"',
containsAny: 'hrid any "*%{query.query}*"',
},
id: {
exactPhrase: 'id=="%{query.query}"',
containsAll: 'id="*%{query.query}*"',
startsWith: 'id="%{query.query}*"',
containsAny: 'id any "*%{query.query}*"',
},
authorityId: {
exactPhrase: 'authorityId == %{query.query}',
containsAll: 'authorityId=="*%{query.query}*"',
startsWith: 'authorityId=="%{query.query}*"',
containsAny: 'authorityId any "*%{query.query}*"',
},
allFields: {
exactPhrase: 'cql.all=="%{query.query}"',
containsAll: 'cql.all all "%{query.query}"',
startsWith: 'cql.all all "%{query.query}*"',
containsAny: 'cql.all any "%{query.query}"',
},
holdingsFullCallNumbers: {
exactPhrase: 'holdingsFullCallNumbers=="%{query.query}"',
containsAll: 'holdingsFullCallNumbers="*%{query.query}*"',
startsWith: 'holdingsFullCallNumbers="%{query.query}*"',
containsAny: 'holdingsFullCallNumbers any "*%{query.query}*"',
},
holdingsNormalizedCallNumbers: {
exactPhrase: 'holdingsNormalizedCallNumbers=="%{query.query}"',
containsAll: 'holdingsNormalizedCallNumbers="*%{query.query}*"',
startsWith: 'holdingsNormalizedCallNumbers="%{query.query}*"',
containsAny: 'holdingsNormalizedCallNumbers any "*%{query.query}*"',
},
holdingsNotes: {
exactPhrase: 'holdings.notes.note=="%{query.query}" or holdings.administrativeNotes=="%{query.query}"',
containsAll: 'holdings.notes.note all "%{query.query}" or holdings.administrativeNotes all "%{query.query}"',
startsWith: 'holdings.notes.note all "%{query.query}*" or holdings.administrativeNotes all "%{query.query}*"',
containsAny: 'holdings.notes.note any "%{query.query}" or holdings.administrativeNotes any "%{query.query}"',
},
holdingsAdministrativeNotes: {
exactPhrase: 'holdings.administrativeNotes=="%{query.query}"',
containsAll: 'holdings.administrativeNotes all "%{query.query}"',
startsWith: 'holdings.administrativeNotes all "%{query.query}*"',
containsAny: 'holdings.administrativeNotes any "%{query.query}"',
},
holdingsHrid: {
exactPhrase: 'holdings.hrid=="%{query.query}"',
containsAll: 'holdings.hrid=="*%{query.query}*"',
startsWith: 'holdings.hrid=="%{query.query}*"',
containsAny: 'holdings.hrid any "*%{query.query}*"',
},
hid: {
exactPhrase: 'holdings.id=="%{query.query}"',
containsAll: 'holdings.id="*%{query.query}*"',
startsWith: 'holdings.id="%{query.query}*"',
containsAny: 'holdings.id any "*%{query.query}*"',
},
barcode: {
exactPhrase: 'items.barcode=="%{query.query}"',
containsAll: 'items.barcode="*%{query.query}*"',
startsWith: 'items.barcode="%{query.query}*"',
containsAny: 'items.barcode any "*%{query.query}*"',
},
itemFullCallNumbers: {
exactPhrase: 'itemFullCallNumbers=="%{query.query}"',
containsAll: 'itemFullCallNumbers="*%{query.query}*"',
startsWith: 'itemFullCallNumbers="%{query.query}*"',
containsAny: 'itemFullCallNumbers any "*%{query.query}*"',
},
itemNormalizedCallNumbers: {
exactPhrase: 'itemNormalizedCallNumbers=="%{query.query}"',
containsAll: 'itemNormalizedCallNumbers="*%{query.query}*"',
startsWith: 'itemNormalizedCallNumbers="%{query.query}*"',
containsAny: 'itemNormalizedCallNumbers any "*%{query.query}*"',
},
itemNotes: {
exactPhrase: 'item.notes.note=="%{query.query}" or item.administrativeNotes=="%{query.query}"',
containsAll: 'item.notes.note all "%{query.query}" or item.administrativeNotes all "%{query.query}"',
startsWith: 'item.notes.note all "%{query.query}*" or item.administrativeNotes all "%{query.query}*"',
containsAny: 'item.notes.note any "%{query.query}" or item.administrativeNotes any "%{query.query}"',
},
itemAdministrativeNotes: {
exactPhrase: 'item.administrativeNotes=="%{query.query}"',
containsAll: 'item.administrativeNotes all "%{query.query}"',
startsWith: 'item.administrativeNotes all "%{query.query}*"',
containsAny: 'item.administrativeNotes any "%{query.query}"',
},
itemCirculationNotes: {
exactPhrase: 'item.circulationNotes.note=="%{query.query}"',
containsAll: 'item.circulationNotes.note all "%{query.query}"',
startsWith: 'item.circulationNotes.note all "%{query.query}*"',
containsAny: 'item.circulationNotes.note any "%{query.query}"',
},
itemHrid: {
exactPhrase: 'items.hrid=="%{query.query}"',
containsAll: 'items.hrid="*%{query.query}*"',
startsWith: 'items.hrid="%{query.query}*"',
containsAny: 'items.hrid any "*%{query.query}*"',
},
iid: {
exactPhrase: 'item.id=="%{query.query}"',
containsAll: 'item.id="*%{query.query}*"',
startsWith: 'item.id="%{query.query}*"',
containsAny: 'item.id any "*%{query.query}*"',
},
};

Expand Down
Loading

0 comments on commit ed35074

Please sign in to comment.