Skip to content
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

refactor: [M3-8986] - Refactor VPCEditDrawer and SubnetEditDrawer to use react-hook-form #11393

Merged
merged 3 commits into from
Dec 12, 2024

Conversation

coliu-akamai
Copy link
Contributor

@coliu-akamai coliu-akamai commented Dec 10, 2024

Description 📝

  • refactors VPCEditDrawer and SubnetEditDrawer to use react-hook-form instead of formik

Changes 🔄

  • update drawers + introduces dynamic validation
  • update validation schema regex to be more accurate for non number/letter characters
  • update validation schema error messages slightly

How to test 🧪

  • Confirm behavior matches prod for editing a VPC and editing a subnet*
    • *there will now be some dynamic error validation tho
  • Confirm tests pass
yarn test SubnetEditDrawer
yarn test VPCEditDrawer
yarn cy:run -s "cypress/e2e/core/vpc/vpc-landing-page.spec.ts"
yarn cy:run -s "cypress/e2e/core/vpc/vpc-details-page.spec.ts"
Author Checklists

As an Author, to speed up the review process, I considered 🤔

👀 Doing a self review
❔ Our contribution guidelines
🤏 Splitting feature into small PRs
➕ Adding a changeset
🧪 Providing/improving test coverage
🔐 Removing all sensitive information from the code and PR description
🚩 Using a feature flag to protect the release
👣 Providing comprehensive reproduction steps
📑 Providing or updating our documentation
🕛 Scheduling a pair reviewing session
📱 Providing mobile support
♿ Providing accessibility support


  • I have read and considered all applicable items listed above.

As an Author, before moving this PR from Draft to Open, I confirmed ✅

  • All unit tests are passing
  • TypeScript compilation succeeded without errors
  • Code passes all linting rules

@coliu-akamai coliu-akamai added the VPC Relating to VPC project label Dec 10, 2024
@coliu-akamai coliu-akamai self-assigned this Dec 10, 2024
@coliu-akamai coliu-akamai marked this pull request as ready for review December 10, 2024 18:27
@coliu-akamai coliu-akamai requested a review from a team as a code owner December 10, 2024 18:27
@coliu-akamai coliu-akamai requested review from abailly-akamai and harsh-akamai and removed request for a team December 10, 2024 18:27
Comment on lines 116 to +123
.max(64, LABEL_MESSAGE)
.matches(/[a-zA-Z0-9-]+/, LABEL_REQUIREMENTS);
.matches(/^[a-zA-Z0-9-]*$/, LABEL_REQUIREMENTS);

export const updateVPCSchema = object({
label: labelValidation.notRequired(),
description: string().notRequired(),
label: labelValidation,
description: string(),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

  • fixes regex so that it checks against all characters, not just the first one, for non letter/number characters (besides dashes)
  • removed the notRequired() since that led to type errors when using the schema: Type 'Maybe<string | undefined>' is not assignable to type 'string | undefined'. Type 'null' is not assignable to type 'string | undefined'. Removing this makes the schema align better with the payload too, so I don't think this will be an issue

@coliu-akamai
Copy link
Contributor Author

coliu-akamai commented Dec 10, 2024

adding wait to merge label for this - some VPCCreate tests are currently failing due to validation punctuation changes, planning to merge #11357 first and then rebase this and fix any conflicts/tests that emerge after

(still ready for review tho)

Copy link
Contributor

@abailly-akamai abailly-akamai left a comment

Choose a reason for hiding this comment

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

Looks great! Solid refactor

  • code refactor ✅
  • VPCEditDrawer ✅
  • SubnetEditDrawer ✅
  • Error handling ✅

Approving pending test resolutions as noted in PR

@coliu-akamai coliu-akamai force-pushed the update-small-vpc-drawers branch from 95e80e3 to d4f1e72 Compare December 11, 2024 16:27
@coliu-akamai coliu-akamai added Add'tl Approval Needed Waiting on another approval! and removed Ready for Review labels Dec 11, 2024
Copy link

Coverage Report:
Base Coverage: 86.78%
Current Coverage: 86.78%

@linode-gh-bot
Copy link
Collaborator

Cloud Manager UI test results

🎉 469 passing tests on test run #5 ↗︎

❌ Failing✅ Passing↪️ Skipped🕐 Duration
0 Failing469 Passing2 Skipped100m 20s

Copy link
Contributor

@harsh-akamai harsh-akamai left a comment

Choose a reason for hiding this comment

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

Thanks for the udpates @coliu-akamai! 🎉

@harsh-akamai harsh-akamai added Approved Multiple approvals and ready to merge! and removed Add'tl Approval Needed Waiting on another approval! labels Dec 11, 2024
@coliu-akamai coliu-akamai merged commit cf84950 into linode:develop Dec 12, 2024
22 of 23 checks passed
Copy link

cypress bot commented Dec 12, 2024

Cloud Manager E2E    Run #6960

Run Properties:  status check passed Passed #6960  •  git commit cf84950015: refactor: [M3-8986] - Refactor VPCEditDrawer and SubnetEditDrawer to use `react-...
Project Cloud Manager E2E
Branch Review develop
Run status status check passed Passed #6960
Run duration 31m 02s
Commit git commit cf84950015: refactor: [M3-8986] - Refactor VPCEditDrawer and SubnetEditDrawer to use `react-...
Committer Connie Liu
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 3
Tests that did not run due to a developer annotating a test with .skip  Pending 2
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 469
View all changes introduced in this branch ↗︎

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Approved Multiple approvals and ready to merge! VPC Relating to VPC project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants