@@ -12,6 +12,7 @@ import { Outlet, useNavigate, type LoaderFunctionArgs } from 'react-router-dom'
12
12
import {
13
13
apiQueryClient ,
14
14
useApiMutation ,
15
+ useApiQuery ,
15
16
useApiQueryClient ,
16
17
usePrefetchedApiQuery ,
17
18
type Vpc ,
@@ -21,7 +22,8 @@ import { Networking16Icon, Networking24Icon } from '@oxide/design-system/icons/r
21
22
import { DocsPopover } from '~/components/DocsPopover'
22
23
import { getProjectSelector , useProjectSelector , useQuickActions } from '~/hooks'
23
24
import { confirmDelete } from '~/stores/confirm-delete'
24
- import { makeLinkCell } from '~/table/cells/LinkCell'
25
+ import { SkeletonCell } from '~/table/cells/EmptyCell'
26
+ import { LinkCell , makeLinkCell } from '~/table/cells/LinkCell'
25
27
import { getActionsCol , type MenuAction } from '~/table/columns/action-col'
26
28
import { Columns } from '~/table/columns/common'
27
29
import { PAGE_SIZE , useQueryTable } from '~/table/QueryTable'
@@ -51,6 +53,14 @@ export const VpcDocsPopover = () => (
51
53
/>
52
54
)
53
55
56
+ const FirewallRuleCount = ( { project, vpc } : { project : string ; vpc : string } ) => {
57
+ const { data } = useApiQuery ( 'vpcFirewallRulesView' , { query : { project, vpc } } )
58
+
59
+ if ( ! data ) return < SkeletonCell /> // loading
60
+
61
+ return < LinkCell to = { pb . vpc ( { project, vpc } ) } > { data . rules . length } </ LinkCell >
62
+ }
63
+
54
64
const colHelper = createColumnHelper < Vpc > ( )
55
65
56
66
// just as in the vpcList call for the quick actions menu, include limit to make
@@ -120,6 +130,10 @@ export function VpcsPage() {
120
130
} ) ,
121
131
colHelper . accessor ( 'dnsName' , { header : 'DNS name' } ) ,
122
132
colHelper . accessor ( 'description' , Columns . description ) ,
133
+ colHelper . accessor ( 'name' , {
134
+ header : 'Firewall Rules' ,
135
+ cell : ( info ) => < FirewallRuleCount project = { project } vpc = { info . getValue ( ) } /> ,
136
+ } ) ,
123
137
colHelper . accessor ( 'timeCreated' , Columns . timeCreated ) ,
124
138
getActionsCol ( makeActions ) ,
125
139
] ,
0 commit comments