-
Notifications
You must be signed in to change notification settings - Fork 181
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
[Milo] BulkPublisher BETA Preview content should point to stage #3554
Changes from all commits
9b97458
633db7f
c0f0554
73b1a45
fb556e8
b2c98ad
e334264
5eb1165
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -127,7 +127,7 @@ const showSuccessTable = (successArr) => { | |
tableBody.innerHTML += `<tr> | ||
<td>${++index}</td> | ||
<td class="ok">OK</td> | ||
<td><a href="${pageUrl}" title="View page">${pageUrl}</a></td> | ||
<td><a href="${pageUrl}" target="_blank" title="View page">${pageUrl}</a></td> | ||
<td class="entityid"><a target="_blank" href="${chimeraEndpoint}${response}" title="View Card JSON">${response}</a></td> | ||
</tr>`; | ||
}); | ||
|
@@ -147,7 +147,7 @@ const showErrorTable = (errorArr) => { | |
tableBody.innerHTML += `<tr> | ||
<td>${index}</td> | ||
<td class="error">Failed</td> | ||
<td><a href="${pageUrl}">${pageUrl}</a></td> | ||
<td><a href="${pageUrl}" target="_blank">${pageUrl}</a></td> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a good usability improvement for the UI. Could add |
||
<td>${message}</td> | ||
</tr>`; | ||
}); | ||
|
@@ -170,6 +170,7 @@ const processData = async (data, accessToken) => { | |
repo, | ||
useHtml, | ||
usePreview, | ||
previewHost, | ||
publishToFloodgate, | ||
} = getConfig(); | ||
|
||
|
@@ -182,7 +183,7 @@ const processData = async (data, accessToken) => { | |
let domain = `https://${host}`; | ||
|
||
if (usePreview) { | ||
domain = `https://stage--${repo}--${owner}.hlx.page`; | ||
domain = `https://${previewHost}`; | ||
} else if (publishToFloodgate !== 'default') { | ||
domain = `https://main--${repo}--${owner}.hlx.live`; | ||
} | ||
|
@@ -192,17 +193,14 @@ const processData = async (data, accessToken) => { | |
|
||
try { | ||
const rawUrl = page.Path || page.path || page.url || page.URL || page.Url || page; | ||
|
||
const { pathname } = new URL(rawUrl); | ||
const pathnameNoHtml = pathname.replace('.html', ''); | ||
const pageUrl = usePreview ? `${domain}${pathnameNoHtml}` : `${domain}${pathname}`; | ||
const prodUrl = `${host}${pathnameNoHtml}${useHtml ? '.html' : ''}`; | ||
const pageUrl = `${domain}${pathname}`; | ||
|
||
index += 1; | ||
statusModal.setContent(`Publishing ${index} of ${data.length}:<br>${pageUrl}`); | ||
|
||
if (pageUrl === 'stop') break; // debug, stop on empty line | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good cleanup reviewing developmental/test code. |
||
|
||
const { dom, error, lastModified } = await getPageDom(pageUrl, now); | ||
if (error) { | ||
errorArr.push([pageUrl, error]); | ||
|
@@ -283,7 +281,7 @@ const bulkPublish = async () => { | |
const loadFromLS = () => { | ||
BODY.classList = ''; | ||
const ls = localStorage.getItem(LS_KEY); | ||
if (!ls || !ls.includes('presetSelector')) return; | ||
if (!ls || !ls.includes('presetSelector') || !ls.includes('previewHost')) return; | ||
try { | ||
setConfig(JSON.parse(ls)); | ||
const config = getConfig(); | ||
|
@@ -386,6 +384,7 @@ presetSelector.addEventListener('change', () => { | |
} else { | ||
config.contentType = selectedPreset.contentType; | ||
} | ||
config.previewHost = selectedPreset.previewHost || 'www.stage.adobe.com'; | ||
|
||
setConfig(config); | ||
window.localStorage.setItem(LS_KEY, JSON.stringify(getConfig())); | ||
|
@@ -487,9 +486,15 @@ helpButtons.forEach((btn) => { | |
|
||
case 'use-preview': | ||
showAlert(`<p><b>Use Preview Content</b> | ||
<p>When this option is checked, the tool will publish content from: | ||
<p><tt>https://stage--{repo}--{owner}.hlx.<b>page</b></tt> | ||
<p>This can be useful for testing before publishing to production.</p>`); | ||
<p>When this option is checked, the tool will publish CaaS Metadata content from the stage environments:</p> | ||
<p>For example:<br> | ||
<tt> - https://www.stage.adobe.com</tt><br> | ||
<tt> - https://business.stage.adobe.com</tt><br> | ||
<tt> - https://blog.stage.adobe.com</tt><br> | ||
<tt> - https://milo.stage.adobe.com</tt><br> | ||
<tt> - https://news.stage.adobe.com</tt> | ||
</p> | ||
<p>This can be useful for testing before publishing content to production.</p>`); | ||
break; | ||
|
||
default: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -132,7 +132,7 @@ <h4>Advanced Options</h4> | |
</div> | ||
<div id="use-preview-cb" class="field checkbox"> | ||
<input type="checkbox" id="usePreview" name="usePreview" /> | ||
<label for="usePreview">Use Preview Content (*.page)<span class="help use-preview" title="Help about this functionality">(?)</span></label> | ||
<label for="usePreview">Use Preview Content (*.stage.*)<span class="help use-preview" title="Help about this functionality">(?)</span></label> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is good as it clarifies that the preview environment is from a stage domain. |
||
</div> | ||
<!-- | ||
<div class="field"> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good usability improvement for the UI. Could add
rel=noopener noreferrer
so the new tab can't accesswindow.opener