Skip to content

feat: preview/publish single + bulk on browse#956

Open
sharanyavinod wants to merge 26 commits into
mainfrom
ew-pub
Open

feat: preview/publish single + bulk on browse#956
sharanyavinod wants to merge 26 commits into
mainfrom
ew-pub

Conversation

@sharanyavinod

@sharanyavinod sharanyavinod commented May 21, 2026

Copy link
Copy Markdown
Contributor

Description

  • Introduces Preview/Publish in the action bar on single and multiple files selection
  • Follows same pattern as delete for the confirm dialog for initial confirm -> switches then to load within action bar + clickable toast to show the urls if need, which auto closes. UX is rudimentary for now, to be revisited when implementing the new designs.
  • For publish, if a subset of the selections have a publish scheduled, user is asked to confirm overriding - all or nothing atm, can iterate if needed to give more granular control
  • Extracts reusable logic from the actions within the edit view

Preview URL: https://ew-pub--da-live--adobe.aem.page/#/aem-sandbox/block-collection

Related Issue

Motivation and Context

  • Users can preview directly from browse without stepping into edit and can preview multiple files easily

How Has This Been Tested?

  • Introduced unit tests consistent with existing tests

Screenshots (if appropriate):

Screenshot 2026-05-21 at 16 08 32

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@aem-code-sync

aem-code-sync Bot commented May 21, 2026

Copy link
Copy Markdown

Hello, I'm the AEM Code Sync Bot and I will run some actions to deploy your branch.
In case there are problems, just click the checkbox below to rerun the respective action.

  • Re-sync branch
Commits

@sharanyavinod sharanyavinod changed the title feat: preview single + bulk on browse feat: preview/publish single + bulk on browse May 21, 2026
@sharanyavinod sharanyavinod marked this pull request as draft May 21, 2026 14:29
@sharanyavinod sharanyavinod marked this pull request as ready for review May 22, 2026 14:09
@mhaack

mhaack commented May 28, 2026

Copy link
Copy Markdown
Contributor

Code review

Found 3 issues:

  1. Wrong permission role requested when preview fails during a publish actionaemAction in shared/utils.js calls saveToAem(path, 'preview') first, then returns the preview error to da-title.js. But da-title.js calls this.handleError(json, action) where action is always 'publish', overwriting json.error.action via object spread: this._status = { ...json.error, action }. When a user lacks preview access and tries to publish, clicking "Request access" will request the basic_publish role instead of the basic_author role needed to preview.

}
if (json.error) {
this.handleError(json, action);
return;
}

  1. Toast button and error panel render simultaneously on partial success — In runAemQueue, when at least one item succeeds, _aemActionState = { verb, results } is set and then handleClear() is called. handleClear() does not invoke handleErrorClose(), so _itemErrors retains any failed items. The render template shows the error panel whenever !this._confirm && this._itemErrors.length, and the toast button whenever this._aemActionState?.results. After a partial success, both conditions are true at the same time, causing both UI elements to appear simultaneously.

if (remaining === 0) {
if (results.length > 0) {
this._aemActionState = { verb, results };
setTimeout(() => {
this._aemActionState = null;
if (this._confirm?.type === 'results') this._confirm = null;
}, 5000);
this.handleClear();
} else {
this._aemActionState = null;

  1. getExistingSchedule is duplicated instead of reused — The PR adds getExistingSchedule (and SNAPSHOT_SCHEDULER_URL) to blocks/shared/utils.js, but an identical implementation already exists in blocks/edit/da-prepare/actions/scheduler/utils.js. The PR should import from the existing location rather than copying it.

New copy:

const SNAPSHOT_SCHEDULER_URL = 'https://helix-snapshot-scheduler-prod.adobeaem.workers.dev';
export async function getExistingSchedule(org, site, path) {
try {
const resp = await daFetch(`${SNAPSHOT_SCHEDULER_URL}/schedule/${org}/${site}?path=${encodeURIComponent(path)}`);
if (!resp.ok) return null;
return resp.json();
} catch {
return null;
}
}
export async function saveDaVersion(pathname, label = 'Published') {

Existing copy:

}
export async function getExistingSchedule(org, site, path) {
try {
const resp = await daFetch(`${SNAPSHOT_SCHEDULER_URL}/schedule/${org}/${site}?path=${encodeURIComponent(path)}`);
if (!resp.ok) return null;
return resp.json();
} catch {
return null;
}
}
export async function schedulePagePublish(org, site, path, userId, scheduledPublish) {

🤖 Generated with Claude Code

- If this code review was useful, please react with 👍. Otherwise, react with 👎.

@mhaack

mhaack commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

Some more testing feedback:

  • preview or publish > once done click on the blue confirmation toast bubble to see the dialog

after few seconds, when the blue confirmation is removed the dialog is closed as well, but it should stay

  • when selection a folder & some pages (see screenshot) the dialog should get an extra message about the folder not being published
Screenshot 2026-06-01 at 08 23 41

@sharanyavinod

Copy link
Copy Markdown
Contributor Author

@mhaack Thanks, fixed both of them.

@chrischrischris chrischrischris left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! I do wonder if we can move some of the code out of da-list into a file we dynamically import when preview/publish is started.

@sharanyavinod

Copy link
Copy Markdown
Contributor Author

Nice! I do wonder if we can move some of the code out of da-list into a file we dynamically import when preview/publish is started.

Indeed - was thinking of handling this in a follow-up PR since we also need to switch the styling to nx2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants