Skip to content

Commit

Permalink
Merge pull request #314 from adobecom/dev
Browse files Browse the repository at this point in the history
[Dev -> Stage] Treat preview absolute path on dashboard too (#313)
  • Loading branch information
apganapa-adobe authored Jan 10, 2025
2 parents 810ee13 + f223547 commit de791e5
Showing 1 changed file with 25 additions and 10 deletions.
35 changes: 25 additions & 10 deletions ecc/blocks/ecc-dashboard/ecc-dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ function initMoreOptions(props, config, eventObj, row) {
updateDashboardData(resp, props);

sortData(props, config, { resort: true });

showToast(props, buildToastMsgWithEventTitle(eventObj.title, config['event-unpublished-msg']), { variant: 'positive' });
});
} else {
Expand All @@ -320,19 +321,33 @@ function initMoreOptions(props, config, eventObj, row) {

if (eventObj.detailPagePath) {
previewPre.href = (() => {
const url = new URL(`${getEventPageHost()}${eventObj.detailPagePath}`);
url.searchParams.set('previewMode', 'true');
url.searchParams.set('cachebuster', Date.now());
url.searchParams.set('timing', +eventObj.localEndTimeMillis - 10);
return url.toString();
let url;

try {
url = new URL(`${eventObj.detailPagePath}`);
url.searchParams.set('previewMode', 'true');
url.searchParams.set('cachebuster', Date.now());
url.searchParams.set('timing', +eventObj.localEndTimeMillis - 10);
return url.toString();
} catch (e) {
previewPre.classList.add('disabled');
return '$';
}
})();
previewPre.target = '_blank';
previewPost.href = (() => {
const url = new URL(`${getEventPageHost()}${eventObj.detailPagePath}`);
url.searchParams.set('previewMode', 'true');
url.searchParams.set('cachebuster', Date.now());
url.searchParams.set('timing', +eventObj.localEndTimeMillis + 10);
return url.toString();
let url;

try {
url = new URL(`${eventObj.detailPagePath}`);
url.searchParams.set('previewMode', 'true');
url.searchParams.set('cachebuster', Date.now());
url.searchParams.set('timing', +eventObj.localEndTimeMillis + 10);
return url.toString();
} catch (e) {
previewPost.classList.add('disabled');
return '#';
}
})();
previewPost.target = '_blank';
} else {
Expand Down

0 comments on commit de791e5

Please sign in to comment.