Skip to content

Add a command palette (Cmd/Ctrl+K) with scoped search, actions and inline help - #23472

Merged
jmchilton merged 88 commits into
galaxyproject:devfrom
itisAliRH:feat/command-palette-core
Sep 26, 2026
Merged

jmchilton merged 88 commits into
galaxyproject:devfrom
itisAliRH:feat/command-palette-core

Conversation

@itisAliRH

@itisAliRH itisAliRH commented Sep 7, 2026 •

Copy link
Copy Markdown
Member

This adds a global command palette, opened with Cmd/Ctrl+K or the masthead search button, styled with Galaxy's existing app theme variables (no new dependencies). It builds on the list caches from #23471 (data-layer PR): every scope renders instantly from the entity store and only asks the backend to fill gaps.

02-root-empty

Open the palette with Cmd/Ctrl+K

Search scopes

Typing a short prefix converts into a removable filter badge and scopes the search:

  • w: my workflows (bookmarked + recent + latest)
  • ws:/wp: shared/public workflows
  • t: tools (favorites + recents, 1-character local search, backend search from 3 characters)
  • h:/hs:/hp:/ha: histories
  • d: datasets, v: visualizations
  • i: invocations (workflow names with state, date, and history)
  • r:/rp: reports, it: interactive tools (running on top).

Scopes respect login and instance configuration, and ? lists them all.

Scopes tour

Scopes tour

Tools: favorites first, instant single-character matches

Tools: favorites first, instant single-character matches

Reports scopes (shown as r:/rp: reports at the tip of the stack

Reports scopes (shown as r:/rp: reports at the tip of the stack)
Reports scopes (shown as r:/rp: reports at the tip of the stack)

Data is store-first: results come from the entity store cache; the backend fills gaps; everything is merged back into the stores (deduplication, in-flight request sharing, stale-while-revalidate on palette open). Recently opened items are remembered per type in localStorage and lead each base scope's empty view.

Recently opened items lead the scope

Recently opened items lead the scope

Actions

  • > lists the actions. Plain Enter runs the default
  • Shift+Enter opens an argument mode with the action pinned as a badge:
    • upload (pick a method)
    • create new history (name it)
    • create new report (title it; the slug is derived and conflicts are retried)
    • run workflow (picker)
    • Ask GalaxyAI (the question seeds a new chat via /galaxyai/new?q=, prefilled but not sent; existing chats are listed).
  • Shift+Enter also triggers per-item secondary actions, for example, "Set as current" on an owned history row
  • Holding Shift previews it in the footer and on the active row.

Actions list and upload argument mode

Actions list and upload argument mode

Create a history from the palette

Create a history from the palette

Create a report from the palette

Create a report from the palette

Run workflow picker

Run workflow picker

Ask GalaxyAI with a seeded question

Ask GalaxyAI with a seeded question

Secondary action on a history row

Secondary action on a history row

Help, categories, and keyboard details

  • ? shows a help view listing every scope, action, and key, GitHub-palette style; selecting a row applies it, and the input icon switches to a question mark while in help mode.
  • A category row sits on top of unscoped results (All | Workflows | … | Navigation), driven purely by arrow keys — no Tab hijacking; clicking a chip keeps the keyboard alive.
  • Stepwise Esc: clears the query, then removes the badge, then closes; Backspace at the input start pops the badge. Closing with Cmd/Ctrl+K or a backdrop click preserves the query and filter, so reopening continues where you left off (the preserved text is selected for quick replacement). An action's argument mode is the exception: it is left on close so a half-typed argument can never leak into the next query.
  • Cmd/Ctrl+Enter or a modifier-click opens the item in a new tab and keeps the palette open, with the footer and the active row showing the new-tab hint while the modifier is held.
  • Clicks on the dialog chrome (borders, footer, section titles) never steal focus from the input.
  • Free-text argument modes prompt for their input ("Type a name for the new history…") instead of showing "No results."; a scope whose first fetch is still in flight shows a muted "Searching…" row, and a failing first fetch shows "Couldn't load …. Try again." instead of a silent empty state.
  • Fixed results height (the dialog no longer jumps between result sets, loading and empty states)
  • On small and short viewports, the palette fits the screen (dvh-capped results, wrapping footer with low-priority hints pruned).
  • 130 ms open/close animation on the native dialog, disabled under prefers-reduced-motion.

Help view

Help view

Stepwise Esc and badge handling

Stepwise Esc and badge handling

Category row

Category row

New-tab modifier

New-tab modifier

Query preserved across a Cmd/Ctrl+K close

Query preserved across a Cmd/Ctrl+K close

Error row

Error row

Searching row

Searching row

Small viewport

Small viewport

Supporting changes outside the palette

  • GalaxyAI.vue accepts an optional seeded question via /galaxyai/new?q= (prefill only; q is then dropped with router.replace, which no longer remounts the view since [26.1] Keep the center GalaxyAI view mounted across its own route changes #23526).
  • toolStore.getToolsById guards against prototype-colliding queries, so searching "constructor" no longer throws in the tool panel, the data source upload list or the palette.
  • historyStore.createNewHistory takes an optional name (used by the palette's "Create new history"); HistoryNavigation.vue now calls it without passing the click event.
  • entryPointStore and invocationStore track whether their lists have been fetched; new shared helpers utils/slug.ts and relativeUpdatedLabel/shortDateLabel in utils/dates.ts.

Code layout

CommandPalette.vue renders and wires; the logic lives next to it: usePaletteMachine.ts (mode, text, badge and category state), paletteHelp.ts (help view builders), usePaletteDialog.ts (native dialog handling and the open/close transition), usePaletteModifiers.ts (window key listeners), usePaletteFooter.ts (placeholder and footer hints), and one module per provider under providers/.

Not in this PR (follow-up, stacked): configuration options, anonymous access with the login prompt, the n: navigation scope, the incremental root fan-out over shared and public content, and the pages → reports rename of the p:/pp: scopes (this PR still says "Pages"; the follow-up aligns it with the UI rename on dev).

Screenshots and clips in this description were recorded at the tip of the stack, so they already show r:/rp: reports and the public scopes; everything else is as in this PR.

Tests

~300 vitest specs for the palette, providers, state machine and composables (gating, MRU, argument modes, stepwise escape, category row, close/reopen races, staleness with epoch guards, error rows, prototype-collision regression), plus the existing type-check, eslint and prettier gates.

How to test the changes?

  • I've included appropriate automated tests.
  • Instructions for manual testing are as follows:
    1. Cmd/Ctrl+K → type ? for the help view.
    2. Try t: with one character; w:/h:/p: with and without a query; Esc stepping; close with Cmd/Ctrl+K and reopen to continue the search.
    3. > → "Create new history" with Shift+Enter, name it; "Run workflow" picker; "Ask GalaxyAI" with a question (needs an LLM configured).
    4. Hold Cmd/Ctrl on a result: new-tab hint and the palette stays open; hold Shift on one of your histories: "Set as current" preview.
    5. Search rna without a scope and move through the category row with the arrow keys.

License

  • I agree to license these and all my past contributions to the core galaxy codebase under the MIT license.

@itisAliRH itisAliRH added area/UI-UX kind/feature area/client highlight Included in user-facing release notes at the top highlight/power-user Included at bottom of user-facing release notes (please use either this or highlight, but not both) labels Sep 7, 2026
@itisAliRH
itisAliRH force-pushed the feat/command-palette-core branch from c57e888 to 6b3e8b9 Compare September 11, 2026 17:21
Design tokens for the command palette styling. Same dependency and
import as feat/personal-profile-page so either branch merges clean.
Provider abstraction (navigation/actions/tools) with prefix routing
(t: active; w/h/d/v/i/p reserved for entity providers) and ranking on
top of the tool panel's weighted scorer. Exposes toolResults from the
tool store for backend tool search consumers.
Native <dialog> (GModal pattern) with combobox ARIA, grouped results
sorted by best match, ctrl/cmd+enter opens routed items in a new tab.
Styled with brand tokens over app-scale type. Exposes isMac from the
event store for the platform-aware shortcut hints.
Global ctrl/cmd+k shortcut, singleton mount in the analysis app next
to ConfirmDialog, and a masthead search button with a platform-aware
shortcut hint.
App-style variant of the palette uses the existing theme variables;
the brand-tokens dependency is not needed on this branch.
Uses the existing --color-blue/grey ramps and --background-color:
light input header, blue selection tint, grey footer. Replaces the
brand-token look so both variants can be compared side by side.
The global upload modal composable was removed on dev in favor of the
upload method registry; point the palette action at the /upload page.
Registers the one- and two-letter scope prefixes (w, ws, wp, t, h, hs, hp,
ha, d, v, i, p, pp, it) with the provider serving each of them, plus the
anonymous and configuration gates deciding whether a scope is offered.
…ypes

Providers can return several titled sections for one scope, items can carry a
shift+enter action or an argument mode, and a row can render a right-aligned
key hint the way the help panel needs it.
A recognized token is stripped from the input and rendered as a removable
badge chip, so the parser only has to match scope keys exactly: unknown
prefixes such as name:fastqc stay plain search text. Backspace at the start of
the input or the chip's remove button pops the badge, escape clears the text
before the badge and only closes the palette from an empty root, and a lone ?
opens a help panel whose rows apply the scope they document.
ctrl/cmd + enter (or click) on a navigable item opens it in a new tab and
leaves the palette open, so several results can be sent to tabs in a row.
While the modifier is held the footer highlights the new-tab binding and the
selected row shows an external-link icon; the held state is reset on window
blur, since the new tab steals focus and the keyup never arrives.

The footer is now derived from the palette mode: it gains the scope removal
hint while scoped, the secondary action of the selected item, and an escape
label stepping through clear, back and close.
useRecentPaletteItems persists a per-entity-type MRU list of palette
entries in per-user local storage, following the recentTools pattern.
Entries dedupe by type and id, move to the front on reuse and are capped
per type; malformed stored payloads are discarded on read.
Providers declare which entity a result stands for, so the palette can
record it in the recent-items list centrally instead of every provider
writing its own MRU entries.
Serves w:, ws: and wp: from the workflow store: bookmarked, palette
recents and the latest workflows of the scope, filtered client-side with
a backend query only when an incomplete cache cannot fill a section.
Enter runs a workflow, shift+enter opens the editor of an owned one. The
unscoped fan-out filters the cached list only and never fetches.
Serves h:, hs:, hp: and ha: from the history store caches, with palette
recents above the listing. Enter opens the history view, shift+enter
makes an owned history current. The unscoped fan-out filters the cached
own histories only and never fetches.
Serves d: from the dataset list store: palette recents above the latest
datasets, one backend query per keystroke at most and only when the
cache cannot fill the section. The unscoped fan-out filters the cached
summaries only and never fetches.
Serves v: from the visualization store: palette recents above the user's
latest visualizations, opening the same display route the saved
visualizations grid uses. The unscoped fan-out ranks the cache only and
never fetches.
Serves i: from the latest invocations the store caches, filtered
client-side on workflow and history name because the invocations index
has no free-text search. Names come from the workflow and history stores
the listing side-populates, so a row never triggers a request.
Serves p: and pp: from the page store: palette recents above the
listing, enter opens the published view and shift+enter the editor of an
owned page. The unscoped fan-out filters the cached own pages only and
never fetches.
A query like "constructor" resolved Object.prototype.constructor as a cached search result and filterTools then threw iterating it. The tool list and the data source upload view hit this as well as the palette.
The getter now owns the prototype-key guard, so the palette no longer needs the raw toolResults cache and the store stops exposing it.
Analysis.vue now keys every /galaxyai route alike (1b27fe3), so a router.replace no longer remounts the chat and the history.replaceState workaround can go. Other query parameters are kept.
Awaiting the history and workflow name lookups is palette display logic, so it moves out of invocationStore.fetchLatestInvocations and into the invocations provider, which now awaits them after both the first fetch and the background refresh. The store no longer imports the history and workflow stores.
The palette duplicated the store's create, count and switch steps only to pass a name. The store now takes an optional name (created through the API, like copyHistory) and the palette calls it. The history panel's button no longer hands its click event to the method as that name.
A text-to-slug helper is not palette specific. The fallback for a text without usable characters is now the caller's choice.
…dmin

Neither CommandPaletteProvider.prefix nor PaletteContext.isAdmin is read anywhere; scoping lives in providers/scopes.ts.
The tools section's 3.5 is now derived from the search key weights it sits between. A scope test also checks that every scope key can actually be typed as a scope token.
Histories and workflows had identical relative "updated …" labels, and pages, visualizations and invocations three variants of a short date that disagreed on their empty value. Both are now helpers in utils/dates.ts returning undefined for a missing or malformed time; the rendered subtitles are unchanged.
The category row's selection was a separate ref the component reset from two watchers. It is now part of the root mode, so every mode transition drops it on its own, and the machine drops it the moment the query it narrows is emptied. Categories hold the scope they borrow instead of re-resolving a key on every search; only Navigation, which has no scope, names its provider. The visible behaviour is unchanged.
The previous mode's rows used to stay on screen until the debounced search started, so enter needed its own guard against running one of them under the new badge. A sync watcher on the search identity now drops the rows, the selection and any search still in flight right away, while the search itself stays debounced: typing, a mode switch and a sweep across the category row still cost one search. The enter guard and the rendered-identity bookkeeping go.
The scope, action and key binding rows of the help panel are pure functions of the context, the query and two machine transitions, so they move out of the component and take those as parameters. The palette's section shape moves into types.ts alongside the provider one it matches. No behaviour change.
The native dialog's event handlers and its class-toggled open/close transition move verbatim into a composable taking the element refs, the open state and the escape and close callbacks. The mechanism is unchanged: the bounding-rect backdrop check and the scrollbar mousedown exception stay as they are, mirroring galaxy-ui's GModal.
…etteModifiers

The held ctrl/cmd and shift tracking, the platform modifier label and the global ctrl/cmd+K toggle are window-wide concerns of their own, so they move into a composable that also owns the release the palette runs on close.
…o usePaletteFooter

The input placeholder, the escape and shift+enter labels and the footer's key hints are derived from the mode, the selection and the held keys alone, so they move into a composable returning the computeds. The per-item shift+enter label stays a plain function for the row previews.
createNewHistory(name) refreshed the history count before switching, so a failing /api/histories/count threw after the server had already created the history. The palette then reported "Failed to create history" and a retry made a duplicate. The named branch now switches first and only logs a failed count refresh.
The review follow-ups added several multi-line prose comments; each is now a single line of why.
@itisAliRH

Copy link
Copy Markdown
Member Author

Looks extremely cool! Here is a first quick agentic review; it seems to focus on reducing and generalizing code, and it does look like a good idea with such a huge PR 😅

Details

Thanks a lot for the thorough pass, @davelopez! I went through every point, checked each one against the code, and addressed most of them. The split follows the stack: changes that don't collide with #23473 landed here, and the provider/search refactors landed at the tip of #23473, because that PR rewrites the same code (histories/workflows/reports providers and the fan-out) and adds a second copy of the pattern you pointed at, so extracting it there removes both copies at once.

Details↓

1. CommandPalette.vue size

Split into pure modules and composables, with no behaviour change (the component tests are unchanged):

2. Provider duplication (in #23473)

  • providers/storeFirst.ts: one store-first list search (hydrate once, rank the cache, ask the backend only when the cache can't be complete, merge and re-rank), used by histories and workflows, and it also replaces the rootItems/variantItems copies Command palette: configuration options, anonymous access and a navigation scope #23473 had added. Reports and visualizations follow the same rules.
  • providers/limits.ts: one PALETTE_LIMITS table replaces the per-file caps and thresholds. The remaining size differences (datasets 6, tools 10, invocations 15) are kept as explicit entries because changing them would change what users see.
  • providers/recent.ts (one resolver for remembered rows, used by six providers), providers/workflowRows.ts (so actions no longer imports from the workflows provider), and relativeUpdatedLabel/shortDateLabel in utils/dates.ts (there were two formats, relative and absolute, not one).
  • Line count of providers/: 2396 → 2227 including the new shared helpers, 455 lines removed before them.
  • Datasets and invocations stay outside the shared helper: datasets filters inside its store with its own completeness rule, and invocations has no backend search. Both use the limits table and the recent-row helper.

Unifying the logic also exposed a few accidental differences, now fixed as separate commits in #23473:

  • Every store-first backend search now needs at least 2 characters (a single character in w:, r: or v: used to hit the backend). Tools keep their deliberate 3.
  • Reports now load the unfiltered listing before searching it, and a search no longer counts as a refresh of the listing. The page size is 25, as for histories and workflows (it was 8).
  • Visualizations now skip the backend when the cached listing is already complete, share in-flight fetches, and rank merged rows locally like the other providers (tags count as keywords so tag-only backend matches are kept).

3. Mode × category

I folded the category into the root mode ({ type: "root", category? }). Both reset watchers are gone, categories store their scope directly (no second providerId), and rows are now cleared synchronously when the mode changes, so the Enter identity guard and renderedIdentity are deleted. The search itself stays debounced, so a ←/→ sweep across the row still costs one search.

I kept the visible behaviour instead of either suggested option, because both would regress something users rely on:

  • (a) Entering the category as a scope would add a badge, clear the typed query, and remove the ←/→ sweep between categories. The Navigation category (no scope) would also have to go.
  • (b) A client-side filter over the root fan-out would lose results: the root fan-out is cache-only on purpose, while a category fetches from the server (up to 15 rows, plus bookmarked/recent sections), so any match that isn't cached yet would disappear.

4. Shared stores and layers

  • toolStore: toolResults is no longer exported. The provider uses getToolsById, which now guards against prototype keys itself. This also fixes a real bug outside the palette: searching the tool panel or the data source upload list for constructor threw.
  • invocationStore: the history and workflow name lookups moved out of the store into the palette provider.
  • createNamedHistory → historyStore.createNewHistory(name?). This also fixes a latent bug in HistoryNavigation.vue, which bound @click="historyStore.createNewHistory" and would have passed the click event as the name. slugify moved to utils/slug.ts. In Command palette: configuration options, anonymous access and a navigation scope #23473, report creation moved into pageStore.createMarkdownPage(title).
  • GalaxyAI: window.history.replaceState is gone. Since [26.1] Keep the center GalaxyAI view mounted across its own route changes #23526, Analysis.vue keys the /galaxyai router view by path rather than full path, a plain router.replace that drops q (keeping the other query params) no longer remounts the view, so the workaround isn't needed any more.
  • Kept as is:
    • The optional limit on loadHistories follows FetchHistoryListOptions.limit, which is already on dev, and is a generic "fetch only N rows" option. I made its docstring consumer-neutral.
    • The per-store hasLoaded…/ensure…Loaded pairs follow what dev already does in datasetListStore, historyStore and visualizationStore. A shared "load once" helper would mean refactoring stores that are already merged, so I'd rather do that as a follow-up PR than here.

5. Types and boundaries

  • Deleted prefix? and the unused isAdmin from the context.
  • BACKEND_RANKED_SCORE is now a named constant derived from the PALETTE_SEARCH_KEYS weights, and a test fails if a future scope key no longer fits the scope-token pattern.
  • Command palette: configuration options, anonymous access and a navigation scope #23473: Gated<T> wraps the item ({ item, anonymous, configGate? }) with one visibleFor() helper, so the underscore-strip is gone and the gate field has one name. toPaletteHistory() narrows AnyHistory | AnyHistoryEntry once and replaces the as unknown as casts. Providers now get the query already trimmed, with that stated once on the provider type, and the per-provider trims are gone. One shared test context factory replaces thirteen copies.
  • PaletteContext: I didn't split it. It has seven fields, and removing the dead one plus sharing the test factory addressed the practical cost.
  • SCOPE_TOKEN stays a 1–2 letter pattern on purpose. It also has to recognise unknown tokens such as xy: so they are never sent to backend searches, and deriving it from the registry keys would lose that. The new test guards the coupling instead.

6. Brittle handling

  • The dialog code moved into usePaletteDialog.ts unchanged. The bounding-rect backdrop check is needed: event.target === dialog is also true when a press starts on one child and is released over another (for example drag-selecting text in the input and letting go over the footer), and the check mirrors galaxy-ui's GModal.onClickDialog. I kept the class-toggle animation instead of <transition> because Vue 2 and Vue 3 use different transition class names (-enter vs -enter-from), so a <transition> version would need reworking during the Vue 3 migration anyway.
  • The scope-token guard moved out of the tools provider into the fan-out (localOnly), and category narrowing honours it too (Command palette: configuration options, anonymous access and a navigation scope #23473).
  • refresh.ts is unchanged: the clock is already controllable in tests (vi.useFakeTimers/setSystemTime), and resetListRefreshTracking only isolates module state between tests.
  • The dataset subtitle's getHistoryById(id, false) is an O(1) cache read that never fetches, so there's no per-keystroke cost.

Everything is covered by the client test suite, vue-tsc and lint on every commit of both branches. Happy to adjust any of the calls above.

@itisAliRH
itisAliRH force-pushed the feat/command-palette-core branch from c1150ed to e6eb2ad Compare September 24, 2026 13:30
The dataset list store now drops rows that are not HDAs, so fixtures without history_content_type never reached the provider.
The backend total from /api/datasets also counts collections, which the dataset list store now drops, so comparing it to the cached ids never reported a complete cache and every keystroke fell back to a search request.
useScrollEdges reports which edges of a horizontally scrolling element hide content, updated on scroll, resize and content changes, and reveals a child with reduced-motion aware scrolling.
The chips overflow the dialog, which always showed a horizontal scrollbar. The row now hides it, masks whichever edge has hidden chips, and scrolls the chip ←→ lands on into view.

@davelopez davelopez 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 for addressing the comments!

@jmchilton

Copy link
Copy Markdown
Member

Can you fix this in 23473?

1. **History switcher pagination regression.** Palette is the only caller of `loadHistories(false, …)`;
   that path resets `historiesOffset` to 0 (`historyStore.ts:497`) and holds `historiesLoading`.
   `refreshListWhenStale` repeats it every 60s (`providers/histories.ts:185`). A concurrent
   `HistoryScrollList.loadMore` is silently dropped (`historyStore.ts:534-536`) and next page restarts
   at offset 0. Fix: merge-only fetch that leaves pagination state alone + store test.

@jmchilton
jmchilton merged commit c8708dd into galaxyproject:dev Sep 26, 2026
28 checks passed
@github-project-automation github-project-automation Bot moved this from Needs Review to Done in Galaxy Dev - weeklies Sep 26, 2026
@jmchilton jmchilton mentioned this pull request Sep 26, 2026
2 tasks
@itisAliRH
itisAliRH deleted the feat/command-palette-core branch September 28, 2026 09:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/client area/UI-UX highlight/power-user Included at bottom of user-facing release notes (please use either this or highlight, but not both) highlight Included in user-facing release notes at the top kind/feature

Projects

Development

Successfully merging this pull request may close these issues.

4 participants

⌂ Proxy