From ddd3519aa5e066e1a398a35fc8a79b965de73406 Mon Sep 17 00:00:00 2001 From: Uladzislau_Kutarkin Date: Wed, 8 Nov 2023 10:45:52 +0400 Subject: [PATCH 1/3] UIBULKED-353: Update Electronic access - URI --- .../ContentUpdatesForm/helpers.js | 18 ++++++++++- .../ContentUpdatesForm/helpers.test.js | 31 +++++++++++++++++++ src/constants/inAppActions.js | 6 ++++ src/constants/selectOptions.js | 9 +++++- translations/ui-bulk-edit/en.json | 2 ++ 5 files changed, 64 insertions(+), 2 deletions(-) diff --git a/src/components/BulkEditList/BulkEditListResult/BulkEditInApp/ContentUpdatesForm/helpers.js b/src/components/BulkEditList/BulkEditListResult/BulkEditInApp/ContentUpdatesForm/helpers.js index 691b55e2..e8b31ff8 100644 --- a/src/components/BulkEditList/BulkEditListResult/BulkEditInApp/ContentUpdatesForm/helpers.js +++ b/src/components/BulkEditList/BulkEditListResult/BulkEditInApp/ContentUpdatesForm/helpers.js @@ -19,7 +19,7 @@ import { statusActions, noteActions, noteActionsWithMark, - noteActionsWithDuplicate, + noteActionsWithDuplicate, electronicAccess, } from '../../../../../constants'; export const ACTION_VALUE_KEY = 'name'; @@ -91,6 +91,7 @@ export const getDefaultActions = (option, options, formatMessage) => { const noteDefaultActions = noteActions(formatMessage); const noteWithMarkDefaultActions = noteActionsWithMark(formatMessage); const noteDuplicateDefaultActions = noteActionsWithDuplicate(formatMessage); + const electronicAccessActions = electronicAccess(formatMessage); const replaceClearInitialVal = replaceClearDefaultActions[0].value; @@ -291,6 +292,20 @@ export const getDefaultActions = (option, options, formatMessage) => { ], }; + case OPTIONS.URI: + return { + type: '', + actions: [ + null, + { + actionsList: electronicAccessActions, + controlType: () => CONTROL_TYPES.TEXTAREA, + [ACTION_VALUE_KEY]: electronicAccessActions[0].value, + [FIELD_VALUE_KEY]: '', + }, + ], + }; + default: return { type: null, @@ -358,6 +373,7 @@ export const getExtraActions = (option, action, formattedMessage) => { switch (`${option}-${action}`) { case `${OPTIONS.ITEM_NOTE}-${ACTIONS.FIND}`: case `${OPTIONS.ADMINISTRATIVE_NOTE}-${ACTIONS.FIND}`: + case `${OPTIONS.URI}-${ACTIONS.FIND}`: case `${OPTIONS.CHECK_IN_NOTE}-${ACTIONS.FIND}`: case `${OPTIONS.CHECK_OUT_NOTE}-${ACTIONS.FIND}`: case `${OPTIONS.HOLDINGS_NOTE}-${ACTIONS.FIND}`: diff --git a/src/components/BulkEditList/BulkEditListResult/BulkEditInApp/ContentUpdatesForm/helpers.test.js b/src/components/BulkEditList/BulkEditListResult/BulkEditInApp/ContentUpdatesForm/helpers.test.js index f6023546..7fd9ea55 100644 --- a/src/components/BulkEditList/BulkEditListResult/BulkEditInApp/ContentUpdatesForm/helpers.test.js +++ b/src/components/BulkEditList/BulkEditListResult/BulkEditInApp/ContentUpdatesForm/helpers.test.js @@ -537,6 +537,37 @@ describe('ContentUpdatesForm helpers', () => { ); }); + it('returns the correct object for the URI option', () => { + expect(JSON.stringify(getDefaultActions(OPTIONS.URI, [], formatMessage))).toEqual( + JSON.stringify({ + type: '', + actions: [ + null, + { + actionsList: [{ + value: '', + disabled: true, + label: undefined, + }, + { value: 'CLEAR_FIELD', + disabled: false, + label: undefined }, + { value: 'REPLACE_WITH', + disabled: false, + label: undefined }, + { value: 'FIND', + disabled: false, + label: undefined }, + ], + controlType: () => CONTROL_TYPES.TEXTAREA, + [ACTION_VALUE_KEY]: '', + [FIELD_VALUE_KEY]: '', + }, + ], + }), + ); + }); + it('returns the correct object for the default case', () => { expect(getDefaultActions('unknown', [], formatMessage)).toEqual({ type: null, diff --git a/src/constants/inAppActions.js b/src/constants/inAppActions.js index a2c07772..82af62d2 100644 --- a/src/constants/inAppActions.js +++ b/src/constants/inAppActions.js @@ -150,6 +150,12 @@ export const noteActionsWithMark = (formatMessage) => [ getChangeNoteTypeAction(formatMessage), ]; +export const electronicAccess = (formatMessage) => [ + getPlaceholder(formatMessage), + getClearAction(formatMessage), + getReplaceAction(formatMessage), + getFindAction(formatMessage), +]; export const noteActionsWithDuplicate = (formatMessage) => [ getPlaceholder(formatMessage), getMarkAsStuffOnlyAction(formatMessage), diff --git a/src/constants/selectOptions.js b/src/constants/selectOptions.js index caf912ef..b91eff20 100644 --- a/src/constants/selectOptions.js +++ b/src/constants/selectOptions.js @@ -23,6 +23,7 @@ export const OPTIONS = { ADMINISTRATIVE_NOTE: 'ADMINISTRATIVE_NOTE', CHECK_IN_NOTE: 'CHECK_IN_NOTE', CHECK_OUT_NOTE: 'CHECK_OUT_NOTE', + URI: 'URI' }; export const PARAMETERS_KEYS = { @@ -194,11 +195,17 @@ export const getHoldingsOptions = (formatMessage, holdingsNotes = []) => [ categoryName: formatMessage({ id: 'ui-bulk-edit.category.holdingsLocation' }), }, ...holdingsNotes, + { + value: OPTIONS.URI, + label: formatMessage({ id: 'ui-bulk-edit.layer.options.holdings.uri' }), + disabled: false, + categoryName: formatMessage({ id: 'ui-bulk-edit.category.electronicAccess' }), + }, { value: OPTIONS.SUPPRESS_FROM_DISCOVERY, label: formatMessage({ id: 'ui-bulk-edit.layer.options.holdings.suppress' }), disabled: false, - }, + } ]; export const getHoldingsNotes = (formatMessage, holdingsNotes) => [ diff --git a/translations/ui-bulk-edit/en.json b/translations/ui-bulk-edit/en.json index 29a2bb7b..96612ba8 100644 --- a/translations/ui-bulk-edit/en.json +++ b/translations/ui-bulk-edit/en.json @@ -118,6 +118,7 @@ "category.itemNotes": "Item notes", "category.holdingsNotes": "Holdings notes", "category.holdingsLocation": "Holdings location", + "category.electronicAccess": "Electronic access", "columns.USER.User name": "Username", "columns.USER.User id": "User id", @@ -299,6 +300,7 @@ "layer.options.administrativeNote": "Administrative note", "layer.options.checkInNote": "Check in note", "layer.options.checkOutNote": "Check out note", + "layer.options.holdings.uri": "URI", "previewModal.message": "{count, number} records will be changed if the Commit changes button is clicked. You may choose Download preview to review all changes prior to saving.", "previewModal.previewToBeChanged": "Preview of records to be changed", From 73d62be7f437ee455c8b686a26794d9f26ed45da Mon Sep 17 00:00:00 2001 From: Uladzislau_Kutarkin Date: Wed, 8 Nov 2023 10:50:40 +0400 Subject: [PATCH 2/3] UIBULKED-353: update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 667ab7a2..f11cc21d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ * [UIBULKED-331](https://issues.folio.org/browse/UIBULKED-331) Bulk edit actions for holdings notes - add and remove notes. * [UIBULKED-332](https://issues.folio.org/browse/UIBULKED-332) Bulk edit actions for holdings notes - find and replace or remove. * [UIBULKED-333](https://issues.folio.org/browse/UIBULKED-333) Bulk edit actions for holdings notes - change note type. +* [UIBULKED-353](https://issues.folio.org/browse/UIBULKED-353) Update Electronic access - URI. ## [4.0.0](https://github.com/folio-org/ui-bulk-edit/tree/v4.0.0) (2023-10-12) From c37f680dfd8ef9089bcdeb189762d7621e840e35 Mon Sep 17 00:00:00 2001 From: Uladzislau_Kutarkin Date: Wed, 8 Nov 2023 10:51:41 +0400 Subject: [PATCH 3/3] UIBULKED-353: fix code style --- .../BulkEditInApp/ContentUpdatesForm/helpers.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/BulkEditList/BulkEditListResult/BulkEditInApp/ContentUpdatesForm/helpers.js b/src/components/BulkEditList/BulkEditListResult/BulkEditInApp/ContentUpdatesForm/helpers.js index e8b31ff8..8401e3b5 100644 --- a/src/components/BulkEditList/BulkEditListResult/BulkEditInApp/ContentUpdatesForm/helpers.js +++ b/src/components/BulkEditList/BulkEditListResult/BulkEditInApp/ContentUpdatesForm/helpers.js @@ -19,7 +19,8 @@ import { statusActions, noteActions, noteActionsWithMark, - noteActionsWithDuplicate, electronicAccess, + noteActionsWithDuplicate, + electronicAccess, } from '../../../../../constants'; export const ACTION_VALUE_KEY = 'name';