From be173f0b65900043330de0c8a2813ab88512a47a Mon Sep 17 00:00:00 2001 From: vashjs Date: Tue, 12 Nov 2024 22:57:09 +0100 Subject: [PATCH 1/3] UIBULKED-566 Bulk edit form - options cleanup --- CHANGELOG.md | 1 + .../ContentUpdatesForm/ValuesColumn.js | 4 +- src/constants/selectOptions.js | 73 +++++++++++++------ translations/ui-bulk-edit/en.json | 3 +- 4 files changed, 54 insertions(+), 27 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b75a2a3c..1a92c772 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## In progress * [UIBULKED-540](https://folio-org.atlassian.net/browse/UIBULKED-540) Update identifiers names for Item record. * [UIPQB-126](https://folio-org.atlassian.net/browse/UIPQB-126) Use tenant timezone for building queries (adds use of permission `configuration.entries.collection.get`). +* [UIBULKED-566](https://folio-org.atlassian.net/browse/UIBULKED-566) Bulk edit form - options cleanup. ## [4.2.0](https://github.com/folio-org/ui-bulk-edit/tree/v4.2.0) (2024-10-31) diff --git a/src/components/BulkEditPane/BulkEditListResult/BulkEditInApp/ContentUpdatesForm/ValuesColumn.js b/src/components/BulkEditPane/BulkEditListResult/BulkEditInApp/ContentUpdatesForm/ValuesColumn.js index 8d04ac94..072b5e1d 100644 --- a/src/components/BulkEditPane/BulkEditListResult/BulkEditInApp/ContentUpdatesForm/ValuesColumn.js +++ b/src/components/BulkEditPane/BulkEditListResult/BulkEditInApp/ContentUpdatesForm/ValuesColumn.js @@ -31,7 +31,7 @@ import { getHoldingsNotes, getInstanceNotes, getItemStatusOptions, getItemsWithPlaceholder, - getNotesOptions, + getItemNotes, } from '../../../../../constants'; import { FIELD_VALUE_KEY, @@ -98,7 +98,7 @@ export const ValuesColumn = ({ action, allActions, actionIndex, onChange, option const { holdingsNotes, isHoldingsNotesLoading } = useHoldingsNotes({ enabled: isHoldingsCapability }); const duplicateNoteOptions = getDuplicateNoteOptions(formatMessage).filter(el => el.value !== option); - const filteredAndMappedNotes = getNotesOptions(formatMessage, isCentralTenant ? removeDuplicatesByValue(itemsNotes, tenants) : itemNotes) + const filteredAndMappedNotes = getItemNotes(formatMessage, isCentralTenant ? removeDuplicatesByValue(itemsNotes, tenants) : itemNotes) .filter(obj => obj.value !== option) .map(({ label, value, tenant }) => ({ label, value, tenant })); diff --git a/src/constants/selectOptions.js b/src/constants/selectOptions.js index bd2e5d6d..8c8e1906 100644 --- a/src/constants/selectOptions.js +++ b/src/constants/selectOptions.js @@ -217,18 +217,13 @@ export const getHoldingsOptions = (formatMessage, holdingsNotes = []) => [ value: OPTIONS.ADMINISTRATIVE_NOTE, label: formatMessage({ id: 'ui-bulk-edit.layer.options.administrativeNote' }), disabled: false, + categoryName: formatMessage({ id: 'ui-bulk-edit.category.administrativeData' }), }, { - value: OPTIONS.ELECTRONIC_ACCESS_URI, - label: formatMessage({ id: 'ui-bulk-edit.layer.options.holdings.uri' }), - disabled: false, - categoryName: formatMessage({ id: 'ui-bulk-edit.category.electronicAccess' }), - }, - { - value: OPTIONS.ELECTRONIC_ACCESS_URL_RELATIONSHIP, - label: formatMessage({ id: 'ui-bulk-edit.layer.options.holdings.urlRelationship' }), + value: OPTIONS.SUPPRESS_FROM_DISCOVERY, + label: formatMessage({ id: 'ui-bulk-edit.layer.options.holdings.suppress' }), disabled: false, - categoryName: formatMessage({ id: 'ui-bulk-edit.category.electronicAccess' }), + categoryName: formatMessage({ id: 'ui-bulk-edit.category.administrativeData' }), }, { value: OPTIONS.ELECTRONIC_ACCESS_LINK_TEXT, @@ -242,29 +237,36 @@ export const getHoldingsOptions = (formatMessage, holdingsNotes = []) => [ disabled: false, categoryName: formatMessage({ id: 'ui-bulk-edit.category.electronicAccess' }), }, + { + value: OPTIONS.ELECTRONIC_ACCESS_URI, + label: formatMessage({ id: 'ui-bulk-edit.layer.options.holdings.uri' }), + disabled: false, + categoryName: formatMessage({ id: 'ui-bulk-edit.category.electronicAccess' }), + }, { value: OPTIONS.ELECTRONIC_ACCESS_URL_PUBLIC_NOTE, label: formatMessage({ id: 'ui-bulk-edit.layer.options.holdings.urlPublic' }), disabled: false, categoryName: formatMessage({ id: 'ui-bulk-edit.category.electronicAccess' }), }, + { + value: OPTIONS.ELECTRONIC_ACCESS_URL_RELATIONSHIP, + label: formatMessage({ id: 'ui-bulk-edit.layer.options.holdings.urlRelationship' }), + disabled: false, + categoryName: formatMessage({ id: 'ui-bulk-edit.category.electronicAccess' }), + }, + ...holdingsNotes, { value: OPTIONS.PERMANENT_HOLDINGS_LOCATION, label: formatMessage({ id: 'ui-bulk-edit.layer.options.holdings.permanentLocation' }), disabled: false, - categoryName: formatMessage({ id: 'ui-bulk-edit.category.holdingsLocation' }), + categoryName: formatMessage({ id: 'ui-bulk-edit.category.location' }), }, { value: OPTIONS.TEMPORARY_HOLDINGS_LOCATION, label: formatMessage({ id: 'ui-bulk-edit.layer.options.holdings.temporaryLocation' }), disabled: false, - categoryName: formatMessage({ id: 'ui-bulk-edit.category.holdingsLocation' }), - }, - ...holdingsNotes, - { - value: OPTIONS.SUPPRESS_FROM_DISCOVERY, - label: formatMessage({ id: 'ui-bulk-edit.layer.options.holdings.suppress' }), - disabled: false, + categoryName: formatMessage({ id: 'ui-bulk-edit.category.location' }), }, ]; @@ -273,16 +275,19 @@ export const getInstanceOptions = (formatMessage, instanceNotes) => [ value: OPTIONS.ADMINISTRATIVE_NOTE, label: formatMessage({ id: 'ui-bulk-edit.layer.options.administrativeNote' }), disabled: false, + categoryName: formatMessage({ id: 'ui-bulk-edit.category.administrativeData' }), }, { value: OPTIONS.STAFF_SUPPRESS, label: formatMessage({ id: 'ui-bulk-edit.layer.options.instances.staffSuppress' }), disabled: false, + categoryName: formatMessage({ id: 'ui-bulk-edit.category.administrativeData' }), }, { value: OPTIONS.SUPPRESS_FROM_DISCOVERY, label: formatMessage({ id: 'ui-bulk-edit.layer.options.instances.suppress' }), disabled: false, + categoryName: formatMessage({ id: 'ui-bulk-edit.category.administrativeData' }), }, ...instanceNotes ]; @@ -315,7 +320,7 @@ export const getInstanceNotes = (formatMessage, instanceNotes) => [ ...instanceNotes, ]; -export const getNotesOptions = (formatMessage, itemNotes) => { +export const getItemNotes = (formatMessage, itemNotes) => { return [ { value: '', @@ -355,11 +360,36 @@ export const getDuplicateNoteOptions = (formatMessage) => [ ]; export const getItemsOptions = (formatMessage, itemNotes = []) => [ - ...getItemsWithoutPlaceholder(getNotesOptions(formatMessage, itemNotes)), + { + value: OPTIONS.ADMINISTRATIVE_NOTE, + label: formatMessage({ id: 'ui-bulk-edit.layer.options.administrativeNote' }), + disabled: false, + categoryName: formatMessage({ id: 'ui-bulk-edit.category.administrativeData' }), + }, + { + value: OPTIONS.SUPPRESS_FROM_DISCOVERY, + label: formatMessage({ id: 'ui-bulk-edit.layer.options.suppressFromDiscovery' }), + disabled: false, + categoryName: formatMessage({ id: 'ui-bulk-edit.category.administrativeData' }), + }, + ...itemNotes, + { + value: OPTIONS.CHECK_IN_NOTE, + label: formatMessage({ id: 'ui-bulk-edit.layer.options.checkInNote' }), + disabled: false, + categoryName: formatMessage({ id: 'ui-bulk-edit.category.loanType' }), + }, + { + value: OPTIONS.CHECK_OUT_NOTE, + label: formatMessage({ id: 'ui-bulk-edit.layer.options.checkOutNote' }), + disabled: false, + categoryName: formatMessage({ id: 'ui-bulk-edit.category.loanType' }), + }, { value: OPTIONS.STATUS, label: formatMessage({ id: 'ui-bulk-edit.layer.options.statusLabel' }), disabled: false, + categoryName: formatMessage({ id: 'ui-bulk-edit.category.loanType' }), }, { value: OPTIONS.PERMANENT_LOAN_TYPE, @@ -385,11 +415,6 @@ export const getItemsOptions = (formatMessage, itemNotes = []) => [ disabled: false, categoryName: formatMessage({ id: 'ui-bulk-edit.category.location' }), }, - { - value: OPTIONS.SUPPRESS_FROM_DISCOVERY, - label: formatMessage({ id: 'ui-bulk-edit.layer.options.suppressFromDiscovery' }), - disabled: false, - }, ]; export const getItemStatusOptions = (formatMessage) => [ diff --git a/translations/ui-bulk-edit/en.json b/translations/ui-bulk-edit/en.json index e1f8d9f2..c1946369 100644 --- a/translations/ui-bulk-edit/en.json +++ b/translations/ui-bulk-edit/en.json @@ -151,12 +151,13 @@ "start.downloadChangedRecords": "Download changed records (CSV)", "start.downloadChangedRecords.marc": "Download changed records (MARC)", - "category.loanType": "Loan type", + "category.loanType": "Loan and availability", "category.location": "Location", "category.itemNotes": "Item notes", "category.holdingsNotes": "Holdings notes", "category.holdingsLocation": "Holdings location", "category.electronicAccess": "Electronic access", + "category.administrativeData": "Administrative data", "category.instanceNotes": "Instance notes", "columns.USER.User name": "Username", From ab050f9087a8aeec171f9b4f9d8c202225368802 Mon Sep 17 00:00:00 2001 From: vashjs Date: Wed, 13 Nov 2024 19:49:10 +0100 Subject: [PATCH 2/3] refactor --- src/constants/selectOptions.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/constants/selectOptions.js b/src/constants/selectOptions.js index 8c8e1906..6eaeaf71 100644 --- a/src/constants/selectOptions.js +++ b/src/constants/selectOptions.js @@ -50,8 +50,6 @@ export const getItemsWithPlaceholder = (items) => [ ...items, ]; -export const getItemsWithoutPlaceholder = (items) => items.filter(item => item.value); - export const identifierOptions = { [CAPABILITIES.USER]: [ { @@ -255,7 +253,6 @@ export const getHoldingsOptions = (formatMessage, holdingsNotes = []) => [ disabled: false, categoryName: formatMessage({ id: 'ui-bulk-edit.category.electronicAccess' }), }, - ...holdingsNotes, { value: OPTIONS.PERMANENT_HOLDINGS_LOCATION, label: formatMessage({ id: 'ui-bulk-edit.layer.options.holdings.permanentLocation' }), @@ -268,6 +265,7 @@ export const getHoldingsOptions = (formatMessage, holdingsNotes = []) => [ disabled: false, categoryName: formatMessage({ id: 'ui-bulk-edit.category.location' }), }, + ...holdingsNotes, ]; export const getInstanceOptions = (formatMessage, instanceNotes) => [ @@ -372,7 +370,6 @@ export const getItemsOptions = (formatMessage, itemNotes = []) => [ disabled: false, categoryName: formatMessage({ id: 'ui-bulk-edit.category.administrativeData' }), }, - ...itemNotes, { value: OPTIONS.CHECK_IN_NOTE, label: formatMessage({ id: 'ui-bulk-edit.layer.options.checkInNote' }), @@ -415,6 +412,7 @@ export const getItemsOptions = (formatMessage, itemNotes = []) => [ disabled: false, categoryName: formatMessage({ id: 'ui-bulk-edit.category.location' }), }, + ...itemNotes, ]; export const getItemStatusOptions = (formatMessage) => [ From 31c83b5469bca209710383f394b15dacc2f5c781 Mon Sep 17 00:00:00 2001 From: vashjs Date: Mon, 18 Nov 2024 10:54:30 +0100 Subject: [PATCH 3/3] update CHANGELOG.md --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bd3191cb..d6afcd83 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,13 +2,14 @@ ## In progress +* [UIBULKED-566](https://folio-org.atlassian.net/browse/UIBULKED-566) Bulk edit form - options cleanup. + ## [4.2.2](https://github.com/folio-org/ui-bulk-edit/tree/v4.2.2) (2024-11-15) * [UIPQB-126](https://folio-org.atlassian.net/browse/UIPQB-126) Use tenant timezone for building queries (adds use of permission `configuration.entries.collection.get`). * [UIBULKED-582](https://folio-org.atlassian.net/browse/UIBULKED-582) Temporarily remove error handling from publish-coordinator related logic. * [UIBULKED-581](https://folio-org.atlassian.net/browse/UIBULKED-581) "Something went wrong" error notification displays * [UIBULKED-583](https://folio-org.atlassian.net/browse/UIBULKED-583) Include tenants array into request if there is "final" action selected. -* [UIBULKED-566](https://folio-org.atlassian.net/browse/UIBULKED-566) Bulk edit form - options cleanup. ## [4.2.1](https://github.com/folio-org/ui-bulk-edit/tree/v4.2.1) (2024-11-08)