-
Notifications
You must be signed in to change notification settings - Fork 365
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-6755] - Unassign Linodes from Subnet #9703
Conversation
packages/manager/src/features/VPCs/VPCDetail/SubnetUnassignLinodesDrawer.tsx
Outdated
Show resolved
Hide resolved
packages/manager/src/features/VPCs/VPCDetail/SubnetUnassignLinodesDrawer.tsx
Outdated
Show resolved
Hide resolved
I'll look into the CSV issue. In the meantime, I'm waiting on @coliu-akamai 's PR #9687 before continuing work here since there's a lot of overlap between us |
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.
The functionality is looking good from my initial testing 🙌
packages/manager/src/features/VPCs/VPCDetail/SubnetUnassignLinodesDrawer.tsx
Outdated
Show resolved
Hide resolved
packages/manager/src/features/VPCs/VPCDetail/SubnetUnassignLinodesDrawer.tsx
Show resolved
Hide resolved
packages/manager/src/features/VPCs/VPCDetail/SubnetUnassignLinodesDrawer.tsx
Show resolved
Hide resolved
packages/manager/src/features/VPCs/VPCDetail/SubnetUnassignLinodesDrawer.tsx
Show resolved
Hide resolved
packages/manager/src/features/VPCs/VPCDetail/SubnetUnassignLinodesDrawer.tsx
Outdated
Show resolved
Hide resolved
const response = await queryClient.fetchQuery( | ||
[linodesQueryKey, 'linode', linode.id, 'configs'], | ||
() => getAllLinodeConfigs(linode.id) | ||
); | ||
|
||
if (response) { | ||
const configWithVpcInterface = response.find((config) => | ||
config.interfaces.some( | ||
(_interface) => | ||
_interface.subnet_id === subnet?.id && | ||
_interface.purpose === 'vpc' | ||
) | ||
); | ||
|
||
const vpcInterface = configWithVpcInterface?.interfaces?.find( | ||
(_interface) => | ||
_interface.subnet_id === subnet?.id && | ||
_interface.purpose === 'vpc' | ||
); |
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.
might be able to do something similar to what I did in
manager/packages/manager/src/features/Linodes/LinodeEntityDetail.tsx
Lines 376 to 391 in ea95f2a
let _configInterfaceWithVPC: Interface | undefined; | |
// eslint-disable-next-line no-unused-expressions | |
configs?.find((config) => { | |
const interfaces = config.interfaces; | |
const interfaceWithVPC = interfaces.find( | |
(_interface) => _interface.vpc_id === vpcLinodeIsAssignedTo?.id | |
); | |
if (interfaceWithVPC) { | |
_configInterfaceWithVPC = interfaceWithVPC; | |
} | |
return interfaceWithVPC; | |
}); |
to avoid doing the same _interface
logic twice
packages/manager/src/features/VPCs/VPCDetail/SubnetUnassignLinodesDrawer.test.tsx
Outdated
Show resolved
Hide resolved
packages/manager/src/features/VPCs/VPCDetail/SubnetUnassignLinodesDrawer.test.tsx
Outdated
Show resolved
Hide resolved
packages/manager/src/features/VPCs/VPCDetail/SubnetUnassignLinodesDrawer.tsx
Show resolved
Hide resolved
packages/manager/src/features/VPCs/VPCDetail/SubnetUnassignLinodesDrawer.tsx
Outdated
Show resolved
Hide resolved
packages/manager/src/features/VPCs/VPCDetail/SubnetUnassignLinodesDrawer.tsx
Outdated
Show resolved
Hide resolved
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 LGMT! Other than action buttons not being shown in drawer.
Agree with @hana-linode and @dwiley-akamai feedback.
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.
Unit tests pass ✅
CSV looks as expected ✅
Unassigning single and multiple Linodes ✅
Restricted users with no edit permissions on the VPC can't initiate unassigns ✅
The functionality is looking good to me -- going ahead and approving but there's one open question on how to best handle the errors
packages/manager/src/features/VPCs/VPCDetail/SubnetUnassignLinodesDrawer.tsx
Show resolved
Hide resolved
packages/manager/src/features/VPCs/VPCDetail/SubnetUnassignLinodesDrawer.tsx
Outdated
Show resolved
Hide resolved
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.
✅ unit tests pass
✅ csv looks as expected
✅ unassign single linode
✅ unassign multiple linodes ***
✅ almost forgot, restricting permissions
** I'm still getting the autocomplete warning if I click 'select all' and have 2+ linodes selected to unassign from the subnet (this warning will not appear if we click 'select all' but only have one linode). Might be something to do with the autocomplete not rerendering until after we've unassigned all the linodes -- should we move this issue to investigate it in a separate ticket?
@coliu-akamai Yep, created M3-7207 to look into this |
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.
approving -- functionality works as expected + follow up ticket made. Awesome job! 🎉
Description 📝
Allow for un-assigning Linodes from subnets.
Major Changes 🔄
Preview
unassign.mp4
How to test 🧪
env
variables to DEV and use incognito to hit local hostUnassign Linodes