From 2cb4fe9fb3283467c07c59ee649dbaba2266c68a Mon Sep 17 00:00:00 2001 From: Charlie Park Date: Mon, 16 Jun 2025 16:08:58 -0700 Subject: [PATCH] Add clarifying tooltip to ephemeral IP cells --- app/pages/project/instances/NetworkingTab.tsx | 29 ++++++++++++++----- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/app/pages/project/instances/NetworkingTab.tsx b/app/pages/project/instances/NetworkingTab.tsx index 8169b7979..2493a99db 100644 --- a/app/pages/project/instances/NetworkingTab.tsx +++ b/app/pages/project/instances/NetworkingTab.tsx @@ -50,6 +50,7 @@ import { CopyableIp } from '~/ui/lib/CopyableIp' import { EmptyMessage } from '~/ui/lib/EmptyMessage' import { TableEmptyBox } from '~/ui/lib/Table' import { TipIcon } from '~/ui/lib/TipIcon' +import { Tooltip } from '~/ui/lib/Tooltip' import { ALL_ISH } from '~/util/consts' import { pb } from '~/util/path-builder' @@ -85,27 +86,35 @@ const SubnetNameFromId = ({ value }: { value: string }) => { return {subnet.name} } +const EphemeralIPEmptyCell = () => ( + +
+ +
+
+) + export async function clientLoader({ params }: LoaderFunctionArgs) { const { project, instance } = getInstanceSelector(params) await Promise.all([ - apiQueryClient.prefetchQuery('instanceNetworkInterfaceList', { + apiQueryClient.fetchQuery('instanceNetworkInterfaceList', { // we want this to cover all NICs; TODO: determine actual limit? query: { project, instance, limit: ALL_ISH }, }), - apiQueryClient.prefetchQuery('floatingIpList', { query: { project, limit: ALL_ISH } }), + apiQueryClient.fetchQuery('floatingIpList', { query: { project, limit: ALL_ISH } }), // dupe of page-level fetch but that's fine, RQ dedupes - apiQueryClient.prefetchQuery('instanceExternalIpList', { + apiQueryClient.fetchQuery('instanceExternalIpList', { path: { instance }, query: { project }, }), // This is covered by the InstancePage loader but there's no downside to // being redundant. If it were removed there, we'd still want it here. - apiQueryClient.prefetchQuery('instanceView', { + apiQueryClient.fetchQuery('instanceView', { path: { instance }, query: { project }, }), // This is used in AttachEphemeralIpModal - apiQueryClient.prefetchQuery('projectIpPoolList', { query: { limit: ALL_ISH } }), + apiQueryClient.fetchQuery('projectIpPoolList', { query: { limit: ALL_ISH } }), ]) return null } @@ -171,11 +180,17 @@ const staticIpCols = [ cell: (info) => {info.getValue()}, }), ipColHelper.accessor('name', { - cell: (info) => (info.getValue() ? info.getValue() : ), + cell: (info) => + info.row.original.kind === 'ephemeral' ? : info.getValue(), }), ipColHelper.accessor((row) => ('description' in row ? row.description : undefined), { header: 'description', - cell: (info) => , + cell: (info) => + info.row.original.kind === 'ephemeral' ? ( + + ) : ( + + ), }), ]