Skip to content

Commit

Permalink
Release 9.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
artem-blazhko committed Sep 13, 2024
1 parent ac47b47 commit a1f23ac
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 62 deletions.
26 changes: 3 additions & 23 deletions .github/workflows/build-npm-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,9 @@ jobs:
NODEJS_VERSION: '18'
JEST_JUNIT_OUTPUT_DIR: 'artifacts/jest-junit'
JEST_COVERAGE_REPORT_DIR: 'artifacts/coverage-jest/lcov-report/'
BIGTEST_JUNIT_OUTPUT_DIR: 'artifacts/runTest'
BIGTEST_COVERAGE_REPORT_DIR: 'artifacts/coverage/lcov-report/'
OKAPI_PULL: '{ "urls" : [ "https://folio-registry.dev.folio.org" ] }'
SQ_LCOV_REPORT: 'artifacts/coverage-jest/lcov.info'
SQ_EXCLUSIONS: '**/platform/alias-service.js,**/docs/**,**/node_modules/**,**/examples/**,**/artifacts/**,**/ci/**,Jenkinsfile,**/LICENSE,**/*.css,**/*.md,**/*.json,**/tests/**,**/stories/*.js,**/test/**,**/.stories.js,**/resources/bigtest/interactors/**,**/resources/bigtest/network/**,**/*-test.js,**/*.test.js,**/*-spec.js,**/karma.conf.js,**/jest.config.js'
SQ_EXCLUSIONS: '**/platform/alias-service.js,**/docs/**,**/node_modules/**,**/examples/**,**/artifacts/**,**/ci/**,Jenkinsfile,**/LICENSE,**/*.css,**/*.md,**/*.json,**/tests/**,**/stories/*.js,**/test/**,**/.stories.js,**/*-test.js,**/*.test.js,**/*-spec.js,**/karma.conf.js,**/jest.config.js'

runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -152,33 +150,15 @@ jobs:
comment_title: Jest Unit Test Statistics

- name: Publish Jest coverage report
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
if: always()
with:
name: jest-coverage-report
path: ${{ env.JEST_COVERAGE_REPORT_DIR }}
retention-days: 30

- name: Publish BigTest unit test results
uses: docker://ghcr.io/enricomi/publish-unit-test-result-action:v1
if: always()
with:
github_token: ${{ github.token }}
files: "${{ env.BIGTEST_JUNIT_OUTPUT_DIR }}/*.xml"
check_name: BigTest Unit Test Results
comment_mode: update last
comment_title: BigTest Unit Test Statistics

- name: Publish BigTest coverage report
uses: actions/upload-artifact@v2
if: always()
with:
name: bigtest-coverage-report
path: ${{ env.BIGTEST_COVERAGE_REPORT_DIR }}
retention-days: 30

- name: Publish yarn.lock
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
if: failure()
with:
name: yarn.lock
Expand Down
26 changes: 3 additions & 23 deletions .github/workflows/build-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,8 @@ jobs:
NODEJS_VERSION: '18'
JEST_JUNIT_OUTPUT_DIR: 'artifacts/jest-junit'
JEST_COVERAGE_REPORT_DIR: 'artifacts/coverage-jest/lcov-report/'
BIGTEST_JUNIT_OUTPUT_DIR: 'artifacts/runTest'
BIGTEST_COVERAGE_REPORT_DIR: 'artifacts/coverage/lcov-report/'
SQ_LCOV_REPORT: 'artifacts/coverage-jest/lcov.info'
SQ_EXCLUSIONS: '**/platform/alias-service.js,**/docs/**,**/node_modules/**,**/examples/**,**/artifacts/**,**/ci/**,Jenkinsfile,**/LICENSE,**/*.css,**/*.md,**/*.json,**/tests/**,**/stories/*.js,**/test/**,**/.stories.js,**/resources/bigtest/interactors/**,**/resources/bigtest/network/**,**/*-test.js,**/*.test.js,**/*-spec.js,**/karma.conf.js,**/jest.config.js'
SQ_EXCLUSIONS: '**/platform/alias-service.js,**/docs/**,**/node_modules/**,**/examples/**,**/artifacts/**,**/ci/**,Jenkinsfile,**/LICENSE,**/*.css,**/*.md,**/*.json,**/tests/**,**/stories/*.js,**/test/**,**/.stories.js,**/*-test.js,**/*.test.js,**/*-spec.js,**/karma.conf.js,**/jest.config.js'

runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -95,33 +93,15 @@ jobs:
comment_title: Jest Unit Test Statistics

- name: Publish Jest coverage report
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
if: always()
with:
name: jest-coverage-report
path: ${{ env.JEST_COVERAGE_REPORT_DIR }}
retention-days: 30

- name: Publish BigTest unit test results
uses: docker://ghcr.io/enricomi/publish-unit-test-result-action:v1
if: always()
with:
github_token: ${{ github.token }}
files: "${{ env.BIGTEST_JUNIT_OUTPUT_DIR }}/*.xml"
check_name: BigTest Unit Test Results
comment_mode: update last
comment_title: BigTest Unit Test Statistics

- name: Publish BigTest coverage report
uses: actions/upload-artifact@v2
if: always()
with:
name: bigtest-coverage-report
path: ${{ env.BIGTEST_COVERAGE_REPORT_DIR }}
retention-days: 30

- name: Publish yarn.lock
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
if: failure()
with:
name: yarn.lock
Expand Down
11 changes: 9 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
# Change history for ui-requests

## [9.1.1] (https://github.com/folio-org/ui-checkin/tree/v9.1.1) (2024-03-27)
[Full Changelog](https://github.com/folio-org/ui-checkin/compare/v9.1.0...v9.1.1)
## [9.1.2] (https://github.com/folio-org/ui-requests/tree/v9.1.2) (2024-09-13)
[Full Changelog](https://github.com/folio-org/ui-requests/compare/v9.1.1...v9.1.2)

* Remove bigtests from github actions. Refs UIREQ-1099.
* Fix issue with Proxy's patron group and delivery address that shown instead of Sponsor's when creating request. Refs UIREQ-1132, UIREQ-1133.
* Update upload-artifact actions from v1 and v2 to v4. Refs UIREQ-1150.

## [9.1.1] (https://github.com/folio-org/ui-requests/tree/v9.1.1) (2024-03-27)
[Full Changelog](https://github.com/folio-org/ui-requests/compare/v9.1.0...v9.1.1)

* Add support for Barcode tag with sanitize. Refs UIREQ-1080, UIREQ-1082.

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/requests",
"version": "9.1.1",
"version": "9.1.2",
"description": "Requests manager",
"repository": "folio-org/ui-requests",
"publishConfig": {
Expand Down
27 changes: 14 additions & 13 deletions src/RequestForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ import {
isSubmittingButtonDisabled,
isFormEditing,
resetFieldState,
getRequester,
} from './utils';

import css from './requests.css';
Expand Down Expand Up @@ -186,7 +187,7 @@ class RequestForm extends React.Component {
const { titleLevelRequestsFeatureEnabled } = this.getTlrSettings();

this.state = {
proxy: {},
proxy: null,
selectedLoan: loan,
...getDefaultRequestPreferences(request, initialValues),
isAwaitingForProxySelection: false,
Expand Down Expand Up @@ -452,17 +453,13 @@ class RequestForm extends React.Component {
const {
form,
selectedUser,
onSetSelectedUser,
} = this.props;

if (selectedUser.id === proxy.id) {
onSetSelectedUser(selectedUser);
this.setState({
proxy: selectedUser,
});
form.change(REQUEST_FORM_FIELD_NAMES.REQUESTER_ID, selectedUser.id);
} else {
onSetSelectedUser(selectedUser);
this.setState({
proxy,
requestTypes: {},
Expand Down Expand Up @@ -767,6 +764,7 @@ class RequestForm extends React.Component {
onSetSelectedItem,
selectedUser,
} = this.props;
const { proxy } = this.state;

this.setState({
isItemOrInstanceLoading: true,
Expand Down Expand Up @@ -816,7 +814,8 @@ class RequestForm extends React.Component {
})
.then(item => {
if (item && selectedUser?.id) {
this.findRequestTypes(item.id, selectedUser.id, ID_TYPE_MAP.ITEM_ID);
const requester = getRequester(proxy, selectedUser);
this.findRequestTypes(item.id, requester.id, ID_TYPE_MAP.ITEM_ID);
}

return item;
Expand Down Expand Up @@ -849,6 +848,7 @@ class RequestForm extends React.Component {
onSetSelectedInstance,
selectedUser,
} = this.props;
const { proxy } = this.state;

this.setState({
isItemOrInstanceLoading: true,
Expand Down Expand Up @@ -897,7 +897,8 @@ class RequestForm extends React.Component {
})
.then(instance => {
if (instance && selectedUser?.id) {
this.findRequestTypes(instance.id, selectedUser.id, ID_TYPE_MAP.INSTANCE_ID);
const requester = getRequester(proxy, selectedUser);
this.findRequestTypes(instance.id, requester.id, ID_TYPE_MAP.INSTANCE_ID);
}

return instance;
Expand Down Expand Up @@ -1137,26 +1138,26 @@ class RequestForm extends React.Component {
const patronBlocks = onGetPatronManualBlocks(parentResources);
const automatedPatronBlocks = onGetAutomatedPatronBlocks(parentResources);
const isEditForm = isFormEditing(request);

const selectedProxy = getProxy(request, proxy);
const requester = getRequester(selectedProxy, selectedUser);
let deliveryLocations;
let deliveryLocationsDetail = [];
let addressDetail;
if (selectedUser && selectedUser.personal && selectedUser.personal.addresses) {
deliveryLocations = selectedUser.personal.addresses.map((a) => {
if (requester?.personal?.addresses) {
deliveryLocations = requester.personal.addresses.map((a) => {
const typeName = find(addressTypes, { id: a.addressTypeId }).addressType;
return { label: typeName, value: a.addressTypeId };
});
deliveryLocations = sortBy(deliveryLocations, ['label']);
deliveryLocationsDetail = keyBy(selectedUser.personal.addresses, a => a.addressTypeId);
deliveryLocationsDetail = keyBy(requester.personal.addresses, a => a.addressTypeId);
}

if (selectedAddressTypeId) {
addressDetail = toUserAddress(deliveryLocationsDetail[selectedAddressTypeId]);
}

const patronGroup = getPatronGroup(selectedUser, patronGroups);
const patronGroup = getPatronGroup(requester, patronGroups);
const fulfillmentTypeOptions = getFulfillmentTypeOptions(hasDelivery, optionLists?.fulfillmentTypes || []);
const selectedProxy = getProxy(request, proxy);
const isSubmittingDisabled = isSubmittingButtonDisabled(pristine, submitting);
const isTitleLevelRequest = createTitleLevelRequest || request?.requestLevel === REQUEST_LEVEL_TYPES.TITLE;
const getPatronBlockModalOpenStatus = () => {
Expand Down
10 changes: 10 additions & 0 deletions src/RequestForm.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import {
isFormEditing,
getFulfillmentPreference,
resetFieldState,
getRequester,
} from './utils';

const testIds = {
Expand Down Expand Up @@ -70,6 +71,7 @@ jest.mock('./utils', () => ({
getDefaultRequestPreferences: jest.fn(),
isFormEditing: jest.fn(),
getFulfillmentPreference: jest.fn(),
getRequester: jest.fn((proxy, selectedUser) => selectedUser),
}));
jest.mock('./components/FulfilmentPreference', () => jest.fn(({
changeDeliveryAddress,
Expand Down Expand Up @@ -1323,6 +1325,10 @@ describe('RequestForm', () => {
expect(resetFieldState).toHaveBeenCalledWith(...expectedArgs);
});

it('should get requester information', () => {
expect(getRequester).toHaveBeenCalled();
});

it('should get information about loans', () => {
const expectedArgs = [
'loan',
Expand Down Expand Up @@ -1632,6 +1638,10 @@ describe('RequestForm', () => {
expect(resetFieldState).toHaveBeenCalledWith(...expectedArgs);
});

it('should get requester information', () => {
expect(getRequester).toHaveBeenCalled();
});

it('should get information about open instance requests', () => {
const expectedArgs = [
'requestsForInstance',
Expand Down
8 changes: 8 additions & 0 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -456,3 +456,11 @@ export function resetFieldState(form, fieldName) {
form.resetFieldState(fieldName);
}
}

export const getRequester = (proxy, selectedUser) => {
if (proxy && proxy.id !== selectedUser?.id) {
return proxy;
}

return selectedUser;
};
19 changes: 19 additions & 0 deletions src/utils.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import {
resetFieldState,
getRequestTypeOptions,
isVirtualItem,
getRequester,
} from './utils';

import {
Expand Down Expand Up @@ -859,3 +860,21 @@ describe('getRequestTypeOptions', () => {
expect(getRequestTypeOptions(requestTypes)).toEqual(expectedResult);
});
});

describe('getRequester', () => {
const selectedUser = {
id: 'selectedUserId',
};

it('should return proxy user', () => {
const proxy = {
id: 'proxyId',
};

expect(getRequester(proxy, selectedUser)).toEqual(proxy);
});

it('should return selected user', () => {
expect(getRequester(null, selectedUser)).toEqual(selectedUser);
});
});

0 comments on commit a1f23ac

Please sign in to comment.