diff --git a/CHANGELOG.md b/CHANGELOG.md index 1a7cf796..95ac4a09 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ * [UIBULKED-355](https://issues.folio.org/browse/UIBULKED-355) Remove reference to Query tab on the landing page. * [UIBULKED-315](https://issues.folio.org/browse/UIBULKED-315) Group holdings record properties using optgroup component +* [UIBULKED-316](https://issues.folio.org/browse/UIBULKED-316) Bulk edit actions for holdings notes - add and remove Mark as staff only. ## [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 adba3617..d140d452 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, + noteActionHoldings, } 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 noteHoldingsDefaultActions = noteActionHoldings(formatMessage); const replaceClearInitialVal = replaceClearDefaultActions[0].value; @@ -290,6 +292,24 @@ export const getDefaultActions = (option, options, formatMessage) => { ], }; + case OPTIONS.HOLDINGS_NOTE: + return { + type: '', + actions: [ + null, + { + actionsList: noteHoldingsDefaultActions, + controlType: (action) => { + return action === ACTIONS.CHANGE_TYPE + ? CONTROL_TYPES.NOTE_SELECT + : CONTROL_TYPES.TEXTAREA; + }, + [ACTION_VALUE_KEY]: noteHoldingsDefaultActions[0].value, + [FIELD_VALUE_KEY]: '', + }, + ], + }; + default: return { type: null, diff --git a/src/components/BulkEditList/BulkEditListResult/BulkEditInApp/ContentUpdatesForm/helpers.test.js b/src/components/BulkEditList/BulkEditListResult/BulkEditInApp/ContentUpdatesForm/helpers.test.js index cb90c6c9..9e83b593 100644 --- a/src/components/BulkEditList/BulkEditListResult/BulkEditInApp/ContentUpdatesForm/helpers.test.js +++ b/src/components/BulkEditList/BulkEditListResult/BulkEditInApp/ContentUpdatesForm/helpers.test.js @@ -491,6 +491,34 @@ describe('ContentUpdatesForm helpers', () => { }); }); + it('returns the correct object for the HOLDINGS_NOTE option', () => { + expect(JSON.stringify(getDefaultActions(OPTIONS.HOLDINGS_NOTE, [], formatMessage))).toEqual( + JSON.stringify({ + type: '', + actions: [ + null, + { + actionsList: [{ + value: '', + disabled: true, + label: undefined, + }, + { value: 'MARK_AS_STAFF_ONLY', + disabled: false, + label: undefined }, + { value: 'REMOVE_MARK_AS_STAFF_ONLY', + 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..2d09e89c 100644 --- a/src/constants/inAppActions.js +++ b/src/constants/inAppActions.js @@ -150,6 +150,12 @@ export const noteActionsWithMark = (formatMessage) => [ getChangeNoteTypeAction(formatMessage), ]; +export const noteActionHoldings = (formatMessage) => [ + getPlaceholder(formatMessage), + getMarkAsStuffOnlyAction(formatMessage), + getRemoveMarkAsStuffOnlyAction(formatMessage) +]; + export const noteActionsWithDuplicate = (formatMessage) => [ getPlaceholder(formatMessage), getMarkAsStuffOnlyAction(formatMessage),