-
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
change: [poc] - Better subnet validation behavior on VPCCreate page #9659
change: [poc] - Better subnet validation behavior on VPCCreate page #9659
Conversation
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.
Great work on this! 🚀 Left some minor comments on a few things.
Regarding general subnet errors: are there any aside from the max subnet limit that would get displayed from what you've seen?
Co-authored-by: Dajahi Wiley <114682940+dwiley-akamai@users.noreply.github.com>
Co-authored-by: Dajahi Wiley <114682940+dwiley-akamai@users.noreply.github.com>
Co-authored-by: Dajahi Wiley <114682940+dwiley-akamai@users.noreply.github.com>
Co-authored-by: Dajahi Wiley <114682940+dwiley-akamai@users.noreply.github.com>
Co-authored-by: Dajahi Wiley <114682940+dwiley-akamai@users.noreply.github.com>
@dwiley-akamai I've also seen subnet errors for having 2+ subnets with the same label or same IP range (these come in as |
visualToAPISubnetMapping: {} | ||
) => { | ||
const combinedSubnets: SubnetFieldState[] = []; | ||
for (let i = 0; i < values.subnets.length; i++) { |
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.
Nit: I think we can simplify this by using a .map
instead. That way we don't have to push the values to an array. We can also destructure the errors in the if
block const errorData = errors[apiSubnetIdx];
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.
Approving because the validation looks good.
Description 📝
Previously when working on the VPCCreate page, I'd made two validation versions:
In the current reason, errors for specific subnets might sometimes appear as general subnet errors, because of how subnet validation happened... Wasn't the biggest fan of that behavior, so I looked into this some more. That's where this PR comes in -- it uses the CreateVPCSchema validation and processes any subnet specific errors returned by the API, while still having the same UI behavior of the current version.
Major Changes 🔄
Preview 📷
How to test 🧪
yarn test formikErrorUtils.test.ts