Skip to content

Commit

Permalink
Merge branch 'master' into UIBULKED-349
Browse files Browse the repository at this point in the history
# Conflicts:
#	CHANGELOG.md
#	src/components/BulkEditList/BulkEditListResult/BulkEditInApp/ContentUpdatesForm/helpers.js
#	src/constants/selectOptions.js
  • Loading branch information
vashjs committed Nov 14, 2023
2 parents d48bd2f + d9c9d1c commit 567473e
Show file tree
Hide file tree
Showing 11 changed files with 75 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
* [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-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.
* [UIBULKED-349](https://issues.folio.org/browse/UIBULKED-349) Update Electronic access - URL relationship

## [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 @@ -17,7 +17,9 @@ const Capabilities = ({
header={FilterAccordionHeader}
label={<FormattedMessage id="ui-bulk-edit.list.filters.capabilities.title" />}
>
<RadioButtonGroup>
<RadioButtonGroup
aria-labelledby="record-types"
>
{capabilitiesFilterOptions?.map(option => (
!option.hidden && (
<RadioButton
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
noteActions,
noteActionsWithMark,
noteActionsWithDuplicate,
electronicAccess,
urlRelationshipActions,
} from '../../../../../constants';

Expand Down Expand Up @@ -92,6 +93,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 @@ -306,6 +308,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 @@ -373,6 +389,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 @@ -654,6 +654,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({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const BulkEditInAppPreviewModal = ({
const history = useHistory();
const search = new URLSearchParams(history.location.search);
const capabilities = search.get('capabilities');
const step = search.get('step');
const { visibleColumns } = useContext(RootContext);

const swwCallout = () => (
Expand Down Expand Up @@ -176,6 +177,7 @@ const BulkEditInAppPreviewModal = ({
columnMapping={columnMapping}
visibleColumns={visibleColumnKeys}
maxHeight={300}
columnIdPrefix={step}
/>
</>
) : <Preloader />}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export const Preview = ({ id, title, isInitial, bulkDetails }) => {
contentData={contentData}
columnMapping={columnMapping}
visibleColumns={visibleColumns}
step={step}
/>
)}
{Boolean(errors?.length) && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
} from '@folio/stripes/components';


const PreviewAccordion = ({ contentData, columnMapping, visibleColumns, isInitial }) => {
const PreviewAccordion = ({ contentData, columnMapping, visibleColumns, isInitial, step }) => {
const translationKey = isInitial ? 'title' : 'titleChanged';
const maxHeight = window.innerHeight * 0.4;

Expand All @@ -31,6 +31,7 @@ const PreviewAccordion = ({ contentData, columnMapping, visibleColumns, isInitia
columnMapping={columnMapping}
visibleColumns={visibleColumnKeys}
maxHeight={maxHeight}
columnIdPrefix={step}
/>
</Col>
</Row>
Expand All @@ -43,6 +44,7 @@ PreviewAccordion.propTypes = {
columnMapping: PropTypes.object,
visibleColumns: PropTypes.arrayOf(PropTypes.object),
isInitial: PropTypes.bool,
step: PropTypes.string,
};

export default memo(PreviewAccordion);
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ const renderPreviewAccordion = ({
visibleColumns={visibleColumns}
columnMapping={columnMapping}
initial={initial}
step="UPLOAD"
/>
</RootContext.Provider>,
);
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
7 changes: 7 additions & 0 deletions 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',
URL_RELATIONSHIP: 'URL_RELATIONSHIP',
};

Expand Down Expand Up @@ -204,6 +205,12 @@ 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.URL_RELATIONSHIP,
label: formatMessage({ id: 'ui-bulk-edit.layer.options.holdings.urlRelationship' }),
Expand Down
1 change: 1 addition & 0 deletions translations/ui-bulk-edit/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,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 567473e

Please sign in to comment.