From d9c9d1cfa02a425ab62e0ca4656833c08b723a12 Mon Sep 17 00:00:00 2001 From: UladzislauKutarkin <72550466+UladzislauKutarkin@users.noreply.github.com> Date: Tue, 14 Nov 2023 11:38:28 +0400 Subject: [PATCH] UIBULKED-353: Update Electronic access - URI (#406) --- CHANGELOG.md | 1 + .../ContentUpdatesForm/helpers.js | 17 ++++++++++ .../ContentUpdatesForm/helpers.test.js | 31 +++++++++++++++++++ src/constants/inAppActions.js | 6 ++++ src/constants/selectOptions.js | 9 +++++- translations/ui-bulk-edit/en.json | 2 ++ 6 files changed, 65 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f6029090..456c2afe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ * [UIBULKED-377](https://issues.folio.org/browse/UIBULKED-377) Not all note types are displayed using "Change note type". * [UIBULKED-372](https://issues.folio.org/browse/UIBULKED-372) Bulk edit - Element IDs are not unique. * [UIBULKED-371](https://issues.folio.org/browse/UIBULKED-371) Bulk edit - Grouped form controls missing accessible name. +* [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) diff --git a/src/components/BulkEditList/BulkEditListResult/BulkEditInApp/ContentUpdatesForm/helpers.js b/src/components/BulkEditList/BulkEditListResult/BulkEditInApp/ContentUpdatesForm/helpers.js index 93595337..2e299960 100644 --- a/src/components/BulkEditList/BulkEditListResult/BulkEditInApp/ContentUpdatesForm/helpers.js +++ b/src/components/BulkEditList/BulkEditListResult/BulkEditInApp/ContentUpdatesForm/helpers.js @@ -20,6 +20,7 @@ import { noteActions, noteActionsWithMark, noteActionsWithDuplicate, + electronicAccess, } from '../../../../../constants'; export const ACTION_VALUE_KEY = 'name'; @@ -91,6 +92,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 +293,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 +374,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",