Skip to content

Commit 8f75cfc

Browse files
authored
feat: [M3-10437] - Revert disabled action treatment for autogenerated LKE-E VPCs (linode#12675)
* Re-enable SubnetActionMenu actions * Re-enable SubnetLinodeRow actions * Update warning messages * Re-enable buttons on VPC landing page * Update more tests * Added changeset: Enable action buttons for VPCs autogenerate for LKE-E * Fix typo * Address feedback: banner type and copy; clean up * Fix test * Address UX feedback: remove (Managed)
1 parent 3dfebe1 commit 8f75cfc

16 files changed

+35
-186
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@linode/manager": Changed
3+
---
4+
5+
Enable action buttons for VPCs autogenerated for LKE-E ([#12675](https://github.com/linode/manager/pull/12675))

packages/manager/src/features/Kubernetes/constants.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,8 @@ export const CREATE_CLUSTER_ENTERPRISE_TIER_ACL_COPY =
3131
export const CREATE_CLUSTER_STANDARD_TIER_ACL_COPY =
3232
'Enable an access control list (ACL) on your LKE cluster to restrict access to your cluster’s control plane. Only the IP addresses and ranges specified in the ACL can connect to the control plane.';
3333

34-
export const LKE_ENTERPRISE_VPC_WARNING =
35-
'This VPC has been automatically generated for your LKE Enterprise cluster. Making edits is disabled to avoid disruption to cluster communication.';
36-
37-
export const LKE_ENTERPRISE_LINODE_VPC_CONFIG_WARNING =
38-
'This VPC has been automatically generated for your LKE Enterprise cluster. Making edits may disrupt cluster communication.';
34+
export const LKE_ENTERPRISE_AUTOGEN_VPC_WARNING =
35+
'This VPC has been automatically generated for your LKE Enterprise cluster.';
3936

4037
export const MAX_NODES_PER_POOL_ENTERPRISE_TIER = 500; // TODO LKE-E M3-9793: Update this limit once a higher one is supported on the backend.
4138
export const MAX_NODES_PER_POOL_STANDARD_TIER = 100;

packages/manager/src/features/Linodes/LinodesDetail/LinodeConfigs/LinodeConfigDialog.test.tsx

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { linodeConfigInterfaceFactory, linodeFactory } from '@linode/utilities';
22
import React from 'react';
33

44
import { linodeConfigFactory } from 'src/factories';
5-
import { LKE_ENTERPRISE_LINODE_VPC_CONFIG_WARNING } from 'src/features/Kubernetes/constants';
65
import {
76
LINODE_UNREACHABLE_HELPER_TEXT,
87
NATTED_PUBLIC_IP_HELPER_TEXT,
@@ -174,24 +173,6 @@ describe('LinodeConfigDialog', () => {
174173

175174
expect(valueReturned?.props.text).toBe(undefined);
176175
});
177-
178-
it('should return a <Notice /> with LKE_ENTERPRISE_LINODE_VPC_CONFIG_WARNING text if the Linode is associated with a LKE-E cluster', () => {
179-
const valueReturned = unrecommendedConfigNoticeSelector({
180-
_interface: vpcInterface,
181-
isLKEEnterpriseCluster: true,
182-
primaryInterfaceIndex: editableFields.interfaces.findIndex(
183-
(element) => element.primary === true
184-
),
185-
thisIndex: editableFields.interfaces.findIndex(
186-
(element) => element.purpose === 'vpc'
187-
),
188-
values: editableFields,
189-
});
190-
191-
expect(valueReturned?.props.text).toEqual(
192-
LKE_ENTERPRISE_LINODE_VPC_CONFIG_WARNING
193-
);
194-
});
195176
});
196177

197178
it('should display the correct network interfaces', async () => {

packages/manager/src/features/Linodes/LinodesDetail/LinodeConfigs/LinodeConfigDialog.tsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ import type { JSX } from 'react';
4444

4545
import { FormLabel } from 'src/components/FormLabel';
4646
import { Link } from 'src/components/Link';
47-
import { LKE_ENTERPRISE_LINODE_VPC_CONFIG_WARNING } from 'src/features/Kubernetes/constants';
4847
import {
4948
useIsLkeEnterpriseEnabled,
5049
useKubernetesBetaEndpoint,
@@ -1323,10 +1322,6 @@ export const unrecommendedConfigNoticeSelector = ({
13231322
values.interfaces &&
13241323
values.interfaces[primaryInterfaceIndex].purpose === 'vpc';
13251324

1326-
// Return a different warning if the VPC interface was created for a LKE-E cluster
1327-
if (vpcInterface && isLKEEnterpriseCluster) {
1328-
return noticeForScenario(LKE_ENTERPRISE_LINODE_VPC_CONFIG_WARNING);
1329-
}
13301325
/*
13311326
Scenario 1:
13321327
- the interface passed in to this function is a VPC interface

packages/manager/src/features/VPCs/VPCDetail/SubnetActionMenu.test.tsx

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ const props = {
1616
handleDelete: vi.fn(),
1717
handleEdit: vi.fn(),
1818
handleUnassignLinodes: vi.fn(),
19-
isVPCLKEEnterpriseCluster: false,
2019
numLinodes: 1,
2120
numNodebalancers: 1,
2221
subnet: subnetFactory.build({ label: 'subnet-1' }),
@@ -106,16 +105,4 @@ describe('SubnetActionMenu', () => {
106105
await userEvent.click(assignButton);
107106
expect(props.handleAssignLinodes).toHaveBeenCalled();
108107
});
109-
110-
it('should disable action buttons if isVPCLKEEnterpriseCluster is true', async () => {
111-
const updatedProps = { ...props, isVPCLKEEnterpriseCluster: true };
112-
const view = renderWithTheme(<SubnetActionMenu {...updatedProps} />);
113-
const actionMenu = view.getByLabelText(`Action menu for Subnet subnet-1`);
114-
await userEvent.click(actionMenu);
115-
116-
const actionButtons = view.getAllByRole('menuitem');
117-
actionButtons.forEach((button) =>
118-
expect(button).toHaveAttribute('aria-disabled', 'true')
119-
);
120-
});
121108
});

packages/manager/src/features/VPCs/VPCDetail/SubnetActionMenu.tsx

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ interface SubnetActionHandlers {
1414
}
1515

1616
interface Props extends SubnetActionHandlers {
17-
isVPCLKEEnterpriseCluster: boolean;
1817
numLinodes: number;
1918
numNodebalancers: number;
2019
subnet: Subnet;
@@ -27,7 +26,6 @@ export const SubnetActionMenu = (props: Props) => {
2726
handleDelete,
2827
handleEdit,
2928
handleUnassignLinodes,
30-
isVPCLKEEnterpriseCluster,
3129
numLinodes,
3230
numNodebalancers,
3331
subnet,
@@ -37,35 +35,31 @@ export const SubnetActionMenu = (props: Props) => {
3735

3836
const actions: Action[] = [
3937
{
40-
disabled: isVPCLKEEnterpriseCluster,
4138
onClick: () => {
4239
handleAssignLinodes(subnet);
4340
},
4441
title: 'Assign Linodes',
4542
},
4643
{
47-
disabled: isVPCLKEEnterpriseCluster,
4844
onClick: () => {
4945
handleUnassignLinodes(subnet);
5046
},
5147
title: 'Unassign Linodes',
5248
},
5349
{
54-
disabled: isVPCLKEEnterpriseCluster,
5550
onClick: () => {
5651
handleEdit(subnet);
5752
},
5853
title: 'Edit',
5954
},
6055
{
61-
disabled:
62-
numLinodes !== 0 || numNodebalancers !== 0 || isVPCLKEEnterpriseCluster,
56+
disabled: numLinodes !== 0 || numNodebalancers !== 0,
6357
onClick: () => {
6458
handleDelete(subnet);
6559
},
6660
title: 'Delete',
6761
tooltip:
68-
!isVPCLKEEnterpriseCluster && (numLinodes > 0 || numNodebalancers > 0)
62+
numLinodes > 0 || numNodebalancers > 0
6963
? `${flags.isNodebalancerVPCEnabled ? 'Resources' : 'Linodes'} assigned to a subnet must be unassigned before the subnet can be deleted.`
7064
: '',
7165
},

packages/manager/src/features/VPCs/VPCDetail/SubnetLinodeActionMenu.test.tsx

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import { SubnetLinodeActionMenu } from './SubnetLinodeActionMenu';
1010
const props = {
1111
handlePowerActionsLinode: vi.fn(),
1212
handleUnassignLinode: vi.fn(),
13-
isVPCLKEEnterpriseCluster: false,
1413
linode: linodeFactory.build({ label: 'linode-1' }),
1514
subnet: subnetFactory.build({ label: 'subnet-1' }),
1615
isOffline: false,
@@ -90,20 +89,4 @@ describe('SubnetActionMenu', () => {
9089
await userEvent.click(unassignButton);
9190
expect(props.handleUnassignLinode).toHaveBeenCalled();
9291
});
93-
94-
it('should disable action buttons if isVPCLKEEnterpriseCluster is true', async () => {
95-
const updatedProps = { ...props, isVPCLKEEnterpriseCluster: true };
96-
const { getByLabelText, getAllByRole } = renderWithTheme(
97-
<SubnetLinodeActionMenu {...updatedProps} />
98-
);
99-
const actionMenu = getByLabelText(
100-
`Action menu for Linodes in Subnet subnet-1`
101-
);
102-
await userEvent.click(actionMenu);
103-
104-
const actionButtons = getAllByRole('menuitem');
105-
actionButtons.forEach((button) =>
106-
expect(button).toHaveAttribute('aria-disabled', 'true')
107-
);
108-
});
10992
});

packages/manager/src/features/VPCs/VPCDetail/SubnetLinodeActionMenu.tsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ interface SubnetLinodeActionHandlers {
1818
interface Props extends SubnetLinodeActionHandlers {
1919
isOffline: boolean;
2020
isRebootNeeded: boolean;
21-
isVPCLKEEnterpriseCluster: boolean;
2221
linode: Linode;
2322
showPowerButton: boolean;
2423
subnet: Subnet;
@@ -28,7 +27,6 @@ export const SubnetLinodeActionMenu = (props: Props) => {
2827
const {
2928
handlePowerActionsLinode,
3029
handleUnassignLinode,
31-
isVPCLKEEnterpriseCluster,
3230
isOffline,
3331
isRebootNeeded,
3432
subnet,
@@ -39,7 +37,6 @@ export const SubnetLinodeActionMenu = (props: Props) => {
3937
const actions: ActionMenuAction[] = [];
4038
if (isRebootNeeded) {
4139
actions.push({
42-
disabled: isVPCLKEEnterpriseCluster,
4340
onClick: () => {
4441
handlePowerActionsLinode(linode, 'Reboot', subnet);
4542
},
@@ -49,7 +46,6 @@ export const SubnetLinodeActionMenu = (props: Props) => {
4946

5047
if (showPowerButton) {
5148
actions.push({
52-
disabled: isVPCLKEEnterpriseCluster,
5349
onClick: () => {
5450
handlePowerActionsLinode(
5551
linode,
@@ -62,7 +58,6 @@ export const SubnetLinodeActionMenu = (props: Props) => {
6258
}
6359

6460
actions.push({
65-
disabled: isVPCLKEEnterpriseCluster,
6661
onClick: () => {
6762
handleUnassignLinode(linode, subnet);
6863
},

packages/manager/src/features/VPCs/VPCDetail/SubnetLinodeRow.test.tsx

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -377,31 +377,6 @@ describe('SubnetLinodeRow', () => {
377377
});
378378
});
379379

380-
it('should hide action-menu buttons for LKE-E Linodes', async () => {
381-
queryMocks.useLinodeConfigQuery.mockReturnValue({
382-
data: configurationProfile,
383-
});
384-
385-
const { queryByText } = renderWithTheme(
386-
wrapWithTableBody(
387-
<SubnetLinodeRow
388-
handlePowerActionsLinode={handlePowerActionsLinode}
389-
handleUnassignLinode={handleUnassignLinode}
390-
isVPCLKEEnterpriseCluster={true}
391-
linodeId={linodeFactory1.id}
392-
subnet={subnetFactory.build()}
393-
subnetId={0}
394-
subnetInterfaces={[{ active: true, config_id: 1, id: 1 }]}
395-
/>
396-
)
397-
);
398-
399-
const powerOffButton = queryByText('Power Off');
400-
expect(powerOffButton).not.toBeInTheDocument();
401-
const unassignLinodeButton = queryByText('Unassign Linode');
402-
expect(unassignLinodeButton).not.toBeInTheDocument();
403-
});
404-
405380
it('should not display a warning icon for LKE-E Linodes', async () => {
406381
const subnet = subnetFactory.build({
407382
id: 1,

packages/manager/src/features/VPCs/VPCDetail/SubnetLinodeRow.tsx

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -266,18 +266,15 @@ export const SubnetLinodeRow = (props: Props) => {
266266
)}
267267
</Hidden>
268268
<TableCell actionCell noWrap>
269-
{!isVPCLKEEnterpriseCluster && (
270-
<SubnetLinodeActionMenu
271-
handlePowerActionsLinode={handlePowerActionsLinode}
272-
handleUnassignLinode={handleUnassignLinode}
273-
isOffline={isOffline}
274-
isRebootNeeded={isRebootNeeded}
275-
isVPCLKEEnterpriseCluster={isVPCLKEEnterpriseCluster}
276-
linode={linode}
277-
showPowerButton={showPowerButton}
278-
subnet={subnet}
279-
/>
280-
)}
269+
<SubnetLinodeActionMenu
270+
handlePowerActionsLinode={handlePowerActionsLinode}
271+
handleUnassignLinode={handleUnassignLinode}
272+
isOffline={isOffline}
273+
isRebootNeeded={isRebootNeeded}
274+
linode={linode}
275+
showPowerButton={showPowerButton}
276+
subnet={subnet}
277+
/>
281278
</TableCell>
282279
</TableRow>
283280
);

0 commit comments

Comments
 (0)