Repository navigation
Command palette: search entities, open page dialogs, shortcut sheet - #192
Merged
Merged
Conversation
- ⌘K palette on cmdk (src/ui/command.tsx, src/palette/): pages with ⌘1-⌘9, actions (new upstream / key / route / group / proxy / price sheet, inference and connection tests, routing dry run, search traffic, switch connection, add a remote connection, refresh, sidebar, config file, version history, check for updates, notices, shortcuts), and search over data already on hand: upstreams, keys, routes, groups, clients, connections, Settings sections and Traffic's loaded requests (by model, one row per model, or by id). - The palette only navigates. Each item is nav.open(page, params) and the page opens its own dialog in useNavParams, exactly as its button or row click would; NavParams gains create / edit / test / dryRun / detail / setup / section. A source test checks every param the palette sends is read somewhere. - Recent (last five used) above Pages and Actions; frequent use nudges search ranking. Names outrank aliases (other language, synonyms, URL). - Switch connection is a second level (Esc / Backspace goes back); the current connection is listed but not selectable. - ? (outside text fields) or the palette footer opens a shortcut sheet generated from the same key table as the palette caps and the sidebar tooltips (palette/keys.tsx). Sidebar items show their ⌘n in a tooltip. - Global shortcuts do nothing while a form dialog is open; the palette and the sheet are passive, so ⌘4 read off the sheet works. - Palette scales and fades in from the top; list height follows the results; selection and scroll are computed with the results so typing never scrolls to a stale row. - Settings sections scroll into view when opened from the palette. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Cmd+R and the palette's "Refresh data" also refetch every mounted
useResource (new invalidateAll in lib/resource.ts), not only the shell's
status and overview, so the page in front actually refreshes.
- The Settings page handles nav.open("settings", { section }) in its own
useNavParams (Config.tsx) instead of the shell scrolling for it; a
restructured Settings page replaces that handler without a second
scroller left behind in App.tsx. NavParams.settings.section is a plain
string again; the palette's section ids live in palette/sections.ts,
with a note on keeping them in step with the page.
- Rebased onto the Upstreams page (#193): the palette's dialog params are
merged into the page's existing useNavParams handler.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of the UI upgrade (after #187). Replaces the foundation's minimal
CommandPalettewith a real command palette, adds a keyboard shortcut sheet, and shows each page's ⌘n in the sidebar tooltips. Rebased onto the Routing (#191) and Upstreams (#193) pages.What it does
⌘K palette (
src/palette/, cmdk via the newsrc/ui/command.tsx)clientscache as the Clients and Keys pages), connections, Settings sections, and Traffic's loaded requests — by model (one row per model, the most recent) or by id (#50431, prefixes; an id outside the loaded rows still gets an "Open request #…" row).试算puts "Routing dry run…" above the Routing page.The palette only navigates — dialogs stay in their pages. Every item is
nav.open(page, params); the page opens its own dialog inuseNavParamsexactly like its button or row click. NewNavParams:upstreams {edit, create: upstream|proxy|sheet, test: speed|link},keys {edit, create},routing {editRoute, editGroup, create: route|group, dryRun},clients {detail, setup}.settings {section}is handled by the Settings page itself (Config.tsxcallsrevealSection, which waits for the section to render).src/palette/wiring.test.tsparses everynav.openthe palette sends and fails if no page reads that param — so a page rewrite cannot silently drop the receiving end.Keyboard
?(outside text fields) or the palette footer opens a shortcut sheet: General, Pages (⌘1–⌘9, ⌘,), Traffic (⌘F, ↑↓, ↵, →←, Esc), Command palette (↑↓, ⌥↑↓, ↵, ⌫, Esc). Press?again to close.palette/keys.tsx:COMBOS,pageCombo,Keys) in the palette, the sheet, the sidebar tooltips and the toolbar tooltips. macOS shows one cap per combo (⌘⌥S), Windows/Linux one cap per key (Ctrl B).data-passive: ⌘4 read off the sheet works, and closes it.useResource(newinvalidateAllinlib/resource.ts), not only the shell's status and overview — before, the page in front (key usage, client list, upstream stats…) did not refresh.For the pages still in flight
useNavParams("settings", …)handler that scrolls top.section, and updatepalette/sections.ts(one entry per setting a user would search for — language, appearance, port… — each pointing at the section that now holds it; its titles come from each section's own i18n, so a moved or deleted i18n file shows up as a compile error there).TrafficPage; change both together.Decisions (made without asking, per the brief)
shouldFilter={false}) scrolled to the previously selected row when it was still in the new results, hiding the top of the list.notify.promise), because nothing on screen changes when there is no update; when there is one, Rust opens the update window as in Settings.App.tsxwould fight the page's own once Settings gets its section index.Core
No core change needed. Possible follow-up: a core request search (by model / key over the whole history) would let the palette find requests older than the rows Traffic has loaded; today only ids outside that window are reachable.
Checks
pnpm typecheck,pnpm test(38 files / 320 tests, incl. palette tests for ranking, arrangement, usage, items gating and the wiring guard),pnpm build. Checked in the full-app preview harness after each rebase: light/dark, zh/en, 1100×720 and 820×560, empty install, core not running, remote read-only, Windows key caps; every action and entity opens the right page dialog (new route / dry run / group edit on the new Routing page, upstream edit on the new Upstreams page, key edit, client setup, Settings sections), and ⌘R refetches the Keys page's data.🤖 Generated with Claude Code