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

fix: [M3-7004] - Allow IPv6 ranges transfers #10156

Merged
merged 8 commits into from
Feb 8, 2024

Conversation

abailly-akamai
Copy link
Contributor

@abailly-akamai abailly-akamai commented Feb 6, 2024

Description πŸ“

This PR aims to fix a regression where users weren't able to transfer IPv6 ranges in the Linode Network tab.

I am frankly unsure how that was a regression considering we weren't pulling the ranges in the modal whatsoever, but perhaps someone has better context about this. Long story short, I hope my fix is the right one considering my lack of context. One thing I know is that adding those back to the modal works fine, and the transfer goes through.

This component is gross. It is a dirty ramda rat fest and the UI is questionable. While I wanted to only address the problem at heart, I couldn't help but attempt to improve the UI and make things at least look better for our users in the modal and add IP drawer.

Changes πŸ”„

  • Add (back?) IPvs ranges to the modal
  • Improve layout and styling in modal and drawer
  • Invalidate an extra query to improve the experience
  • Refactor default export

Preview πŸ“·

Before After
localhost_3000_linodes_51692149_networking (1) localhost_3000_linodes_51692149_networking
Before After
cloud linode com_linodes_51692149_networking (2) localhost_3000_linodes_51692149_networking (4)
Before After
cloud linode com_linodes_51692149_networking (1) localhost_3000_linodes_51692149_networking (3)

How to test πŸ§ͺ

Prerequisites

  • Have two linodes in the same region without any extra IP address added (linode1, linode2)

Reproduction steps

  • Navigate to /linodes/{linode1.id}/networking
  • Add an IPv6 range (either /64 or /56)
  • Click on the "IP Transfer" Button
  • Notice your IPv6 range is not present

Verification steps

  • Stay on /linodes/{linode1.id}/networking
  • Pull code locally
  • Click on the "IP Transfer" Button
  • Notice your IPv6 range is present and can be transferred to linode2
  • Verify it gets removed from the IPs table without a refresh

Overall regression testing

  • Verify styling at all breakpoints
  • Verify IPv4 can be transferred just the same

As an Author I have considered πŸ€”

Check all that apply

  • πŸ‘€ 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

@abailly-akamai abailly-akamai self-assigned this Feb 6, 2024
@abailly-akamai abailly-akamai changed the title fix: [M3-7004] - Allow for IPv6 addresses transfer fix: [M3-7004] - Allow for IPv6 ranges transfer Feb 7, 2024
@abailly-akamai abailly-akamai marked this pull request as ready for review February 8, 2024 03:34
@abailly-akamai abailly-akamai requested a review from a team as a code owner February 8, 2024 03:34
@abailly-akamai abailly-akamai requested review from jdamore-linode and dwiley-akamai and removed request for a team February 8, 2024 03:34
@abailly-akamai abailly-akamai changed the title fix: [M3-7004] - Allow for IPv6 ranges transfer fix: [M3-7004] - Allow IPv6 ranges transfers Feb 8, 2024
...publicIPv4Addresses,
...privateIPv4Addresses,
...ipv6Addresses,
];
Copy link
Contributor Author

Choose a reason for hiding this comment

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

So that's the gist of it. The report mentions a regression but curious to know how it ever worked without iterating over those πŸ€”

Copy link
Contributor

Choose a reason for hiding this comment

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

There's a chance I caused a regression with #9097, but I'm not sure this was working in the first place.

/>
))}
</Box>
</StyledRadioGroup>
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 frankly did not feel like abstracting the radio groups though they are pretty much identical. I just went for consolidated styling and I am at peace with it.

I changed the structure and added accessible support based on html recommendations which were slightly broken: https://www.w3.org/WAI/ARIA/apg/patterns/radio/examples/radio-rating/

Copy link

github-actions bot commented Feb 8, 2024

Coverage Report: βœ…
Base Coverage: 81.12%
Current Coverage: 81.12%

@abailly-akamai
Copy link
Contributor Author

@jdamore-linode thoughts on covering this one?

...publicIPv4Addresses,
...privateIPv4Addresses,
...ipv6Addresses,
];
Copy link
Contributor

Choose a reason for hiding this comment

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

There's a chance I caused a regression with #9097, but I'm not sure this was working in the first place.

@@ -107,6 +108,7 @@ export const useLinodeShareIPMutation = () => {

export const useAssignAdressesMutation = () => {
const queryClient = useQueryClient();
const { location } = useHistory();
Copy link
Contributor

Choose a reason for hiding this comment

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

This approach might be fine but we may want to explore more robust ways.

If we ever use this mutation on a different page, it might not make the correct invalidations.

Copy link
Contributor

Choose a reason for hiding this comment

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

If we keep this, useParams might be better

const { linodeId } = useParams<{ linodeId: 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.

You're right - I added a currentLinodeId required param to pass to useAssignAdressesMutation which solved our problem and is more robust. The mutation is only used in the IPTransfer modal but if eventually used elsewhere, i don't a reason why we wouldn't have access to the current linode ID we're migrating the IP address from.

Copy link
Contributor

@bnussman-akamai bnussman-akamai left a comment

Choose a reason for hiding this comment

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

Awesome. Good fixes and changes!

packages/manager/src/queries/linodes/networking.ts Outdated Show resolved Hide resolved
@bnussman-akamai bnussman-akamai added Add'tl Approval Needed Waiting on another approval! Linodes Dealing with the Linodes section of the app labels Feb 8, 2024
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.

Able to successfully transfer IPv4 addresses and IPv6 ranges βœ…
"IP Addresses" table reflects updates w/o refreshing the page βœ…
Mobile view βœ…

This is an existing issue in prod, but I noticed that if you fill out the "IP Transfer" (or "IP Sharing") dialog, exit it before submitting, and re-open it, it will be populated with the data you didn't submit. Not sure if we're doing that intentionally for some reason (we normally don't throughout the app)

@jdamore-linode
Copy link
Contributor

@jdamore-linode thoughts on covering this one?

@abailly-akamai We definitely should! I think we should have Cypress coverage for pretty much every flow involving the Linode Details page (if not e2e, at least with mock data) and I don't believe we have any for IP management right now.

I wouldn't worry about handling that as part of this PR (unless you're feeling ambitious) -- I can write up some tickets for this and a few other things later this afternoon.

Copy link
Contributor

@hana-linode hana-linode left a comment

Choose a reason for hiding this comment

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

I'm seeing a gray background color for the mobile view in the IP Transfer dialog

image

@bnussman-akamai bnussman-akamai added Approved Multiple approvals and ready to merge! and removed Add'tl Approval Needed Waiting on another approval! labels Feb 8, 2024
@abailly-akamai
Copy link
Contributor Author

@dwiley-akamai This is indeed intentional (and not consistent with the rest of the app), mostly because we had gotten feedback users go back and forth between the table and modals to see additional details.

@hana-linode intentional as well. This modal has a unique layout and the mobile version needed a bit of TLC. Again, not really consistent but neither is this feature. Gonna leave it in there cause it adds clarity between rows.

@jdamore-linode tickets would be great, thank you!

@abailly-akamai abailly-akamai merged commit 48f3c13 into linode:develop Feb 8, 2024
17 of 18 checks passed
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! Linodes Dealing with the Linodes section of the app
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants