Skip to content

Commit

Permalink
Add dropdown to instance breadcrumb
Browse files Browse the repository at this point in the history
  • Loading branch information
charliepark committed Aug 20, 2024
1 parent f53bb38 commit 6d2fdf7
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions app/components/TopBarPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -326,14 +326,21 @@ export function ProjectPicker({ project }: { project?: Project }) {
export function InstancePicker() {
// picker only shows up when an instance is in scope
const instanceSelector = useInstanceSelector()
const { instance } = instanceSelector

const { project, instance } = instanceSelector
const { data: instances } = useApiQuery('instanceList', {
query: { project, limit: PAGE_SIZE },
})
const items = (instances?.items || []).map(({ name }) => ({
label: name,
to: pb.instance({ project, instance: name }),
}))
return (
<TopBarPicker
aria-label="Switch instance"
category="Instance"
current={instance}
to={pb.instanceStorage(instanceSelector)}
to={pb.instance({ project, instance })}
items={items}
noItemsText="No instances found"
/>
)
Expand Down

0 comments on commit 6d2fdf7

Please sign in to comment.