From 01ffeccfede7f6838e1c68d9a645ff5bfc1e4ac6 Mon Sep 17 00:00:00 2001 From: Sharmee Biswas Date: Thu, 2 Jan 2025 14:46:21 +0530 Subject: [PATCH] MWPW-163379: Fix edit url from Helix admin API for DA (#3314) * 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 --- libs/blocks/preflight/img/document-authoring.svg | 6 ++++++ libs/blocks/preflight/panels/general.js | 9 +++++++-- libs/blocks/preflight/preflight.css | 12 ++++++++++-- 3 files changed, 23 insertions(+), 4 deletions(-) create mode 100644 libs/blocks/preflight/img/document-authoring.svg diff --git a/libs/blocks/preflight/img/document-authoring.svg b/libs/blocks/preflight/img/document-authoring.svg new file mode 100644 index 0000000000..6543cb8af3 --- /dev/null +++ b/libs/blocks/preflight/img/document-authoring.svg @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/libs/blocks/preflight/panels/general.js b/libs/blocks/preflight/panels/general.js index 603cb72561..b34f0f7d7c 100644 --- a/libs/blocks/preflight/panels/general.js +++ b/libs/blocks/preflight/panels/general.js @@ -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({}); @@ -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 }; } @@ -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`
handleChange(e.target, name, idx)}>

${prettyPath(item.url)}

-

${item.edit && html`EDIT`}

+

${item.edit && html`EDIT`}

${item.action === 'preview' ? 'Previewing' : prettyDate(item.preview)}

${isChecked && disablePublish ? html`${disablePublish}` : publishText} diff --git a/libs/blocks/preflight/preflight.css b/libs/blocks/preflight/preflight.css index 5c2c2f7e78..c704e7d4bf 100644 --- a/libs/blocks/preflight/preflight.css +++ b/libs/blocks/preflight/preflight.css @@ -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;