Skip to content

Commit

Permalink
[QA fix] Fixing series cloning && Absolute details page path (#311)
Browse files Browse the repository at this point in the history
  • Loading branch information
qiyundai authored Jan 10, 2025
1 parent c51cf87 commit 717bb0c
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 19 deletions.
2 changes: 1 addition & 1 deletion ecc/blocks/event-creation-form/event-creation-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
}
Expand Down
2 changes: 1 addition & 1 deletion ecc/blocks/form-handler/form-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
}
Expand Down
39 changes: 25 additions & 14 deletions ecc/blocks/series-creation-form/data-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}
Expand Down
6 changes: 3 additions & 3 deletions ecc/blocks/series-dashboard/series-dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -258,15 +258,15 @@ 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');
const newSeriesObj = await createSeries(payload);

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;
}

Expand Down

0 comments on commit 717bb0c

Please sign in to comment.