From 987b1b7e1e54aaa8d0d8830cfcb2686f291e9249 Mon Sep 17 00:00:00 2001 From: Priyanka Terala <104053200+Terala-Priyanka@users.noreply.github.com> Date: Fri, 10 Nov 2023 19:32:00 +0530 Subject: [PATCH] Release v10.0.4 (#2586) * UIU-2977 x-okapi-token header must always be optional (#2578) The `X-Okapi-Token` header is optional and should only be included when a token value is present on the `stripes.okapi` object. Refs UIU-2977 * UIU-2959 Accordion collapse/expand all shortcuts not working on Edit form. (#2566) * use handlers frome stripes-components * update yarn.lock * log changes * update yarn lock * UIU-2973 - Update patron groups retrieval in user search to hold maxUnpagedResourceCount (#2583) * UIU-2995 - Update resourceData and queryParams in UserSearchContainer.js to escape special characters in tags filter (#2584) * UIU-2995 - Update resourceData and queryParams in UserSearchContainer.js to escape special characters in tags filter * UIU-2995 - Upade changelog description * UIU-2955 - add a header comment to escapeSpecialCharactersInTagFilters function * Add the possibility to do "Claim returned" from action menu (#2585) * Release v10.0.4 --------- Co-authored-by: Zak Burke Co-authored-by: John Coburn Co-authored-by: Artem Blazhko --- CHANGELOG.md | 10 +++++- package.json | 2 +- .../PermissionsModal/PermissionsModal.js | 2 +- src/routes/LoansListingContainer.js | 26 ++++++++++++++ src/routes/UserSearchContainer.js | 36 +++++++++++++++++-- src/views/UserEdit/UserForm.js | 9 +++-- 6 files changed, 78 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e93cc7ba4..7325ac859 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Change history for ui-users +## [10.0.4](https://github.com/folio-org/ui-users/tree/v10.0.4) (2023-11-10) +[Full Changelog](https://github.com/folio-org/ui-users/compare/v10.0.3...v10.0.4) + +* Correctly handle optional `X-Okapi-token` request header. Refs UIU-2977. +* Fix bug with Edit form Expand/collapse all shortcuts not working. Refs UIU-2959. +* Update patron groups retrieval in user search to hold `maxUnpagedResourceCount`. Refs UIU-2973. +* Update resourceData and queryParams in `UserSearchContainer.js` to escape special characters in tags filter. Refs. UIU-2995. +* Lost item fees not suspended when item is claimed returned from the ellipses in action menu. Refs UIU-2993. + ## [10.0.3](https://github.com/folio-org/ui-users/tree/v10.0.3) (2023-10-23) [Full Changelog](https://github.com/folio-org/ui-users/compare/v10.0.1...v10.0.3) @@ -120,7 +129,6 @@ * Fix problem with remaining amount (not shown correct value after filling the payment amount). Refs UIU-2812. * Correctly handle removing all permissions from given user. Fixes UIU-2822. - ## [9.0.0](https://github.com/folio-org/ui-users/tree/v9.0.0) (2023-02-20) [Full Changelog](https://github.com/folio-org/ui-users/compare/v8.1.0...v9.0.0) diff --git a/package.json b/package.json index 452f8a0a9..a60b19a64 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@folio/users", - "version": "10.0.3", + "version": "10.0.4", "description": "User management", "repository": "folio-org/ui-users", "publishConfig": { diff --git a/src/components/PermissionsAccordion/components/PermissionsModal/PermissionsModal.js b/src/components/PermissionsAccordion/components/PermissionsModal/PermissionsModal.js index 4cdbcced2..d284a69da 100644 --- a/src/components/PermissionsAccordion/components/PermissionsModal/PermissionsModal.js +++ b/src/components/PermissionsAccordion/components/PermissionsModal/PermissionsModal.js @@ -170,7 +170,7 @@ class PermissionsModal extends React.Component { const permissions = await GET({ headers: { [OKAPI_TENANT_HEADER]: tenantId || okapi.tenant, - [OKAPI_TOKEN_HEADER]: okapi.token, + ...(okapi.token && { [OKAPI_TOKEN_HEADER]: okapi.token }), } }); diff --git a/src/routes/LoansListingContainer.js b/src/routes/LoansListingContainer.js index a4461092a..048103072 100644 --- a/src/routes/LoansListingContainer.js +++ b/src/routes/LoansListingContainer.js @@ -12,6 +12,32 @@ import { LoansListing } from '../views'; class LoansListingContainer extends React.Component { static manifest = Object.freeze({ + accounts: { + type: 'okapi', + records: 'accounts', + PUT: { + path: 'accounts/%{activeAccount.id}' + }, + fetch: false, + accumulate: true, + }, + feefineactions: { + type: 'okapi', + records: 'feefineactions', + path: 'feefineactions', + fetch: false, + accumulate: true, + }, + loanstorage: { + type: 'okapi', + PUT: { + path: 'loan-storage/loans/%{activeLoanStorage.id}' + }, + fetch: false, + accumulate: true, + }, + activeAccount: {}, + activeLoanStorage: {}, query: {}, selUser: { type: 'okapi', diff --git a/src/routes/UserSearchContainer.js b/src/routes/UserSearchContainer.js index dd7f5648f..2019a33e4 100644 --- a/src/routes/UserSearchContainer.js +++ b/src/routes/UserSearchContainer.js @@ -1,6 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { + cloneDeep, get, template, } from 'lodash'; @@ -34,8 +35,39 @@ const searchFields = [ ]; const compileQuery = template(`(${searchFields.join(' or ')})`, { interpolate: /%{([\s\S]+?)}/g }); +/* + Some of the special characters that are allowed while creating a tag are "", \, *, ? + These special characters cause CQL exceptions while searching the user records, which are + assigned with such tags. + This function "escapeSpecialCharactersInTagFilters" intends to escape the special characters + in filters of type "Tags" + Ref: https://issues.folio.org/browse/UIU-2995 +*/ + +const escapeSpecialCharactersInTagFilters = (queryParams, resourceData) => { + const newResourceData = cloneDeep(resourceData); + let escapedFilters; + + if (resourceData.query.filters) { + const filterArr = resourceData.query.filters.split(','); + escapedFilters = filterArr.map(f => { + let newF = f; + if (f.startsWith('tags.')) { + newF = f.replace(/["^*?\\]/g, c => '\\' + c); + } + return newF; + }); + escapedFilters = escapedFilters.join(','); + + newResourceData.query.filters = escapedFilters; + queryParams.filters = escapedFilters; + } + return newResourceData; +}; + export function buildQuery(queryParams, pathComponents, resourceData, logger, props) { const customFilterConfig = buildFilterConfig(queryParams.filters); + const newResourceData = escapeSpecialCharactersInTagFilters(queryParams, resourceData); return makeQueryFunction( 'cql.allRecords=1', @@ -53,7 +85,7 @@ export function buildQuery(queryParams, pathComponents, resourceData, logger, pr }, [...filterConfig, ...customFilterConfig], 2, - )(queryParams, pathComponents, resourceData, logger, props); + )(queryParams, pathComponents, newResourceData, logger, props); } class UserSearchContainer extends React.Component { @@ -83,7 +115,7 @@ class UserSearchContainer extends React.Component { path: 'groups', params: { query: 'cql.allRecords=1 sortby group', - limit: '200', + limit: (q, p, r, l, props) => props?.stripes?.config?.maxUnpagedResourceCount || '200', }, records: 'usergroups', }, diff --git a/src/views/UserEdit/UserForm.js b/src/views/UserEdit/UserForm.js index 98c5d75b2..648f62022 100644 --- a/src/views/UserEdit/UserForm.js +++ b/src/views/UserEdit/UserForm.js @@ -20,6 +20,8 @@ import { AccordionSet, AccordionStatus, HasCommand, + expandAllSections, + collapseAllSections } from '@folio/stripes/components'; import { EditCustomFieldsRecord } from '@folio/stripes/smart-components'; import stripesFinalForm from '@folio/stripes/final-form'; @@ -132,11 +134,11 @@ class UserForm extends React.Component { }, { name: 'expandAllSections', - handler: this.expandAllSections, + handler: this.handleExpandAll, }, { name: 'collapseAllSections', - handler: this.collapseAllSections, + handler: this.handleCollapseAll, } ]; @@ -144,6 +146,9 @@ class UserForm extends React.Component { this.setButtonRef = el => this.buttonRefs.push(el); } + handleCollapseAll = (e) => collapseAllSections(e, this.accordionStatusRef); + handleExpandAll = (e) => expandAllSections(e, this.accordionStatusRef); + handleCancel = () => { const { match: {