Skip to content

Commit

Permalink
Release v10.0.4 (#2586)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
Co-authored-by: John Coburn <[email protected]>
Co-authored-by: Artem Blazhko <[email protected]>
  • Loading branch information
4 people authored Nov 10, 2023
1 parent c07da3f commit 987b1b7
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 7 deletions.
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)

Expand Down Expand Up @@ -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)

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/users",
"version": "10.0.3",
"version": "10.0.4",
"description": "User management",
"repository": "folio-org/ui-users",
"publishConfig": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 }),
}
});

Expand Down
26 changes: 26 additions & 0 deletions src/routes/LoansListingContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
36 changes: 34 additions & 2 deletions src/routes/UserSearchContainer.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import {
cloneDeep,
get,
template,
} from 'lodash';
Expand Down Expand Up @@ -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',
Expand All @@ -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 {
Expand Down Expand Up @@ -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',
},
Expand Down
9 changes: 7 additions & 2 deletions src/views/UserEdit/UserForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -132,18 +134,21 @@ class UserForm extends React.Component {
},
{
name: 'expandAllSections',
handler: this.expandAllSections,
handler: this.handleExpandAll,
},
{
name: 'collapseAllSections',
handler: this.collapseAllSections,
handler: this.handleCollapseAll,
}
];

this.buttonRefs = [];
this.setButtonRef = el => this.buttonRefs.push(el);
}

handleCollapseAll = (e) => collapseAllSections(e, this.accordionStatusRef);
handleExpandAll = (e) => expandAllSections(e, this.accordionStatusRef);

handleCancel = () => {
const {
match: {
Expand Down

0 comments on commit 987b1b7

Please sign in to comment.