Skip to content

Add VPC and instance external IP to instance page #1882

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
Jan 17, 2024

Conversation

benjaminleonard
Copy link
Contributor

@benjaminleonard benjaminleonard commented Jan 15, 2024

Fixes #1849

image

Some assumptions here: we're just interested in showing the primary VPC here, but we might want to show all of the external IPs.

Added VPC here also because whilst the current navigation to get to the associated VPC feels systematically correct, we have had people struggle to find their firewall rules and this is part of a larger effort to make that easier to find.

Also making it clearer they are clickable with the underline (following up with some similar changes elsewhere to make other links clearer).

Also fixes #1775 through #1885

Copy link

vercel bot commented Jan 15, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
console ✅ Ready (Inspect) Visit Preview Jan 17, 2024 10:17pm

@@ -52,10 +52,11 @@ const VpcNameFromId = ({ value }: { value: string }) => {
// possible because you can't delete a VPC that has child resources, but let's
// be safe
if (isError) return <Badge color="neutral">Deleted</Badge>
if (!vpc) return <Spinner /> // loading
if (!vpc)
return <div className="h-4 w-12 rounded bg-tertiary motion-safe:animate-pulse" /> // loading
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Using a skeleton state here rather than the full spinner which can be a bit strong.

Copy link
Collaborator

@david-crespo david-crespo Jan 16, 2024

Choose a reason for hiding this comment

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

I didn't know we had that. That's great. You should update SubnetNameFromId too, which is also using the spinner. Also maybe make it wider (maybe not the pulsing thing itself, but its container) so the pop-in is less severe when the name shows up? Though that depends on making a guess about the average length of name. Usually it will be default, right?

@benjaminleonard
Copy link
Contributor Author

Perhaps also beyond this PR, but would be good to have a mechanism to truncate arrays of strings. See:

image

* Update copy to clipboard component

Uses new icon and snazzy animation

* Add copy to clipboard to external IP

* `CopyOnTruncate` component

* Add description to `CopyOnTruncate`

* Revert "Add description to `CopyOnTruncate`"

This reverts commit 4bf0bcc.

* Revert "`CopyOnTruncate` component"

This reverts commit e4a0107.
@david-crespo
Copy link
Collaborator

Perhaps also beyond this PR, but would be good to have a mechanism to truncate arrays of strings. See:
image

Are you picturing a truncate with "show more" button? In this spot I think it would be fine if it wrapped and stretched the box vertically if the user asked for it. Though as the thing is written I think it would mess up the grid.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

license-eye has totally checked 459 files.

Valid Invalid Ignored Fixed
407 1 51 0
Click to see the invalid file list
  • libs/api-mocks/external-ip.ts


return (
<div className="flex items-center gap-1 text-secondary">
{primary ? ips : <>&mdash;</>}
Copy link
Collaborator

@david-crespo david-crespo Jan 16, 2024

Choose a reason for hiding this comment

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

a) this logic doesn't work for the case where you're looking at the whole list and don't have any IPs. primary && ips.length > 0 would probably cover it, but deserves a comment to explain that the two conditions are for two different call sites. I might tweak the props API since primary is not relevant to the instance page and the need to include primary: true there is confusing because it's meaningless.

b) should probably make the VPC one also use mdash

image

Copy link
Collaborator

Choose a reason for hiding this comment

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

fixed it I think

image

@@ -45,7 +45,7 @@ PropertiesTable.Row = ({ label, children }: PropertiesTableRowProps) => (
<span className="flex items-center">
<Badge>{label}</Badge>
</span>
<div className="flex items-center overflow-hidden whitespace-nowrap pr-4 text-sans-md text-secondary">
<div className="flex h-11 items-center overflow-hidden whitespace-nowrap pr-4 text-sans-md text-secondary">
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We were getting a flash of movement when the skeleton switched to the text since they're not the exact same height. This fixes that and any future issues where the content of the row is not the same height as text-sans-md.

const VpcNameFromId = ({ value }: { value: string }) => {
export const Skeleton = classed.div`h-4 w-12 rounded bg-tertiary motion-safe:animate-pulse`

export const EmptyCellContent = () => (
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Might be a better home for this?

return (
<a
className="underline text-sans-semi-md text-secondary hover:text-default"
href={ip}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This needs a protocol – we can assume this is http right?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Not sure. Might be better to do https and let them fix it after nav if it’s wrong.

cell={ExternalIpsFromInstanceName}
cell={({ value: primary }) =>
primary ? <ExternalIps {...instanceSelector} /> : <EmptyCell />
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

This primary logic was inside the component before, but it's only relevant here, not in the table at the top. But you know... what if we just got rid of this column? The relation to the network interface is kind of tenuous to begin with. VPC name is different because each network interface can point to a different VPC. But external IPs really are instance level. So let's take them out of this table?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it's an improvement! One other thing we could do is put a tooltip on IP to explain that it's an internal IP?

image

@@ -81,6 +116,8 @@ export function InstancePage() {

const memory = filesize(instance.memory, { output: 'object', base: 2 })

const primaryVpcId = nics.items.length > 0 ? nics.items[0].vpcId : undefined

Copy link
Collaborator

Choose a reason for hiding this comment

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

It just occurred to me — I don't think we can rely on the first NIC being the primary one. We have to find the primary directly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

External IP address on instance list and view page Copy button on instance external IP
2 participants