Skip to content

Commit 2833e94

Browse files
bnussman-akamaibnussmanmjac0bsmjac0bs
authored
change: [M3-10411] - Move LKE Node Pool actions into an Action Menu and other enhancements (linode#12619)
* wow, so much clean up needed * improve unit testing * clean up more * put all node pool actions into the action menu at all times * clean up unit test * make pool id easily copyable * make divider in footer not look fuzzy 🐈 * use semantically correct h3 rather than h2 for node pool header * update cypress tests to account for action menu * hopefully fix remaining cypress tests * fix last two lke cypress tests * fix typecheck * Added changeset: Move all Kubernetes Node Pool actions into an Action Menu * Added changeset: Node Pool headers from `h2` to `h3` * Added changeset: Refactored single disk encryption status component into two seperate components (Node Pool and Linodes) * Added changeset: Made Node Pool ID copyable * Improve changelogs * Fix typo in component name * Update packages/manager/src/features/Kubernetes/KubernetesClusterDetail/NodePoolsDisplay/NodePool.tsx Co-authored-by: Mariah Jacobs <[email protected]> * fix linode encyrption status logic and spacing --------- Co-authored-by: Banks Nussman <[email protected]> Co-authored-by: mjac0bs <[email protected]> Co-authored-by: Mariah Jacobs <[email protected]>
1 parent e18cc8b commit 2833e94

23 files changed

+611
-540
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@linode/manager": Added
3+
---
4+
5+
Copyable Node Pool ID ([#12619](https://github.com/linode/manager/pull/12619))
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+
Move all Kubernetes Node Pool actions into an Action Menu ([#12619](https://github.com/linode/manager/pull/12619))
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+
Node Pool headers from `h2` to `h3` ([#12619](https://github.com/linode/manager/pull/12619))
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@linode/manager": Tech Stories
3+
---
4+
5+
Refactor single disk encryption status component into two separate components (Node Pool and Linodes) ([#12619](https://github.com/linode/manager/pull/12619))

packages/manager/cypress/e2e/core/kubernetes/lke-create.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ describe('LKE Cluster Creation', () => {
373373
cy.contains('Kubernetes API Endpoint').should('be.visible');
374374
cy.contains('linodelke.net:443').should('be.visible');
375375

376-
cy.findAllByText(nodePoolLabel, { selector: 'h2' })
376+
cy.findAllByText(nodePoolLabel, { selector: 'h3' })
377377
.should('have.length', similarNodePoolCount)
378378
.first()
379379
.should('be.visible');

packages/manager/cypress/e2e/core/kubernetes/lke-update.spec.ts

Lines changed: 127 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,12 @@ describe('LKE cluster updates', () => {
422422
cy.wait('@recycleNode');
423423
ui.toast.assertMessage('Node queued for recycling.');
424424

425-
ui.button
425+
ui.actionMenu
426+
.findByTitle(`Action menu for Node Pool ${mockNodePool.id}`)
427+
.should('be.visible')
428+
.click();
429+
430+
ui.actionMenuItem
426431
.findByTitle('Recycle Pool Nodes')
427432
.should('be.visible')
428433
.should('be.enabled')
@@ -542,7 +547,13 @@ describe('LKE cluster updates', () => {
542547
mockGetClusterPools(mockCluster.id, [mockNodePoolAutoscale]).as(
543548
'getNodePools'
544549
);
545-
ui.button
550+
551+
ui.actionMenu
552+
.findByTitle(`Action menu for Node Pool ${mockNodePool.id}`)
553+
.should('be.visible')
554+
.click();
555+
556+
ui.actionMenuItem
546557
.findByTitle('Autoscale Pool')
547558
.should('be.visible')
548559
.should('be.enabled')
@@ -586,14 +597,20 @@ describe('LKE cluster updates', () => {
586597
ui.toast.assertMessage(
587598
`Autoscaling updated for Node Pool ${mockNodePool.id}.`
588599
);
589-
cy.findByText(`(Min ${autoscaleMin} / Max ${autoscaleMax})`).should(
590-
'be.visible'
591-
);
600+
cy.findByText(
601+
`Autoscaling (Min ${autoscaleMin} / Max ${autoscaleMax})`
602+
).should('be.visible');
592603

593604
// Click "Autoscale Pool" again and disable autoscaling.
594605
mockUpdateNodePool(mockCluster.id, mockNodePool).as('toggleAutoscale');
595606
mockGetClusterPools(mockCluster.id, [mockNodePool]).as('getNodePools');
596-
ui.button
607+
608+
ui.actionMenu
609+
.findByTitle(`Action menu for Node Pool ${mockNodePool.id}`)
610+
.should('be.visible')
611+
.click();
612+
613+
ui.actionMenuItem
597614
.findByTitle('Autoscale Pool')
598615
.should('be.visible')
599616
.should('be.enabled')
@@ -617,9 +634,9 @@ describe('LKE cluster updates', () => {
617634
ui.toast.assertMessage(
618635
`Autoscaling updated for Node Pool ${mockNodePool.id}.`
619636
);
620-
cy.findByText(`(Min ${autoscaleMin} / Max ${autoscaleMax})`).should(
621-
'not.exist'
622-
);
637+
cy.findByText(
638+
`Autoscaling (Min ${autoscaleMin} / Max ${autoscaleMax})`
639+
).should('not.exist');
623640
});
624641

625642
/*
@@ -682,7 +699,13 @@ describe('LKE cluster updates', () => {
682699
mockGetClusterPools(mockCluster.id, [mockNodePoolAutoscale]).as(
683700
'getNodePools'
684701
);
685-
ui.button
702+
703+
ui.actionMenu
704+
.findByTitle(`Action menu for Node Pool ${mockNodePool.id}`)
705+
.should('be.visible')
706+
.click();
707+
708+
ui.actionMenuItem
686709
.findByTitle('Autoscale Pool')
687710
.should('be.visible')
688711
.should('be.enabled')
@@ -728,9 +751,9 @@ describe('LKE cluster updates', () => {
728751
ui.toast.assertMessage(
729752
`Autoscaling updated for Node Pool ${mockNodePool.id}.`
730753
);
731-
cy.findByText(`(Min ${autoscaleMin} / Max ${autoscaleMax})`).should(
732-
'be.visible'
733-
);
754+
cy.findByText(
755+
`Autoscaling (Min ${autoscaleMin} / Max ${autoscaleMax})`
756+
).should('be.visible');
734757
});
735758

736759
/*
@@ -803,8 +826,13 @@ describe('LKE cluster updates', () => {
803826
});
804827
});
805828

829+
ui.actionMenu
830+
.findByTitle(`Action menu for Node Pool ${mockNodePoolInitial.id}`)
831+
.should('be.visible')
832+
.click();
833+
806834
// Click "Resize Pool" and increase size to 3 nodes.
807-
ui.button
835+
ui.actionMenuItem
808836
.findByTitle('Resize Pool')
809837
.should('be.visible')
810838
.should('be.enabled')
@@ -862,8 +890,13 @@ describe('LKE cluster updates', () => {
862890
});
863891
});
864892

893+
ui.actionMenu
894+
.findByTitle(`Action menu for Node Pool ${mockNodePoolInitial.id}`)
895+
.should('be.visible')
896+
.click();
897+
865898
// Click "Resize Pool" and decrease size back to 1 node.
866-
ui.button
899+
ui.actionMenuItem
867900
.findByTitle('Resize Pool')
868901
.should('be.visible')
869902
.should('be.enabled')
@@ -987,14 +1020,22 @@ describe('LKE cluster updates', () => {
9871020
cy.wait(['@getRegions', '@getCluster', '@getNodePools', '@getVersions']);
9881021

9891022
// Assert that initial node pool is shown on the page.
990-
cy.findByText('Dedicated 8 GB', { selector: 'h2' }).should('be.visible');
1023+
cy.findByText('Dedicated 8 GB', { selector: 'h3' }).should('be.visible');
1024+
1025+
ui.actionMenu
1026+
.findByTitle(`Action menu for Node Pool ${mockNodePool.id}`)
1027+
.should('be.visible')
1028+
.click();
9911029

9921030
// "Delete Pool" button should be disabled when only 1 node pool exists.
993-
ui.button
1031+
ui.actionMenuItem
9941032
.findByTitle('Delete Pool')
9951033
.should('be.visible')
9961034
.should('be.disabled');
9971035

1036+
// Close the action menu
1037+
cy.focused().type('{esc}');
1038+
9981039
// Add a new node pool, select plan, submit form in drawer.
9991040
ui.button
10001041
.findByTitle('Add a Node Pool')
@@ -1028,20 +1069,26 @@ describe('LKE cluster updates', () => {
10281069

10291070
// Wait for API responses and confirm that both node pools are shown.
10301071
cy.wait(['@addNodePool', '@getNodePools']);
1031-
cy.findByText('Dedicated 8 GB', { selector: 'h2' }).should('be.visible');
1032-
cy.findByText('Dedicated 4 GB', { selector: 'h2' }).should('be.visible');
1072+
cy.findByText('Dedicated 8 GB', { selector: 'h3' }).should('be.visible');
1073+
cy.findByText('Dedicated 4 GB', { selector: 'h3' }).should('be.visible');
10331074

10341075
// Delete the newly added node pool.
10351076
cy.get(`[data-qa-node-pool-id="${mockNewNodePool.id}"]`)
10361077
.should('be.visible')
10371078
.within(() => {
1038-
ui.button
1039-
.findByTitle('Delete Pool')
1079+
ui.actionMenu
1080+
.findByTitle(`Action menu for Node Pool ${mockNewNodePool.id}`)
10401081
.should('be.visible')
1041-
.should('be.enabled')
10421082
.click();
10431083
});
10441084

1085+
// "Delete Pool" button should be disabled when only 1 node pool exists.
1086+
ui.actionMenuItem
1087+
.findByTitle('Delete Pool')
1088+
.should('be.visible')
1089+
.should('be.enabled')
1090+
.click();
1091+
10451092
mockGetClusterPools(mockCluster.id, [mockNodePool]).as('getNodePools');
10461093
ui.dialog
10471094
.findByTitle('Delete Node Pool?')
@@ -1057,10 +1104,15 @@ describe('LKE cluster updates', () => {
10571104
// Confirm node pool is deleted, original node pool still exists, and
10581105
// delete pool button is once again disabled.
10591106
cy.wait(['@deleteNodePool', '@getNodePools']);
1060-
cy.findByText('Dedicated 8 GB', { selector: 'h2' }).should('be.visible');
1061-
cy.findByText('Dedicated 4 GB', { selector: 'h2' }).should('not.exist');
1107+
cy.findByText('Dedicated 8 GB', { selector: 'h3' }).should('be.visible');
1108+
cy.findByText('Dedicated 4 GB', { selector: 'h3' }).should('not.exist');
10621109

1063-
ui.button
1110+
ui.actionMenu
1111+
.findByTitle(`Action menu for Node Pool ${mockNodePool.id}`)
1112+
.should('be.visible')
1113+
.click();
1114+
1115+
ui.actionMenuItem
10641116
.findByTitle('Delete Pool')
10651117
.should('be.visible')
10661118
.should('be.disabled');
@@ -1326,8 +1378,13 @@ describe('LKE cluster updates', () => {
13261378
'getNodePoolsUpdated'
13271379
);
13281380

1381+
ui.actionMenu
1382+
.findByTitle(`Action menu for Node Pool ${mockNodePoolInitial.id}`)
1383+
.should('be.visible')
1384+
.click();
1385+
13291386
// Click "Labels and Taints" button and confirm drawer contents.
1330-
ui.button
1387+
ui.actionMenuItem
13311388
.findByTitle('Labels and Taints')
13321389
.should('be.visible')
13331390
.should('be.enabled')
@@ -1464,8 +1521,13 @@ describe('LKE cluster updates', () => {
14641521
'getNodePoolsUpdated'
14651522
);
14661523

1524+
ui.actionMenu
1525+
.findByTitle(`Action menu for Node Pool ${mockNodePoolInitial.id}`)
1526+
.should('be.visible')
1527+
.click();
1528+
14671529
// Click "Labels and Taints" button and confirm drawer contents.
1468-
ui.button
1530+
ui.actionMenuItem
14691531
.findByTitle('Labels and Taints')
14701532
.should('be.visible')
14711533
.should('be.enabled')
@@ -1641,8 +1703,13 @@ describe('LKE cluster updates', () => {
16411703
mockErrorMessage
16421704
).as('updateNodePoolError');
16431705

1706+
ui.actionMenu
1707+
.findByTitle(`Action menu for Node Pool ${mockNodePoolInitial.id}`)
1708+
.should('be.visible')
1709+
.click();
1710+
16441711
// Click "Labels and Taints" button and confirm drawer contents.
1645-
ui.button
1712+
ui.actionMenuItem
16461713
.findByTitle('Labels and Taints')
16471714
.should('be.visible')
16481715
.should('be.enabled')
@@ -1749,7 +1816,7 @@ describe('LKE cluster updates', () => {
17491816
});
17501817
});
17511818

1752-
it('does not collapse the accordion when an action button is clicked in the accordion header', () => {
1819+
it('does not collapse the accordion when the user interacts with the node pool action menu', () => {
17531820
const mockCluster = kubernetesClusterFactory.build({
17541821
k8s_version: latestKubernetesVersion,
17551822
});
@@ -1770,36 +1837,33 @@ describe('LKE cluster updates', () => {
17701837
'true'
17711838
);
17721839

1773-
// Click on a disabled button
1774-
cy.get('[data-testid="node-pool-actions"]')
1840+
ui.actionMenu
1841+
.findByTitle(`Action menu for Node Pool ${mockSingleNodePool.id}`)
17751842
.should('be.visible')
1776-
.within(() => {
1777-
ui.button
1778-
.findByTitle('Delete Pool')
1779-
.should('be.visible')
1780-
.should('be.disabled')
1781-
.click();
1782-
});
1843+
.click();
1844+
});
1845+
1846+
ui.actionMenuItem
1847+
.findByTitle('Delete Pool')
1848+
.should('be.visible')
1849+
.should('be.disabled')
1850+
.click({ force: true }); // Force because pointer events are disabled on the delete option
17831851

1852+
cy.get(`[data-qa-node-pool-id="${mockSingleNodePool.id}"]`).within(() => {
17841853
// Check that the accordion is still expanded
17851854
cy.get(`[data-qa-panel-summary]`).should(
17861855
'have.attr',
17871856
'aria-expanded',
17881857
'true'
17891858
);
1790-
1791-
// Click on an action button
1792-
cy.get('[data-testid="node-pool-actions"]')
1793-
.should('be.visible')
1794-
.within(() => {
1795-
ui.button
1796-
.findByTitle('Recycle Pool Nodes')
1797-
.should('be.visible')
1798-
.should('be.enabled')
1799-
.click();
1800-
});
18011859
});
18021860

1861+
ui.actionMenuItem
1862+
.findByTitle('Recycle Pool Nodes')
1863+
.should('be.visible')
1864+
.should('be.enabled')
1865+
.click();
1866+
18031867
// Exit dialog
18041868
ui.dialog
18051869
.findByTitle('Recycle node pool?')
@@ -2125,8 +2189,13 @@ describe('LKE cluster updates', () => {
21252189
// Confirm total price is listed in Kube Specs.
21262190
cy.findByText('$14.40/month').should('be.visible');
21272191

2192+
ui.actionMenu
2193+
.findByTitle(`Action menu for Node Pool ${mockNodePoolInitial.id}`)
2194+
.should('be.visible')
2195+
.click();
2196+
21282197
// Click "Resize Pool" and increase size to 3 nodes.
2129-
ui.button
2198+
ui.actionMenuItem
21302199
.findByTitle('Resize Pool')
21312200
.should('be.visible')
21322201
.should('be.enabled')
@@ -2246,7 +2315,7 @@ describe('LKE cluster updates', () => {
22462315
]);
22472316

22482317
// Assert that initial node pool is shown on the page.
2249-
cy.findByText(mockPlanType.formattedLabel, { selector: 'h2' }).should(
2318+
cy.findByText(mockPlanType.formattedLabel, { selector: 'h3' }).should(
22502319
'be.visible'
22512320
);
22522321

@@ -2388,8 +2457,13 @@ describe('LKE cluster updates', () => {
23882457
// Confirm total price is listed in Kube Specs.
23892458
cy.findByText('$0.00/month').should('be.visible');
23902459

2460+
ui.actionMenu
2461+
.findByTitle(`Action menu for Node Pool ${mockNodePoolInitial.id}`)
2462+
.should('be.visible')
2463+
.click();
2464+
23912465
// Click "Resize Pool" and increase size to 4 nodes.
2392-
ui.button
2466+
ui.actionMenuItem
23932467
.findByTitle('Resize Pool')
23942468
.should('be.visible')
23952469
.should('be.enabled')
@@ -2500,7 +2574,7 @@ describe('LKE cluster updates', () => {
25002574
]);
25012575

25022576
// Assert that initial node pool is shown on the page.
2503-
cy.findByText(mockPlanType.formattedLabel, { selector: 'h2' }).should(
2577+
cy.findByText(mockPlanType.formattedLabel, { selector: 'h3' }).should(
25042578
'be.visible'
25052579
);
25062580

0 commit comments

Comments
 (0)