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

upcoming: [M3-7926] - Linode Create Refactor - VLANs - Part 9 #10342

Merged
merged 25 commits into from
Apr 4, 2024

Conversation

bnussman-akamai
Copy link
Contributor

@bnussman-akamai bnussman-akamai commented Apr 2, 2024

Description πŸ“

Adds VLANs to the new Linode Create flow ✨

Changes πŸ”„

  • Use query key factory for VLANs
  • Adds new VLANSelect component
  • Add infinite query for VLANs to power the VLAN Select
  • Adds VLANs section to the new Linode Create flow

Preview πŸ“·

Screenshot 2024-04-02 at 1 37 58β€―PM

How to test πŸ§ͺ

Prerequisites

  • Turn on the Linode Create v2 feature flag using our local dev tools

Verification steps

  • Test the new VLAN section
  • Test the new VLANSelect
  • Check new logic, utils, and UI for issues, regressions, and quality
  • Verify you can create a Linode with a VLAN attached
  • Verify VLANs throughout the app still work as expected

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

@bnussman-akamai bnussman-akamai marked this pull request as ready for review April 2, 2024 20:48
@bnussman-akamai bnussman-akamai requested a review from a team as a code owner April 2, 2024 20:48
@bnussman-akamai bnussman-akamai requested review from dwiley-akamai and hkhalil-akamai and removed request for a team April 2, 2024 20:48
Copy link

github-actions bot commented Apr 2, 2024

Coverage Report: βœ…
Base Coverage: 81.66%
Current Coverage: 81.7%

Copy link
Contributor

@dwiley-akamai dwiley-akamai left a comment

Choose a reason for hiding this comment

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

I observed a bit of odd behavior in the Linode Create flow with a "ghost" VLAN appearing in the dropdown:

Screen.Recording.2024-04-03.at.9.53.53.AM.mov

Additionally, based on the API docs, VLANs can only be attached to Linodes within the same DC. Our functionality in prod currently filters the VLAN dropdown based on region, but we don't have that on this branch

packages/manager/src/queries/linodes/linodes.ts Outdated Show resolved Hide resolved
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 good and well tested. Left some comments.

Also, maybe i am doing something wrong, but ran into this error when submitting

{
    "reason": "metadata dict must contain key user_data",
    "field": "metadata"
}

Copy link
Contributor

@cpathipa cpathipa left a comment

Choose a reason for hiding this comment

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

Overall, LGTM I agree with the feedback from @abailly-akamai and @dwiley-akamai . Approving, pending the addressing of their feedback.

loading={isLoading}
noOptionsText="You have no VLANs in this region. Type to create one."
options={vlans}
placeholder="Create or select a VLAN"
Copy link
Contributor

Choose a reason for hiding this comment

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

UX observation: Currently, the user will only know the loading state upon clicking the field. Could a dynamic placeholder help?
image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm hoping that the changes from #10122 improves the loading state

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 on my end, nice work! Thanks for addressing those changes as well βœ…

packages/manager/src/components/VLANSelect.tsx Outdated Show resolved Hide resolved
@hkhalil-akamai
Copy link
Contributor

I observed a bit of odd behavior in the Linode Create flow with a "ghost" VLAN appearing in the dropdown:

Was there a response to this comment by @dwiley-akamai? I am not able to replicate it myself -- I think it might be different VLANs in different regions with the same name.

packages/manager/src/components/VLANSelect.test.tsx Outdated Show resolved Hide resolved
packages/manager/src/components/VLANSelect.tsx Outdated Show resolved Hide resolved
Comment on lines +41 to +45
const disabled =
!imageId ||
isCreatingFromBackup ||
isLinodeCreateRestricted ||
!regionSupportsVLANs;
Copy link
Contributor

Choose a reason for hiding this comment

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

For parity with the current flow, the VLANs field should reset when disabled goes from false to true.

In the (admittedly contrived) case that the user selects a VLAN and then e.g., clears the image field, the form will still be submittable with the VLAN attached. This causes an API error and also breaks the form (this might be an unrelated), see attached video:

Screen.Recording.2024-04-03.at.5.18.14.PM.mov

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, good catch. This will have to be addressed at some point. I was holding off on this for now because there will be significant work dedicated to "resetting" form fields under certain conditions like what you showed and even switching tabs.

I need to find a clean way to handle these "side-effect" state changes. There are many cases similar to this

Copy link
Contributor

Choose a reason for hiding this comment

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

One idea might be with a useEffect as so:

React.useEffect(() => {
  if (disabled) {
    // Reset input here
  }
}, [disabled]);

@bnussman-akamai
Copy link
Contributor Author

I wasn't able to reproduce the "ghost" issue, but the component has undergone some significant changes and it now filters by region. I think we should be good now @hkhalil-akamai @dwiley-akamai

Copy link
Contributor

@hkhalil-akamai hkhalil-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 addressing feedback @bnussman-akamai!

Copy link
Contributor

@dwiley-akamai dwiley-akamai left a comment

Choose a reason for hiding this comment

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

Functionality LGTM now, no longer observing the ghost VLAN issue


const vlans = data?.pages.flatMap((page) => page.data) ?? [];

const newVlanPlacehodler = {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const newVlanPlacehodler = {
const newVlanPlaceholder = {

return payload;
};

/**
* Performans transformation and ordering on the Linode Create "interfaces" form data.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* Performans transformation and ordering on the Linode Create "interfaces" form data.
* Performs a transformation and ordering on the Linode Create "interfaces" form data.

/**
* Performans transformation and ordering on the Linode Create "interfaces" form data.
*
* We need this so we can put interfaces in the correct order and omit unused iterfaces.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* We need this so we can put interfaces in the correct order and omit unused iterfaces.
* We need this so we can put interfaces in the correct order and omit unused interfaces.

@bnussman-akamai bnussman-akamai merged commit 774c060 into linode:develop Apr 4, 2024
18 checks passed
@bnussman-akamai
Copy link
Contributor Author

Oops. I forgot to fix those spelling issues @dwiley-akamai. My fault 🀦

I'll make sure to fix them in the next Linode Create reactor PR

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.

None yet

6 participants