Skip to content

Commit a669957

Browse files
committed
move ip pool page table columns out to static var
1 parent 90b26fb commit a669957

1 file changed

Lines changed: 23 additions & 26 deletions

File tree

app/pages/system/networking/IpPoolPage.tsx

Lines changed: 23 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,29 @@ export async function clientLoader({ params }: LoaderFunctionArgs) {
101101

102102
export const handle = makeCrumb((p) => p.pool!)
103103

104+
const silosColHelper = createColumnHelper<IpPoolSiloLink>()
105+
106+
const silosCols = [
107+
silosColHelper.accessor('siloId', {
108+
header: 'Silo',
109+
cell: (info) => <SiloNameFromId value={info.getValue()} />,
110+
}),
111+
silosColHelper.accessor('isDefault', {
112+
header: () => {
113+
return (
114+
<span className="inline-flex items-center gap-2">
115+
Silo default
116+
<TipIcon>
117+
When no pool is specified, IPs are allocated from the silo's default pool for
118+
the relevant version and type.
119+
</TipIcon>
120+
</span>
121+
)
122+
},
123+
cell: (info) => (info.getValue() ? <Badge>default</Badge> : null),
124+
}),
125+
]
126+
104127
export default function IpPoolpage() {
105128
const poolSelector = useIpPoolSelector()
106129
const { data: pool } = usePrefetchedQuery(ipPoolView(poolSelector))
@@ -264,8 +287,6 @@ function SiloNameFromId({ value: siloId }: { value: string }) {
264287
return <LinkCell to={pb.siloIpPools({ silo: silo.name })}>{silo.name}</LinkCell>
265288
}
266289

267-
const silosColHelper = createColumnHelper<IpPoolSiloLink>()
268-
269290
/** Look up silo name from query cache and return a label for use in modals. */
270291
function getSiloLabel(siloId: string) {
271292
const siloName = queryClient.getQueryData<Silo>(siloView({ silo: siloId }).queryKey)?.name
@@ -405,30 +426,6 @@ function LinkedSilosTable() {
405426
/>
406427
)
407428

408-
const silosCols = useMemo(
409-
() => [
410-
silosColHelper.accessor('siloId', {
411-
header: 'Silo',
412-
cell: (info) => <SiloNameFromId value={info.getValue()} />,
413-
}),
414-
silosColHelper.accessor('isDefault', {
415-
header: () => {
416-
return (
417-
<span className="inline-flex items-center gap-2">
418-
Silo default
419-
<TipIcon>
420-
When no pool is specified, IPs are allocated from the silo's default pool
421-
for the relevant version and type.
422-
</TipIcon>
423-
</span>
424-
)
425-
},
426-
cell: (info) => (info.getValue() ? <Badge>default</Badge> : null),
427-
}),
428-
],
429-
[]
430-
)
431-
432429
const columns = useColsWithActions(silosCols, makeActions)
433430
const { table } = useQueryTable({
434431
query: ipPoolSiloList(poolSelector),

0 commit comments

Comments
 (0)