Skip to content

upcoming: [M3-7924] - Linode Create Refactor - VPC - Part 10 - #10354

Merged
bnussman-akamai merged 22 commits into
linode:developfrom
bnussman-akamai:M3-7924-linode-create-refactor-vpc
Apr 10, 2024
Merged

bnussman-akamai merged 22 commits into
linode:developfrom
bnussman-akamai:M3-7924-linode-create-refactor-vpc

Conversation

@bnussman-akamai

@bnussman-akamai bnussman-akamai commented Apr 5, 2024 •

Copy link
Copy Markdown
Member

Description 📝

  • Adds a VPC section to the new Linode Create flow ✨

Changes 🔄

  • Builds new VPC panel that uses react hook from tooling 🔧
  • Adds a VPC Select
  • Adds Create a Linode to the document title to match the existing flow
  • Improves error handling for VPC IP ranges

Preview 📷

Screenshot 2024-04-04 at 8 00 07 PM

How to test 🧪

Prerequisites

  • Turn on the Linode Create v2 feature flag 🎏

Verification steps

  • Test the new VPC selction 🧪
  • Compare functionality to the existing Linode Create flow 🔍
  • Test error handling in the VPC section ❌

As an Author I have 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

export const VPCSelect = (props: Props) => {
const { filter, value, ...rest } = props;

const { data, isFetching } = useVPCsQuery({}, filter ?? {});

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I will come back and update this to use useAllVPCsQuery or an infinite query after #10322 gets merged

@bnussman-akamai
bnussman-akamai marked this pull request as ready for review April 8, 2024 20:40
@bnussman-akamai
bnussman-akamai requested a review from a team as a code owner April 8, 2024 20:40
@bnussman-akamai
bnussman-akamai requested review from cpathipa and dwiley-akamai and removed request for a team April 8, 2024 20:40
};

const formik = useFormik({
enableReinitialize: true,

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Had to add this so that region updates when the region is changed on the Linode Create flow. This was not an issue with the existing create flow because the drawer was re-mounted when it was opened (causing the VPC create drawer to not animate)

@abailly-akamai abailly-akamai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'll spend more time with it in the UI once we get more reviews from folks more familiar than me with the feature.

All together this looks great, concise, well thought & put together

Left some initial comments to look at a couple areas that could be improved

Comment thread packages/manager/src/features/Linodes/LinodeCreatev2/VPC/VPC.tsx Outdated
Comment thread packages/manager/src/features/Linodes/LinodeCreatev2/VPC/VPC.tsx
Comment thread packages/manager/src/features/Linodes/LinodeCreatev2/utilities.ts
Comment thread packages/manager/src/features/Linodes/LinodeCreatev2/VPC/VPC.tsx Outdated
))}
</Stack>
<Box>
<LinkButton onClick={() => append('')}>Add IPv4 Range</LinkButton>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same here. I guess I have to get form familiar with these hooks but this just looks weird

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This adds an empty string to the ip_ranges array on the VPC interface. Appending an empty string item to the array will cause a new empty TextField to render so that the user can add a new IP range.

@abailly-akamai abailly-akamai Apr 9, 2024 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yeah, i am getting to understand that part. i think even doing

// Adding an empty string to the array will render to new empty field
const newRangeField = ''

=> append(newRangeField)

or something like that could help with readability

Comment thread packages/manager/src/features/Linodes/LinodeCreatev2/utilities.ts
@github-actions

github-actions Bot commented Apr 9, 2024 •

Copy link
Copy Markdown

Coverage Report: ✅
Base Coverage: 81.78%
Current Coverage: 81.8%

@dwiley-akamai dwiley-akamai left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm still testing and combing through the code, but it's looking good overall so far. A few comments:

Points with screenshots
  1. Can we keep the "X" vertically centered in relation to the input field when there's an error? I think this has come up as an issue in other contexts, maybe there's a related/similar ticket in the backlog somewhere
    Screenshot 2024-04-09 at 4 31 38 PM

  2. Can we keep both dropdowns the same width to match prod?
    Screenshot 2024-04-09 at 5 00 44 PM

  3. Can we make some width adjustments so if you click far away from the Auto-assign & Assign checkboxes, they don't get toggled?

Screen.Recording.2024-04-09.at.5.02.46.PM.mov
  1. There were some concerns during the initial IPv4 range work a couple of months ago about large header text like this (doesn't make the section hierarchy as clear) instead of the more understated one currently used in prod

Screenshot 2024-04-09 at 5 36 55 PM

@hkhalil-akamai hkhalil-akamai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Tested and verified parity with existing VPC flow, code review looks clean too -- excellent work as always!

Also, thanks for including comprehensive unit tests!

Comment on lines +28 to +35
<TextField
errorText={fieldState.error?.message}
hideLabel
label={`IP Range ${index}`}
onChange={field.onChange}
placeholder="10.0.0.0/24"
value={field.value}
/>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The width of this textfield is shorter (166.5px vs 362.41px) than the original. Personally I prefer the shorter width since it more closely matches the expected length of the subnet value but just wanted to point it out.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yeah, it does look slightly odd. I wasn't able to easily fix it without writing one-off styles, so I'd prefer to leave it be

@bnussman-akamai

Copy link
Copy Markdown
Member Author

I fixed point 1, 3, and 4. @dwiley-akamai

I personally don't agree with 4. I was thinking an h3 would be fine if every other header on the page is an h2. I've made the change regardless.

I'm declaring point 2 out of scope because I told myself I wouldn't write one-off styling in this project 😖 I think the issue would have to be fixed at the Autocomplete component level if we want it to work that way globally.

@abailly-akamai abailly-akamai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Took a second pass at the UI and found regressions/improvements to be made to the UX. See comments for details

<Stack spacing={2}>
<Typography variant="h2">VPC</Typography>
<Typography>
Assign this Linode to an existing VPC.{' '}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Production has "Allow Linode to communicate in an isolated environment." is this intentional?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in 70d8b1e

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Note for UX:
Screenshot 2024-04-10 at 10 39 30

It's a tiny bit unclear for the user you need to select a region to be able to select a VPC. Again, this is parity but something to think about. Weird it never came up 🤷

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Agreed. I'll make an effort to circle back around to all of the weird UX things after this refactor happens

loading={isFetching}
options={data?.data ?? []}
value={selectedVPC}
{...rest}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We need to reset the VPC panel on region change. Repro:

  • select an available region (ex: chicago)
  • select a VPC
  • change to a non-available region. ex: Newark
  • see screenshot below

Screenshot 2024-04-10 at 09 37 10

You can basically keep interacting with the whole VPC form as the previous valus is still selected

@bnussman-akamai bnussman-akamai Apr 10, 2024 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is expected for now. I am saving "side effect" state updates for later in this project.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is a local side effect, not a global one tho. You gotta point those out in your PR description

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

What I mean is that I haven't determined the best way to handle side-effect state changes using react-hook-form so I'm deferring the work till later.

There needs to be some investigation on my part to find the best way to handle these "side-effect" changes because there are a ton in the Linode Create flow.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Got it. Would still be helpful for reviewers to know what's not supposed to work. I remembered default values being one, not those (tho they are clearly related).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I have a running list so I assure you these will be fixed! I will do my best to call these out in the future

Comment thread packages/manager/src/features/Linodes/LinodeCreatev2/VPC/VPC.tsx
Comment thread packages/manager/src/components/VPCSelect.tsx
Comment thread packages/manager/src/features/Linodes/LinodeCreatev2/VPC/VPC.tsx

@abailly-akamai abailly-akamai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Amazing work! this is coming alive 🎉

@dwiley-akamai dwiley-akamai left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The core functionality LGTM, nice work as the code patterns are pretty clean 🧽

I do think the remaining visual inconsistencies and regressions have to be addressed, but that can be in a follow-up or at least a circle-back before the Linode Create refactor is wrapped up.

Other quirks with IPv4 ranges

When there's an error, the field it belongs to gets horizontally widened, which makes me favor retaining the wider field width that we currently have in prod.

Screenshot 2024-04-10 at 11 22 13 AM

The vertical distance between the fields is now greatly compressed compared to prod. I think that should be adjusted.

This isn't an issue per se, but I noticed that compared to prod, you now have to input something into the most recent field before clicking "Add IPv4 Range" adds a new input field.

Also, were you going to address the leftover changes from #10342 (comment) in this PR?

Comment on lines +69 to +72
const copy =
data?.results === 0
? 'Allow Linode to communicate in an isolated environment.'
: 'Assign this Linode to an existing VPC.';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

minor: We lost some parity here -- a fresh form in prod shows Allow Linode to communicate in an isolated environment. but this branch shows Assign this Linode to an existing VPC.

@bnussman-akamai bnussman-akamai Apr 10, 2024 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Good catch. I believe the logic should now match the prod flow. (1934915)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants