66 * Copyright Oxide Computer Company
77 */
88
9+ import { useMemo } from 'react'
910import { Link , Outlet , useNavigate } from 'react-router-dom'
1011
11- import { apiQueryClient , useApiMutation , type IpPool } from '@oxide/api'
12+ import {
13+ apiQueryClient ,
14+ useApiMutation ,
15+ usePrefetchedApiQuery ,
16+ type IpPool ,
17+ } from '@oxide/api'
1218import { DateCell , linkCell , useQueryTable , type MenuAction } from '@oxide/table'
1319import { buttonStyle , EmptyMessage , Networking24Icon } from '@oxide/ui'
1420
21+ import { useQuickActions } from 'app/hooks'
1522import { confirmDelete } from 'app/stores/confirm-delete'
1623import { pb } from 'app/util/path-builder'
1724
@@ -33,6 +40,7 @@ IpPoolsTab.loader = async function () {
3340export function IpPoolsTab ( ) {
3441 const navigate = useNavigate ( )
3542 const { Table, Column } = useQueryTable ( 'ipPoolList' , { } )
43+ const { data : pools } = usePrefetchedApiQuery ( 'ipPoolList' , { query : { limit : 25 } } )
3644
3745 const deletePool = useApiMutation ( 'ipPoolDelete' , {
3846 onSuccess ( ) {
@@ -59,6 +67,23 @@ export function IpPoolsTab() {
5967 } ,
6068 ]
6169
70+ useQuickActions (
71+ useMemo (
72+ ( ) => [
73+ {
74+ value : 'New IP pool' ,
75+ onSelect : ( ) => navigate ( pb . projectNew ( ) ) ,
76+ } ,
77+ ...( pools . items || [ ] ) . map ( ( p ) => ( {
78+ value : p . name ,
79+ onSelect : ( ) => navigate ( pb . ipPool ( { pool : p . name } ) ) ,
80+ navGroup : 'Go to IP pool' ,
81+ } ) ) ,
82+ ] ,
83+ [ navigate , pools ]
84+ )
85+ )
86+
6287 return (
6388 < >
6489 < div className = "mb-3 flex justify-end space-x-2" >
0 commit comments