From d2c4743f247ae5c4f9b46adfa9c561d6f299a195 Mon Sep 17 00:00:00 2001 From: jennyhliu <34660846+jennyhliu@users.noreply.github.com> Date: Tue, 1 Aug 2023 11:12:26 -0400 Subject: [PATCH] Fixed bulk granule modal to correctly pass selected granules (#1108) --- CHANGELOG.md | 6 ++++++ .../js/components/Granules/bulk-granule-modal.js | 16 ++++++---------- app/src/js/components/Granules/bulk.js | 2 +- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b9d71dce9..e39f09bf6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +### Fixed + +- **CUMULUS-3265** + - Fixed bulk granule operation modal to correctly pass selected granules into bulk operation + ## [v12.0.1] - 2023-05-25 + ### Breaking Changes This version of the dashboard requires Cumulus API v2 (Core version >= v16.0.0) diff --git a/app/src/js/components/Granules/bulk-granule-modal.js b/app/src/js/components/Granules/bulk-granule-modal.js index 99939703f..3a6169fb0 100644 --- a/app/src/js/components/Granules/bulk-granule-modal.js +++ b/app/src/js/components/Granules/bulk-granule-modal.js @@ -61,21 +61,17 @@ const BulkGranuleModal = ({ if (!inflight) { try { json = JSON.parse(query); - const granuleIds = json.ids.map((granule) => granule.granuleId); - json.ids = granuleIds; } catch (jsonError) { - return setErrorState('Syntax error in JSON'); + return setErrorState(`Syntax error in JSON ${jsonError.message}`); } dispatch(bulkRequestAction({ requestId, json })); } } function queryGranulesWorkflows(queryParams) { - const { ids, index, query: esQuery } = queryParams; - if ((index && esQuery) || ids.length > 0) { - const granuleWorkflowsQuery = { ...queryParams, granules: ids }; - delete granuleWorkflowsQuery[ids]; - dispatch(getGranulesWorkflows(granuleWorkflowsQuery)); + const { granules, index, query: esQuery } = queryParams; + if ((index && esQuery) || granules.length > 0) { + dispatch(getGranulesWorkflows(queryParams)); } } @@ -100,7 +96,7 @@ const BulkGranuleModal = ({ } useEffect(() => { - const queryParams = { ...JSON.parse(query), ids: selected }; + const queryParams = { ...JSON.parse(query), granules: selected }; setQuery(JSON.stringify(queryParams, null, 2)); if (showModal && queryWorkflowOptions) { @@ -158,7 +154,7 @@ const BulkGranuleModal = ({ {selected && <>
Selected granules:
-[{selected.map((selection) => `"${selection.granuleId}"`).join(', ')}]
+[{selected.map((selection) => `{"granuleId": "${selection.granuleId}", "collectionId": "${selection.collectionId}"}`).join(', ')}]
> }