Skip to content

Simplify the template add-on step into one action - #3663

Merged
Crabcyborg merged 1 commit into
fix/3485-template-addon-dependenciesfrom
template-addons-ui
Nov 4, 2026
Merged

Crabcyborg merged 1 commit into
fix/3485-template-addon-dependenciesfrom
template-addons-ui

Conversation

@tuguirazvan

Copy link
Copy Markdown
Collaborator

Follow-up to #3657.

  • Title names what's needed: "This template needs Geolocation" or "This template needs 2 add-ons"
  • The Add-on / Status / Action table is now a short list with each add-on's name, a status tag and its description
  • One button, "Install and use template", sets up every add-on and then creates the form; the per-row buttons are gone
  • Each row shows Installing…, Ready or Failed with the reason, and "Try again" only retries what failed
  • Users who can't install add-ons see why, with a "Go to add-ons" button
  • 500px dialog with both buttons on the right and a grey hover on the close X

Templates need at most 2 add-ons (29 of 414 need two), so the list never gets long.

🤖 Generated with Claude Code

- Title names the add-on ("This template needs Geolocation") or the count.
- Replace the Add-on/Status/Action table with a short list: name, status
  tag and the add-on's description from the add-ons API.
- One primary button ("Install and use template") installs or activates
  every add-on in turn, then creates the form; per-row buttons are gone.
- Rows show Installing/Activating, Ready or Failed with the reason;
  "Try again" retries only what failed. Cancel stays visible, disabled.
- Users who can't install see the reason and a "Go to add-ons" button.
- 500px dialog, buttons on the right, grey hover square on the close X.
- Include the add-on excerpt as "description" in the dependency response.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Tip

🎯 Customize your risk assessments

Guide how CodeRabbit assesses merge risk and security architecture risk. Highlight sensitive changes and explain your security boundaries using Merge Risk Instructions and Security Risk Instructions in your review settings. Security architecture risk assessments require the Advanced plan or above.

✅ Automatic approvals, with your rules

Let CodeRabbit approve pull requests once required threads are resolved, pre-merge checks pass, and your risk limits are met. Enable Automatic approvals in review settings, with overrides for teams or file paths.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@deepsource-io

deepsource-io Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

DeepSource Code Review

We reviewed changes in dcf752a...f07062e on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.

See full review on DeepSource ↗

PR Report Card

Overall Grade   Security  

Reliability  

Complexity  

Hygiene  

Code Review Summary

Analyzer Status Updated (UTC) Details
PHP Nov 4, 2026 7:42a.m. Review ↗
JavaScript Nov 4, 2026 7:42a.m. Review ↗

Important

AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.

@franky-the-going-merry franky-the-going-merry Bot added the franky-working Franky is actively reviewing this label Nov 4, 2026

@franky-the-going-merry franky-the-going-merry Bot 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.

The new dialog renders cleanly, but closing it mid-install doesn't cancel anything. One blocking issue.

Live check (Playground, Lite on this PR, Pro installed). I opened the dialog through the real installNewForm path with a mocked missing_addons response of two add-ons (one not installed, one inactive). The 500px dialog, the title "This template needs 2 add-ons", the status tags, the descriptions and the "Install both and use template" button all render as the PR describes. Clicking the button shows "Installing…" and the Cancel button goes disabled.

Blocking: the close X still works during the install, and the import runs anyway. I clicked the X while the first add-on was installing. The dialog closed, but both add-on requests still went out and the template import request was sent again after they finished (import calls went from 1 to 2). The user chose to close, and the site still gets add-ons installed and a form created. See inline comment for the fix.

Non-blocking (read from source, not exercised):

  • When the list mixes installable and manual add-ons (no action), the button only mentions the installable ones and onImport() runs once those succeed, so the template import proceeds without the manual add-on. The old Continue button behaved the same way, but the new copy ("We'll set them up, then create your form") promises more.
  • This PR targets fix/3485-template-addon-dependencies, not master, so it will only land once #3657 does.

Not exercised: the Failed / "Try again" path, the "Go to add-ons" no-permission variant, and real add-on installs (the install and activate responses were mocked). PR CI shows lint, PHPCS, PHPStan and PHPUnit as skipped on this head.


primaryButton.textContent = __( 'Creating form…', 'formidable' );
closeButton.click();
onImport();

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.

Blocking. The loop above is not tied to the dialog's lifetime. If the user closes the dialog with the X (or Esc / overlay click) while a row is installing, this handler keeps running and still reaches onImport() here, which re-sends the template import. Repro: open the dialog, click the primary button, click the X while "Installing…" shows; both add-on requests complete and installNewForm runs again.

Fix: track whether the dialog was dismissed and bail out of the loop and this call. For example:

let dismissed = false;
modal.addEventListener( 'dialogclose', () => { dismissed = true; } ); // jQuery UI dialog event, or listen on the .dismiss click
...
for ( const row of pending.filter( item => ! item.done ) ) {
	if ( dismissed ) {
		return;
	}
	if ( ! await row.activate() ) {
		failed = true;
	}
}

if ( dismissed ) {
	return;
}

Alternatively keep the dialog open and ignore dismissal until the loop finishes (disable the X and block Esc like the Cancel button is), so the current behavior becomes consistent. Either way, the already-installed add-ons can stay installed; only the import must not fire after a dismiss. Check how this dialog is opened in js/admin/dom.js (makeModalIntoADialogAndOpen) for the right close event.

@franky-the-going-merry franky-the-going-merry Bot removed franky-review franky-working Franky is actively reviewing this labels Nov 4, 2026

@Crabcyborg Crabcyborg 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.

Thank you Razvan!

🚀

@Crabcyborg
Crabcyborg merged commit 425e011 into fix/3485-template-addon-dependencies Nov 4, 2026
56 checks passed
@Crabcyborg
Crabcyborg deleted the template-addons-ui branch November 4, 2026 15:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants