Skip to content

Improve "Jump To" (cmd-k) dialog#3129

Open
notpeter wants to merge 2 commits intomainfrom
better_cmd_k
Open

Improve "Jump To" (cmd-k) dialog#3129
notpeter wants to merge 2 commits intomainfrom
better_cmd_k

Conversation

@notpeter
Copy link
Contributor

@notpeter notpeter commented Mar 16, 2026

I was initially excited about using cmd-k to navigate the UI with the keyboard but immediately ran into some limitations and so took a stab at improving them.

  • Fix multi-page search in cmd-k: Projects, Project Instances, Project VPCs, Project IP Pools, Silos
  • Add missing search to cmd-k: Project Floating IPs, Silo Images, Project Images
  • Add action from button to cmd-k:
    • Project Affinity: "New Group"
    • Project Access: "Add user or group"
    • Project Disks: "New disk"
    • Project Floating IPs: "New Floating IP"
    • Project Images: "Upload Image"
    • Project Snapshots: "New Snapshot"
    • Project VPC: "New VPC"
    • Silo Access: "Add user or Group"
    • Silo Images: Add "Promote image"

This is my first PR to oxidecomputer/console and was Claude assisted.
I have tested locally and verified these changes seem to work as expected. (see images in #3128)
If this is the wrong approach / redundant, feel free to summarily close.

Search improvements:
- Silos: fix multi-page search
- Silo Images: add search
- Projects: fix multi-page search
- Project Instances: fix multi-page search
- Project VPCs: fix multi-page search
- Project IP Pools: fix multi-page search
- Project Floating IPs: add search
- Project Images: add search

Add buttons to cmd-k:
- Project Affinity: "New Group"
- Project Access: "Add user or group"
- Project Disks: "New disk"
- Project Floating IPs: "New Floating IP"
- Project Images: "Upload Image"
- Project Snapshots: "New Snapshot"
- Project VPC: "New VPC"
- Silo Access: "Add user or Group"
- Silo Images: Add "Promote image"
@vercel
Copy link

vercel bot commented Mar 16, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
console Ready Ready Preview Mar 16, 2026 5:06pm

Request Review

@david-crespo
Copy link
Collaborator

david-crespo commented Mar 16, 2026

I will review in more detail, but it all looks solid at first glance. We were already tracking some of these issues in #1352, so thanks for fixing them!

[]
)
)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This made me wonder what happens when you use cmd+k when the form is already open. a) this entry still appears (not ideal but tolerable IMO — kind of complicated to avoid), b) visually the interaction with the form is messy (also not ideal but also tolerable I think)

Image

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh and it's janky if you click the background because that only affects the form, so you close the form but not the ctrl-k popup. Out of scope for this PR, just noting it.

})),
],
[navigate, silos]
[navigate, allSilos]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to make sure this hook behaves correctly when the silos request comes back (the old one would have been prefetched). I'm pretty sure it does — that's the point of this remove callback. On every re-run of the effect, we remove whatever the last one added before adding the new items.

I would leave this one not-prefetched, as you've done. Since quick actions are hidden until the user opens the menu, it's the perfect thing to defer.

export function useQuickActions(itemsToAdd: QuickActionItem[]) {
const location = useLocation()
// Add routes without declaring them in every `useQuickActions` call
const globalItems = useGlobalActions()
useEffect(() => {
const allItems = [...itemsToAdd, ...globalItems]
invariant(
allItems.length === new Set(allItems.map((i) => i.value)).size,
'Items being added to the list of quick actions must have unique `value` values.'
)
addActions(allItems)
return () => removeActions(allItems)
}, [itemsToAdd, globalItems, location.pathname])
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Jump To (cmd-k) only searches current page & has missing actions Jump To modal only allows jumping to first 25 projects

2 participants