-
Notifications
You must be signed in to change notification settings - Fork 367
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
feat: [M3-7645] β Support VPC IPv4 Ranges in Add/Edit Linode Config dialog #10170
feat: [M3-7645] β Support VPC IPv4 Ranges in Add/Edit Linode Config dialog #10170
Conversation
const thisInterfaceIPRanges: ExtendedIP[] = ( | ||
thisInterface.ip_ranges ?? [] | ||
).map((ip_range, index) => { | ||
// Display a more user-friendly error to the user as opposed to, for example, "interfaces[1].ip_ranges[1] is invalid" | ||
const errorString: string = formik.errors[ | ||
`interfaces[${idx}].ip_ranges[${index}]` | ||
]?.includes('is invalid') | ||
? 'Invalid IP range' | ||
: formik.errors[`interfaces[${idx}].ip_ranges[${index}]`]; | ||
|
||
return { | ||
address: ip_range, | ||
error: errorString, | ||
}; | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because these are deeply nested errors that we're trying to surface, it required a bit of less-than-ideal logic and mapping.
I am aware of one unfortunate shortcomingβif you have multiple IP ranges but one of them (not the last one in the sequence) gets an error when you click "Save Changes", clicking the "X" to remove that IP range will result in the error moving onto the range that moves up to occupy that index. Sadly, I could not see a way around this, as I tried having something like ipRangeIndicesWithErrors
in component state or as a ref to track the indices so that the errors could be cleared from inside handleInterfaceChange
or handleChange
, but that was not fruitful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! confirming on "Assign additional IPv4 ranges"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
VPC IPv4 Configs LGTM other than the mentioned error cases
) . Each Linode can have up to three Network Interfaces. For more | ||
information, see our{' '} | ||
Configure the network that a selected interface will connect to | ||
"Public Internet", VLAN, or VPC. Each Linode can have up to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need the "
?
"Public Internet", VLAN, or VPC. Each Linode can have up to | |
"Public Internet", VLAN, or VPC. Each Linode can have up to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coverage Report: β
|
9178a45
into
linode:staging-off-release
Description π
Add support for VPC IPv4 ranges in Add/Edit Linode Config dialog
Changes π
vpcEnabled
/isFeatureEnabled
logic inLinodeConfigDialog.tsx
ip_ranges
in config payload, display individual IP range errorsPreview π·
Starting state, before any ranges have been assigned
How to test π§ͺ
Verification steps
For a Linode already assigned to a VPC, go to Linode Details > Configurations > Edit and confirm that the info displayed for the VPC interface is correct (particularly the IP ranges -- existing IP ranges should be displayed, but if there are none, you should just see the "Assign additional IPv4 ranges" section with no input fields to start).
Try adding and deleting IP ranges and ensure the payload (PUT request to
linode/instances/{linode_id}/configs/{config_id}
) and UI matches what you'd expect.Note: The CIDR notation (e.g.,
/24
) of the range needs to be narrower (i.e., a larger number) than the subnet IP range. For example, if the subnet IP range has/16
, the CIDR notation for the ranges could be/24
.As an Author I have considered π€