Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UIIN-2910 *BREAKING* Added a new stripes-inventory-components dependency. Move some utils to that module. #2484

Merged
merged 4 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Change history for ui-inventory

## [11.1.0] (IN PROGRESS)
## [12.0.0] (IN PROGRESS)

* Remove unused code related to auto-open record detail view. Refs UIIN-2819.
* Keyboard shortcuts modal: Add quickMARC shortcuts to modal. Refs UIIN-2795.
Expand All @@ -22,6 +22,7 @@
* Jest/RTL: Cover LocationSelectionWithCheck components with unit tests. Refs UIIN-2670.
* Populate Acquisitions accordion on instance when central ordering is active. Refs UIIN-2793.
* Inventory app: Define and implement shortcut key for editing a quickMARC bib record. Refs UIIN-2896.
* *BREAKING* Added a new `stripes-inventory-components` dependency. Move some utils to that module. Refs UIIN-2910.

## [11.0.4](https://github.com/folio-org/ui-inventory/tree/v11.0.4) (2024-04-30)
[Full Changelog](https://github.com/folio-org/ui-inventory/compare/v11.0.3...v11.0.4)
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@folio/inventory",
"version": "11.0.4",
"version": "12.0.0",
"description": "Inventory manager",
"repository": "folio-org/ui-inventory",
"publishConfig": {
Expand Down Expand Up @@ -895,6 +895,7 @@
"@folio/stripes-components": "^12.1.2",
"@folio/stripes-connect": "^9.1.0",
"@folio/stripes-core": "^10.1.1",
"@folio/stripes-inventory-components": "^1.0.0",
"@folio/stripes-marc-components": "^1.0.1",
"@folio/stripes-smart-components": "^9.1.1",
"@folio/stripes-testing": "^4.6.0",
Expand Down Expand Up @@ -938,6 +939,7 @@
},
"peerDependencies": {
"@folio/stripes": "^9.1.2",
"@folio/stripes-inventory-components": "^1.0.0",
"@folio/stripes-marc-components": "^1.0.1",
"react": "^18.2.0",
"react-intl": "^6.4.4",
Expand Down
21 changes: 2 additions & 19 deletions src/components/InstancesList/InstancesList.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import {
TextLink,
DefaultMCLRowFormatter,
} from '@folio/stripes/components';
import { advancedSearchQueryBuilder } from '@folio/stripes-inventory-components';

import { withSingleRecordImport } from '..';
import FilterNavigation from '../FilterNavigation';
Expand Down Expand Up @@ -274,6 +275,7 @@ class InstancesList extends React.Component {
}

const searchParams = new URLSearchParams(location.search);

const filters = searchParams.get('filters');

const staffSuppressFalse = `${FACETS.STAFF_SUPPRESS}.false`;
Expand Down Expand Up @@ -1234,25 +1236,6 @@ class InstancesList extends React.Component {

const advancedSearchOptions = advancedSearchIndexes[segment].map(this.formatSearchableIndex);

const advancedSearchQueryBuilder = (rows) => {
const formatRowCondition = (row) => {
// use default row formatter, but wrap each search term with parentheses

const query = `${row.searchOption} ${row.match} ${row.query}`;
return query;
};

return rows.reduce((formattedQuery, row, index) => {
const rowCondition = formatRowCondition(row);

if (index === 0) {
return rowCondition;
}

return `${formattedQuery} ${row.bool} ${rowCondition}`;
}, '');
};

const shortcuts = [
{
name: 'new',
Expand Down
4 changes: 3 additions & 1 deletion src/constants.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import React from 'react';

import { ADVANCED_SEARCH_INDEX } from '@folio/stripes-inventory-components';

const AWAITING_DELIVERY = 'Awaiting delivery';
const AWAITING_PICKUP = 'Awaiting pickup';
const IN_TRANSIT = 'In transit';
Expand Down Expand Up @@ -212,7 +214,7 @@ export const queryIndexes = {
DEWEY_CLASSIFICATION: browseClassificationOptions.DEWEY_CLASSIFICATION,
LC_CLASSIFICATION: browseClassificationOptions.LC_CLASSIFICATION,
CONTRIBUTOR: 'contributor',
ADVANCED_SEARCH: 'advancedSearch',
ADVANCED_SEARCH: ADVANCED_SEARCH_INDEX,
};

export const indentifierTypeNames = {
Expand Down
8 changes: 5 additions & 3 deletions src/filterConfig.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { ADVANCED_SEARCH_INDEX } from '@folio/stripes-inventory-components';

import itemFilterRenderer from './components/ItemFilters/itemFilterRenderer';
import holdingsRecordFilterRenderer from './components/HoldingsRecordFilters/holdingsRecordFilterRenderer';
import instanceFilterRenderer from './components/InstanceFilters/instanceFilterRenderer';
Expand Down Expand Up @@ -194,7 +196,7 @@ export const instanceIndexes = [
{ label: 'ui-inventory.authorityId', value: 'authorityId', queryTemplate: 'authorityId == %{query.query}' },
{ label: 'ui-inventory.search.allFields', value: 'allFields', queryTemplate: 'cql.all="%{query.query}"' },
{ label: 'ui-inventory.querySearch', value: 'querySearch', queryTemplate: '%{query.query}' },
{ label: 'ui-inventory.advancedSearch', value: 'advancedSearch', queryTemplate: '%{query.query}' },
{ label: 'ui-inventory.advancedSearch', value: ADVANCED_SEARCH_INDEX, queryTemplate: '%{query.query}' },
];

export const browseFiltersConfig = [
Expand Down Expand Up @@ -301,7 +303,7 @@ export const holdingIndexes = [
{ label: 'ui-inventory.search.holdings.uuid', value: 'hid', queryTemplate: 'holdings.id=="%{query.query}"' },
{ label: 'ui-inventory.search.allFields', value: 'allFields', queryTemplate: 'cql.all="%{query.query}"' },
{ label: 'ui-inventory.querySearch', value: 'querySearch', queryTemplate: '%{query.query}' },
{ label: 'ui-inventory.advancedSearch', value: 'advancedSearch', queryTemplate: '%{query.query}' },
{ label: 'ui-inventory.advancedSearch', value: ADVANCED_SEARCH_INDEX, queryTemplate: '%{query.query}' },
];

export const holdingSortMap = {};
Expand Down Expand Up @@ -390,7 +392,7 @@ export const itemIndexes = [
{ label: 'ui-inventory.search.item.uuid', value: 'iid', queryTemplate: 'item.id=="%{query.query}"' },
{ label: 'ui-inventory.search.allFields', value: 'allFields', queryTemplate: 'cql.all="%{query.query}"' },
{ label: 'ui-inventory.querySearch', value: 'querySearch', queryTemplate: '%{query.query}' },
{ label: 'ui-inventory.advancedSearch', value: 'advancedSearch', queryTemplate: '%{query.query}' },
{ label: 'ui-inventory.advancedSearch', value: ADVANCED_SEARCH_INDEX, queryTemplate: '%{query.query}' },
];

export const itemFilterConfig = [
Expand Down
Loading