Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 20 additions & 11 deletions app/pages/project/vpcs/VpcGatewaysTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { Columns } from '~/table/columns/common'
import { useQueryTable } from '~/table/QueryTable'
import { CopyableIp } from '~/ui/lib/CopyableIp'
import { EmptyMessage } from '~/ui/lib/EmptyMessage'
import { TipIcon } from '~/ui/lib/TipIcon'
import { ALL_ISH } from '~/util/consts'
import { pb } from '~/util/path-builder'
import type * as PP from '~/util/path-params'
Expand Down Expand Up @@ -68,17 +69,15 @@ export async function clientLoader({ params }: LoaderFunctionArgs) {

await Promise.all([
...gateways.items.flatMap((gateway: InternetGateway) => [
queryClient.prefetchQuery(
queryClient.fetchQuery(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

General prefetchQuery → fetchQuery migration discussed in 2616

gatewayIpAddressList({ project, vpc, gateway: gateway.name }).optionsFn()
),
queryClient.prefetchQuery(
queryClient.fetchQuery(
gatewayIpPoolList({ project, vpc, gateway: gateway.name }).optionsFn()
),
]),
...routers.items.map((router) =>
queryClient.prefetchQuery(
routeList({ project, vpc, router: router.name }).optionsFn()
)
queryClient.fetchQuery(routeList({ project, vpc, router: router.name }).optionsFn())
),
queryClient.fetchQuery(projectIpPoolList.optionsFn()).then((pools) => {
for (const pool of pools.items) {
Expand All @@ -91,6 +90,16 @@ export async function clientLoader({ params }: LoaderFunctionArgs) {
return null
}

export const AttachedIpAddressHeader = () => (
<>
Attached IP Address
<TipIcon className="ml-1.5">
Internet gateways without an IP address attached will use an address from the attached
IP pool
</TipIcon>
</>
)

export default function VpcInternetGatewaysTab() {
const { project, vpc } = useVpcSelector()

Expand All @@ -111,18 +120,18 @@ export default function VpcInternetGatewaysTab() {
colHelper.accessor('description', Columns.description),
colHelper.accessor('name', {
// ID needed to avoid key collision with other name column
id: 'ip-address',
header: 'Attached IP Address',
id: 'ip-pool',
header: 'Attached IP Pool',
cell: (info) => (
<IpAddressCell project={project} vpc={vpc} gateway={info.getValue()} />
<GatewayIpPoolCell project={project} vpc={vpc} gateway={info.getValue()} />
),
}),
colHelper.accessor('name', {
// ID needed to avoid key collision with other name column
id: 'ip-pool',
header: 'Attached IP Pool',
id: 'ip-address',
header: AttachedIpAddressHeader,
cell: (info) => (
<GatewayIpPoolCell project={project} vpc={vpc} gateway={info.getValue()} />
<IpAddressCell project={project} vpc={vpc} gateway={info.getValue()} />
),
}),
colHelper.accessor('name', {
Expand Down
Loading