From bfcfdd112fad0ca65cfa8e08a12805f6a3f03117 Mon Sep 17 00:00:00 2001 From: Qiyun Dai Date: Thu, 9 Jan 2025 14:55:43 -0600 Subject: [PATCH 1/2] Fixing series cloning --- .../series-creation-form/data-handler.js | 39 ++++++++++++------- .../series-dashboard/series-dashboard.js | 6 +-- 2 files changed, 28 insertions(+), 17 deletions(-) diff --git a/ecc/blocks/series-creation-form/data-handler.js b/ecc/blocks/series-creation-form/data-handler.js index e8599125..79e702ba 100644 --- a/ecc/blocks/series-creation-form/data-handler.js +++ b/ecc/blocks/series-creation-form/data-handler.js @@ -3,27 +3,38 @@ let responseCache = {}; let payloadCache = {}; -const submissionFilter = [ - // from payload and response - 'seriesName', - 'seriesDescription', - 'seriesStatus', - 'susiContextId', - 'externalThemeId', - 'cloudType', - 'templateId', - 'relatedDomain', - 'modificationTime', -]; +const filters = { + submission: [ + 'seriesName', + 'seriesDescription', + 'seriesStatus', + 'susiContextId', + 'externalThemeId', + 'cloudType', + 'templateId', + 'relatedDomain', + 'modificationTime', + ], + clone: [ + 'seriesName', + 'seriesDescription', + 'seriesStatus', + 'susiContextId', + 'externalThemeId', + 'cloudType', + 'templateId', + 'relatedDomain', + ], +} function isValidAttribute(attr) { return attr !== undefined && attr !== null; } -export function quickFilter(obj) { +export function quickFilter(obj, filter = 'submission') { const output = {}; - submissionFilter.forEach((attr) => { + filters[filter].forEach((attr) => { if (isValidAttribute(obj[attr])) { output[attr] = obj[attr]; } diff --git a/ecc/blocks/series-dashboard/series-dashboard.js b/ecc/blocks/series-dashboard/series-dashboard.js index 3f389066..bd8abbdf 100644 --- a/ecc/blocks/series-dashboard/series-dashboard.js +++ b/ecc/blocks/series-dashboard/series-dashboard.js @@ -233,7 +233,7 @@ function initMoreOptions(props, config, seriesObj, row) { if (resp.error) { row.classList.remove('pending'); - showToast(props, resp.error, { variant: 'negative' }); + showToast(props, resp.error.message || 'Unknown error while archiving the series.', { variant: 'negative' }); return; } @@ -258,7 +258,7 @@ function initMoreOptions(props, config, seriesObj, row) { // clone clone.addEventListener('click', async (e) => { e.preventDefault(); - const payload = { ...quickFilter(seriesObj), seriesStatus: 'draft' }; + const payload = { ...quickFilter(seriesObj, 'clone'), seriesStatus: 'draft' }; payload.seriesName = `${seriesObj.seriesName} - copy`; toolBox.remove(); row.classList.add('pending'); @@ -266,7 +266,7 @@ function initMoreOptions(props, config, seriesObj, row) { if (newSeriesObj.error) { row.classList.remove('pending'); - showToast(props, newSeriesObj.error, { variant: 'negative' }); + showToast(props, newSeriesObj.error.message || 'Unknown error while cloning the series.', { variant: 'negative' }); return; } From a79f4bac20ecf2f4afa7d6b0da65b9a658aef774 Mon Sep 17 00:00:00 2001 From: Qiyun Dai Date: Thu, 9 Jan 2025 15:09:25 -0600 Subject: [PATCH 2/2] use absolute detailPagePath --- ecc/blocks/event-creation-form/event-creation-form.js | 2 +- ecc/blocks/form-handler/form-handler.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ecc/blocks/event-creation-form/event-creation-form.js b/ecc/blocks/event-creation-form/event-creation-form.js index 710e4e81..8a8e72a5 100644 --- a/ecc/blocks/event-creation-form/event-creation-form.js +++ b/ecc/blocks/event-creation-form/event-creation-form.js @@ -865,7 +865,7 @@ function updateCtas(props) { if (a.classList.contains('preview-btns')) { const testTime = a.classList.contains('pre-event') ? +props.eventDataResp.localEndTimeMillis - 10 : +props.eventDataResp.localEndTimeMillis + 10; if (eventDataResp.detailPagePath) { - a.href = `${getEventPageHost()}${eventDataResp.detailPagePath}?previewMode=true&cachebuster=${Date.now()}&timing=${testTime}`; + a.href = `${eventDataResp.detailPagePath}?previewMode=true&cachebuster=${Date.now()}&timing=${testTime}`; a.classList.remove('preview-not-ready'); } } diff --git a/ecc/blocks/form-handler/form-handler.js b/ecc/blocks/form-handler/form-handler.js index 5558613a..3ac4277a 100644 --- a/ecc/blocks/form-handler/form-handler.js +++ b/ecc/blocks/form-handler/form-handler.js @@ -867,7 +867,7 @@ function updateCtas(props) { if (a.classList.contains('preview-btns')) { const testTime = a.classList.contains('pre-event') ? +props.eventDataResp.localEndTimeMillis - 10 : +props.eventDataResp.localEndTimeMillis + 10; if (eventDataResp.detailPagePath) { - a.href = `${getEventPageHost()}${eventDataResp.detailPagePath}?previewMode=true&cachebuster=${Date.now()}&timing=${testTime}`; + a.href = `${eventDataResp.detailPagePath}?previewMode=true&cachebuster=${Date.now()}&timing=${testTime}`; a.classList.remove('preview-not-ready'); } }