Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[QA fix] Fixing series cloning && Absolute details page path #311

Merged
merged 2 commits into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading