feat: implement WordPress Command Palette to replace Jumper navigation (#474)#477
feat: implement WordPress Command Palette to replace Jumper navigation (#474)#477superdav42 merged 1 commit intomainfrom
Conversation
Replaces the legacy Jumper quick-navigation widget with the native
WordPress Command Palette (Ctrl/Cmd+K), available since WordPress 6.4.
## What was built
- Command_Palette_Manager (inc/ui/): singleton that gates on WP 6.4+,
enqueues command-palette.js, localises config (entities, REST URL,
nonce, custom links), and registers a 'Tools > Command Palette' settings
section reusing the existing jumper_custom_links setting.
- Command_Palette trait (inc/apis/): added to all 10 entity managers
(broadcast, checkout_form, customer, discount_code, domain, membership,
payment, product, site, webhook). Each manager calls
enable_command_palette() in init(), which registers the entity with the
manager on the 'init' hook.
- Command_Palette_Rest_Controller (inc/apis/): REST endpoint at
ultimate-multisite/v1/command-palette/search. Requires manage_network
capability. Searches all registered entity types (or a specific one via
entity_type param), applies wu_command_palette_search_results filter.
- command-palette.js: registers a dynamic command loader (useEntitySearch
hook with 300ms debounce, 2-char minimum, result caching) plus static
commands for the dashboard, settings, system info, entity list pages,
and custom links. Uses wp.commands, wp.element, wp.apiFetch.
- class-wp-ultimo.php: loads Command_Palette_Manager and
Command_Palette_Rest_Controller instead of Jumper::get_instance().
## CodeRabbit fixes applied
- slug.replace('_', '-') → slug.replace(/_/g, '-') to handle multi-
underscore slugs (e.g. checkout_form → checkout-forms).
- search_permissions_check(): removed strict bool return type; actual
return is bool|WP_Error per WP REST API convention.
- foreach ($entities as $slug => $config): changed to
foreach (array_keys($entities) as $slug) to avoid unused variable.
## Scope
The legacy Jumper UI is no longer loaded. The underlying AJAX search
handlers (search_models, render_selectize_templates) are intentionally
preserved — they are used by selectize dropdowns throughout the admin
and are not Jumper-specific.
Closes #474
Ref: PR #285 (closed WIP)
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (15)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
PHP 8.2/8.3/8.5 failures are Docker Hub infrastructure errors (HTTP 500 on cimg/php image pull) — not code issues. CI re-run is in progress. |
🔨 Build Complete - Ready for Testing!📦 Download Build Artifact (Recommended)Download the zip build, upload to WordPress and test:
🌐 Test in WordPress Playground (Very Experimental)Click the link below to instantly test this PR in your browser - no installation needed! Login credentials: |
|
Performance Test Results Performance test results for ea25604 are in 🛎️! URL:
|
Summary
Implements the WordPress Command Palette (⌘K / Ctrl+K) as a replacement for the legacy Jumper navigation widget. The Command Palette provides quick access to all WP Ultimo entities, admin pages, settings, and custom links via the native WordPress command palette API (available since WordPress 6.4).
This is a clean reimplementation based on the closed WIP PR #285, with all CodeRabbit review findings addressed upfront.
What was built
inc/ui/class-command-palette-manager.phpwp_localize_script, registers settings sectioninc/apis/trait-command-palette.phpinc/apis/class-command-palette-rest-controller.phpultimate-multisite/v1/command-palette/searchassets/js/command-palette.jsuse Command_Palettetrait +enable_command_palette()callinc/class-wp-ultimo.phpCommand_Palette_Manager+Command_Palette_Rest_Controllerinstead ofJumper::get_instance()CodeRabbit fixes applied (from PR #285 review)
slug.replace('_', '-')→slug.replace(/_/g, '-')to handle multi-underscore slugs (e.g.checkout_form→checkout-forms)boolreturn type fromsearch_permissions_check()— actual return isbool|\WP_Errorper WP REST API conventionforeach ($entities as $slug => $config)→foreach (array_keys($entities) as $slug)to avoid unused$configvariableDesign decisions
jumper.css,jumper.js,class-jumper.phpare kept but no longer loaded. The AJAX search handlers inclass-ajax.php(search_models,render_selectize_templates) are intentionally preserved —selectizer.jsandtax-rates.jsdepend on them for selectize dropdowns throughout the admin.wp.commandsavailability check) for graceful degradation.manage_network— network admins only.jumper_custom_linkssetting key for backward compatibility with existing custom link configurations.Testing
Closes #474
Ref: PR #285 (closed WIP)