-
Notifications
You must be signed in to change notification settings - Fork 370
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-7284, M3-7361] - Create VPC drawer in Linode Create flow; Update widths for Create VPC and Create Firewall buttons #9847
Conversation
…56392.md Co-authored-by: Dajahi Wiley <[email protected]>
…3419.md Co-authored-by: Dajahi Wiley <[email protected]>
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.
Since we disable the Create VPC link in the vpc panel if the linode's region isn't selected or if the region selected doesn't support VPCs, sometimes the link just looks like text (below). Speaking with Andrew about potential friendlier UX options!
Update: resolved, this is the new UX (we hide the Create VPC link)
handleSelectVPC?: (vpcId: number) => void; | ||
onDrawerClose?: () => void; | ||
pushToVPCPage?: boolean; | ||
selectedRegion?: string; |
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.
created custom hook for shared form logic between VPCCreate
and VPCCreateDrawer
. There are some slight differences in the functionality of the drawer and page though:
- the page will push to the newly created vpc's detail page, but the drawer only makes the newly created vpc the selected vpc for linode-create flow and closes the drawer
- the drawer's region is pre-selected, based on the selected linode region
The main changes from the old create vpc logic are at lines 80, 133-139 and 185.
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.
I might be missing something -- isn't L185 here just description: '',
?
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.
Ah I might have made some changes to this file that changed the lines - the main difference is for the region initial value, it's now region: selectedRegion ?? '',
instead of region: '',
@@ -0,0 +1,15 @@ | |||
import * as React from 'react'; |
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.
Similar to the new custom hook, consolidated shared components for the form itself into this new folder. (added tests for them as well altho they're pretty repetitive since SubnetNode, MultipleSubnetInput, and VPCCreate already tested how they render).
However, because there are some styling differences between the VPCCreateDrawer
and VPCCreate
page, I did end up having to pass an isDrawer
prop down ;-; (renamed specifically to isVPCCreateDrawer
for the SubnetNode component, since the Create Subnet drawer also used a SubnetNode
, not just the VPCCreateDrawer
)
@@ -17,6 +18,7 @@ interface Props { | |||
// extra props enable SubnetNode to be an independent component or be part of MultipleSubnetInput | |||
// potential refactor - isRemoveable, and subnetIdx & remove in onChange prop | |||
idx?: number; | |||
isCreateVPCDrawer?: boolean; |
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.
See comment on CannotCreateVPCNotice
for reasoning behind this prop
const showRemoveButton = isCreateVPCDrawer | ||
? idx !== 0 && isRemovable | ||
: isRemovable; |
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.
Added this logic bc for the VPCCreateDrawer, we do not want the remove button to show for the first subnet
@dwiley-akamai spoke with Andrew -- we'll be hiding the text/Create drawer link if no region is selected. The VPC panel will look like this in that case: 1 - Still having trouble trying to get the description field's height match the mockup. Continuing to look into it 😅 |
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.
Still need to finish combing through the code, but:
All tests pass ✅
Linode Create page ✅
- No region selected --> "Create VPC" does not appear ✅
- Region selected where VPC is not enabled --> text displayed that says "VPC is not available in the selected region." ✅
- "Create VPC" link shows up with chosen region pre-selected, Region dropdown is disabled ✅
- VPC Create drawer functionality ✅
- VPC created via drawer, newly-created VPC is selected in the VPC panel, Linode creation works as expected ✅
VPC Create page ✅
- "Create VPC" button is right-aligned ✅
- No divider between the last subnet and the "Add Another Subnet" button (and that there's increased spacing between the last subnet and add subnet button) ✅
VPC Details --> Create Subnet drawer ✅
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.
Confirmed the UX issues I mentioned last time have been resolved ✅
packages/manager/src/features/VPCs/VPCCreate/FormComponents/VPCSpecificContent.tsx
Outdated
Show resolved
Hide resolved
packages/manager/src/features/VPCs/VPCCreate/FormComponents/CannotCreateVPCNotice.tsx
Outdated
Show resolved
Hide resolved
packages/manager/src/features/Linodes/LinodesCreate/VPCPanel.tsx
Outdated
Show resolved
Hide resolved
handleSelectVPC?: (vpcId: number) => void; | ||
onDrawerClose?: () => void; | ||
pushToVPCPage?: boolean; | ||
selectedRegion?: string; |
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.
I might be missing something -- isn't L185 here just description: '',
?
… ending (linode#9876) * use utc for unit test * more strict assertion * support est and edt * fix comment * improve mocks and tests --------- Co-authored-by: Banks Nussman <[email protected]>
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.
Functionality LGTM. Since the Create VPC flow is now on the same page, I don't think we need the alwaysrefetch logic anymore
https://github.com/linode/manager/blob/develop/packages/manager/src/queries/vpcs.ts#L35
Screen.Recording.2023-11-06.at.5.24.54.PM.mov
@hana-linode removed the refetch logic, thanks for catching! |
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.
On the Linode Create page
- ✅ Verify that if you do not have a region selected, or have a region that does not support VPCs selected, the Create VPC does not appear and there's instead text that says "VPC is not available in the selected region."
- If the Create VPC link shows up:
- ✅ Verify that the region you've chosen is pre-selected and the region drop down is disabled
- ✅ Verify VPC Create functionality (it should work the same as the VPC Create page EXCEPT that you must have at least 1 subnet in this flow)
- ✅ Verify that after creating a VPC, the VPC is selected in the VPC panel and that creating a linode with that VPC works as expected
- ✅ VPCs are no longer refetched on window refocus
On the VPC Create page
- ✅ verify the 'Create VPC' button is now right aligned, not left aligned
- ✅ verify there's no divider between the last subnet and the 'Add another subnet' button (and that there's increased spacing between the last subnet and add subnet button)
- ✅ verify that besides those changes ^, the VPC Create page looks the same
- ✅ verify that the VPC Create page still functions the same
On the VPC details page
- ✅ verify the Create Subnet drawer still looks the same (and still functions the same, although its functionality shouldn't have been affected by these changes)
Description 📝
Changes 🔄
List any change relevant to the reviewer.
CreateVPCDrawer
VPCCreate
page andVPCCreateDrawer
, creating a new custom hook and other componentsPreview 📷
Include a screenshot or screen recording of the change
(the grey shadow in the second img is from my computer's menu bar)
Region that doesn't support vpcs selected:

How to test 🧪
Prerequisites
Verification steps
On the Linode Create page
On the VPC Create page
On the VPC details page
Tests
yarn test VPC
to run all the VPC related testsyarn cy:run -s 'cypress/e2e/core/vpc/vpc-create.spec.ts
to make sure there are no regressions hereAs an Author I have considered 🤔
Check all that apply