Repository navigation
Add a command palette (Cmd/Ctrl+K) with scoped search, actions and inline help - #23472
Conversation
c57e888 to
6b3e8b9
Compare
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.
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.
|
c1150ed to
e6eb2ad
Compare
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
left a comment
There was a problem hiding this comment.
Thank you for addressing the comments!
|
Can you fix this in 23473? |
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.
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 workflowst:tools (favorites + recents, 1-character local search, backend search from 3 characters)h:/hs:/hp:/ha:historiesd:datasets,v:visualizationsi: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
Tools: favorites first, instant single-character matches
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
Actions
>lists the actions. Plain Enter runs the default/galaxyai/new?q=, prefilled but not sent; existing chats are listed).Actions list and upload argument mode
Create a history from the palette
Create a report from the palette
Run workflow picker
Ask GalaxyAI with a seeded question
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.prefers-reduced-motion.Help view
Stepwise Esc and badge handling
Category row
New-tab modifier
Query preserved across a Cmd/Ctrl+K close
Error row
Searching row
Small viewport
Supporting changes outside the palette
GalaxyAI.vueaccepts an optional seeded question via/galaxyai/new?q=(prefill only;qis then dropped withrouter.replace, which no longer remounts the view since [26.1] Keep the center GalaxyAI view mounted across its own route changes #23526).toolStore.getToolsByIdguards against prototype-colliding queries, so searching "constructor" no longer throws in the tool panel, the data source upload list or the palette.historyStore.createNewHistorytakes an optional name (used by the palette's "Create new history");HistoryNavigation.vuenow calls it without passing the click event.entryPointStoreandinvocationStoretrack whether their lists have been fetched; new shared helpersutils/slug.tsandrelativeUpdatedLabel/shortDateLabelinutils/dates.ts.Code layout
CommandPalette.vuerenders 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 underproviders/.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 thep:/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?
?for the help view.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.>→ "Create new history" with Shift+Enter, name it; "Run workflow" picker; "Ask GalaxyAI" with a question (needs an LLM configured).rnawithout a scope and move through the category row with the arrow keys.License