Skip to content

Commit 837d6aa

Browse files
authored
Add clarifying tooltip to ephemeral IP cells in Instance Networking tab (#2840)
Add clarifying tooltip to ephemeral IP cells
1 parent c5c0f3d commit 837d6aa

File tree

1 file changed

+22
-7
lines changed

1 file changed

+22
-7
lines changed

app/pages/project/instances/NetworkingTab.tsx

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ import { CopyableIp } from '~/ui/lib/CopyableIp'
5050
import { EmptyMessage } from '~/ui/lib/EmptyMessage'
5151
import { TableEmptyBox } from '~/ui/lib/Table'
5252
import { TipIcon } from '~/ui/lib/TipIcon'
53+
import { Tooltip } from '~/ui/lib/Tooltip'
5354
import { ALL_ISH } from '~/util/consts'
5455
import { pb } from '~/util/path-builder'
5556

@@ -85,27 +86,35 @@ const SubnetNameFromId = ({ value }: { value: string }) => {
8586
return <span className="text-default">{subnet.name}</span>
8687
}
8788

89+
const EphemeralIPEmptyCell = () => (
90+
<Tooltip content="Ephemeral IPs don’t have names or descriptions" placement="top">
91+
<div>
92+
<EmptyCell />
93+
</div>
94+
</Tooltip>
95+
)
96+
8897
export async function clientLoader({ params }: LoaderFunctionArgs) {
8998
const { project, instance } = getInstanceSelector(params)
9099
await Promise.all([
91-
apiQueryClient.prefetchQuery('instanceNetworkInterfaceList', {
100+
apiQueryClient.fetchQuery('instanceNetworkInterfaceList', {
92101
// we want this to cover all NICs; TODO: determine actual limit?
93102
query: { project, instance, limit: ALL_ISH },
94103
}),
95-
apiQueryClient.prefetchQuery('floatingIpList', { query: { project, limit: ALL_ISH } }),
104+
apiQueryClient.fetchQuery('floatingIpList', { query: { project, limit: ALL_ISH } }),
96105
// dupe of page-level fetch but that's fine, RQ dedupes
97-
apiQueryClient.prefetchQuery('instanceExternalIpList', {
106+
apiQueryClient.fetchQuery('instanceExternalIpList', {
98107
path: { instance },
99108
query: { project },
100109
}),
101110
// This is covered by the InstancePage loader but there's no downside to
102111
// being redundant. If it were removed there, we'd still want it here.
103-
apiQueryClient.prefetchQuery('instanceView', {
112+
apiQueryClient.fetchQuery('instanceView', {
104113
path: { instance },
105114
query: { project },
106115
}),
107116
// This is used in AttachEphemeralIpModal
108-
apiQueryClient.prefetchQuery('projectIpPoolList', { query: { limit: ALL_ISH } }),
117+
apiQueryClient.fetchQuery('projectIpPoolList', { query: { limit: ALL_ISH } }),
109118
])
110119
return null
111120
}
@@ -171,11 +180,17 @@ const staticIpCols = [
171180
cell: (info) => <Badge color="neutral">{info.getValue()}</Badge>,
172181
}),
173182
ipColHelper.accessor('name', {
174-
cell: (info) => (info.getValue() ? info.getValue() : <EmptyCell />),
183+
cell: (info) =>
184+
info.row.original.kind === 'ephemeral' ? <EphemeralIPEmptyCell /> : info.getValue(),
175185
}),
176186
ipColHelper.accessor((row) => ('description' in row ? row.description : undefined), {
177187
header: 'description',
178-
cell: (info) => <DescriptionCell text={info.getValue()} />,
188+
cell: (info) =>
189+
info.row.original.kind === 'ephemeral' ? (
190+
<EphemeralIPEmptyCell />
191+
) : (
192+
<DescriptionCell text={info.getValue()} />
193+
),
179194
}),
180195
]
181196

0 commit comments

Comments
 (0)