Skip to content

Commit

Permalink
MWPW-163379: Fix edit url from Helix admin API for DA (#3314)
Browse files Browse the repository at this point in the history
* MWPW-163379: Fix edit url from Helix admin API for DA

* MWPW-163379 : Addressing review comments

* MWPW: updating with review comments

* MWPW-163379: Implementing suggestions
  • Loading branch information
sharmeeatadobe authored Jan 2, 2025
1 parent a0bc4a5 commit 01ffecc
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
6 changes: 6 additions & 0 deletions libs/blocks/preflight/img/document-authoring.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 7 additions & 2 deletions libs/blocks/preflight/panels/general.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({});

Expand All @@ -25,7 +26,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;
const { sourceLocation } = json.preview;
const edit = json.edit?.url
|| (sourceLocation?.includes(DA_DOMAIN) && sourceLocation?.replace('markup:https://content.da.live', 'https://da.live/edit#'))
|| '';
return { url, edit, preview, live, publish };
}

Expand Down Expand Up @@ -165,13 +169,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';
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}
Expand Down
12 changes: 10 additions & 2 deletions libs/blocks/preflight/preflight.css
Original file line number Diff line number Diff line change
Expand Up @@ -170,14 +170,22 @@ p.preflight-content-heading-edit {
}

a.preflight-edit {
background: url('./img/word-icon.svg');
background-repeat: no-repeat;
display: block;
text-indent: -1000px;
overflow: hidden;
height: 32px;
}

a.preflight-edit.sharepoint-icon {
background: url('./img/word-icon.svg');
background-repeat: no-repeat;
}

a.preflight-edit.da-icon {
background: url('./img/document-authoring.svg');
background-repeat: no-repeat;
}

.preflight-group-row.preflight-group-detail.not-found::before {
background-image: url('./img/red-error.svg');
background-repeat: no-repeat;
Expand Down

0 comments on commit 01ffecc

Please sign in to comment.