generated from adobe/aem-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 176
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
MWPW-163379: Fix edit url from Helix admin API for DA #3314
Merged
Merged
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
58d9795
MWPW-163379: Fix edit url from Helix admin API for DA
sharmeeatadobe fbac35b
MWPW-163379 : Addressing review comments
sharmeeatadobe 1ef498d
MWPW: updating with review comments
sharmeeatadobe 3d3eb21
Merge branch 'stage' of https://github.com/adobecom/milo into mwpw-16…
sharmeeatadobe 3973197
MWPW-163379: Implementing suggestions
sharmeeatadobe 4e5f78a
Merge branch 'stage' of https://github.com/adobecom/milo into mwpw-16…
sharmeeatadobe File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -7,6 +7,7 @@ const NOT_FOUND = { | |||||
preview: { lastModified: DEF_NOT_FOUND }, | ||||||
live: { lastModified: DEF_NOT_FOUND }, | ||||||
}; | ||||||
const DA_DOMAIN = 'da.live'; | ||||||
|
||||||
const content = signal({}); | ||||||
|
||||||
|
@@ -17,6 +18,14 @@ function getAdminUrl(url, type) { | |||||
return type === 'status' ? `${base}?editUrl=auto` : base; | ||||||
} | ||||||
|
||||||
function getDAEditUrl(sourceUrl) { | ||||||
if (!sourceUrl) { | ||||||
return ''; | ||||||
} | ||||||
const daEditUrl = sourceUrl.replace('markup:https://content.da.live', 'https://da.live/edit#'); | ||||||
return daEditUrl; | ||||||
} | ||||||
|
||||||
async function getStatus(url) { | ||||||
const adminUrl = getAdminUrl(url, 'status'); | ||||||
const resp = await fetch(adminUrl); | ||||||
|
@@ -25,7 +34,10 @@ async function getStatus(url) { | |||||
const preview = json.preview.lastModified || DEF_NEVER; | ||||||
const live = json.live.lastModified || DEF_NEVER; | ||||||
const publish = await userCanPublishPage(json, false); | ||||||
const edit = json.edit.url; | ||||||
let edit = json.edit.url; | ||||||
if (!json.edit.url && json.preview.sourceLocation && json.preview.sourceLocation.includes(DA_DOMAIN)) { | ||||||
edit = getDAEditUrl(json.preview.sourceLocation); | ||||||
} | ||||||
return { url, edit, preview, live, publish }; | ||||||
} | ||||||
|
||||||
|
@@ -165,13 +177,14 @@ function Item({ name, item, idx }) { | |||||
const { publishText, disablePublish } = usePublishProps(item); | ||||||
const isChecked = item.checked ? ' is-checked' : ''; | ||||||
const isFetching = item.edit ? '' : ' is-fetching'; | ||||||
const editIcon = item.edit && item.edit.includes(DA_DOMAIN) ? 'da-icon' : 'sharepoint-icon'; | ||||||
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. nit:
Suggested change
|
||||||
if (!item.url) return undefined; | ||||||
|
||||||
return html` | ||||||
<div class="preflight-group-row preflight-group-detail${isChecked}${checkPublishing(item, isFetching)}" | ||||||
onClick=${(e) => handleChange(e.target, name, idx)}> | ||||||
<p><a href=${item.url.pathname} target=_blank>${prettyPath(item.url)}</a></p> | ||||||
<p>${item.edit && html`<a href=${item.edit} class=preflight-edit target=_blank>EDIT</a>`}</p> | ||||||
<p>${item.edit && html`<a href=${item.edit} class="preflight-edit ${editIcon}" target=_blank>EDIT</a>`}</p> | ||||||
<p class=preflight-date-wrapper>${item.action === 'preview' ? 'Previewing' : prettyDate(item.preview)}</p> | ||||||
<p class="preflight-date-wrapper"> | ||||||
${isChecked && disablePublish ? html`<span class=disabled-publish>${disablePublish}</span>` : publishText} | ||||||
|
@@ -240,4 +253,4 @@ export default function General() { | |||||
`} | ||||||
</div> | ||||||
`; | ||||||
} | ||||||
} | ||||||
sharmeeatadobe marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
can this be simplified?
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.
@sharg1 made the suggested change