Skip to content

Commit

Permalink
UIBULKED-353: Update Electronic access - URI (#406)
Browse files Browse the repository at this point in the history
  • Loading branch information
UladzislauKutarkin authored Nov 14, 2023
1 parent 237f2a1 commit d9c9d1c
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
noteActions,
noteActionsWithMark,
noteActionsWithDuplicate,
electronicAccess,
} from '../../../../../constants';

export const ACTION_VALUE_KEY = 'name';
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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}`:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 6 additions & 0 deletions src/constants/inAppActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
9 changes: 8 additions & 1 deletion src/constants/selectOptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -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) => [
Expand Down
2 changes: 2 additions & 0 deletions translations/ui-bulk-edit/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit d9c9d1c

Please sign in to comment.