-
Notifications
You must be signed in to change notification settings - Fork 367
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-7031] - Add AGLB Create Service Target Drawer #9657
Merged
bnussman-akamai
merged 35 commits into
linode:develop
from
bnussman-akamai:M3-7031-aglb-service-target-create-drawer
Sep 21, 2023
Merged
Changes from all commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
24e41bd
initial drawer
bnussman 14be7e8
start building healthchecks
bnussman 03af11f
finish health check inputs
bnussman d6605e5
add client side validation
bnussman 3f18031
fix healthcheck validation
bnussman 12ae865
add most robust error handling
bnussman c078649
wire up goofy cert select
bnussman e37e3cd
fix weird style
bnussman 43c1b68
order props
bnussman 2fd6a52
handle general errors
bnussman 2f72a76
make `ca_certificate` nullable
bnussman 41edc89
Merge branch 'develop' into M3-7031-aglb-service-target-create-drawer
bnussman 8094f50
Add Linode or IP input
bnussman 9be3e9a
add new Selects
bnussman addeee4
Added changeset: Add AGLB Create Service Target Drawer
bnussman 79cd77f
feedback @abailly-akamai
bnussman 5b11c1b
add basic unit test and minor improvments
bnussman 9c1d7bf
clean up and comment
bnussman 231c619
Add QA data attributes for service target create drawer
20ccd40
Add Load Balancer service target integration tests
923a25f
add query invalidation `onSuccess`
bnussman fe95601
build out new UI
bnussman 034705d
add some unit testing
bnussman e4f36a3
adapt e2e test to new UI
bnussman 206ed6a
feedback @abailly-akamai
bnussman 91f7b40
implement UX feedback
bnussman e38df3c
more feedback
bnussman d7a2a3a
move port to own line and improve validation
bnussman 6acad64
try to match mockup closer
bnussman 53fe3e5
fix e2e now that we show linode label in table
bnussman 10756a6
use e2e to test form
bnussman ded5ec1
Merge branch 'develop' into M3-7031-aglb-service-target-create-drawer
bnussman 0bf845e
Merge branch 'develop' into M3-7031-aglb-service-target-create-drawer
bnussman 3e49db7
revert unintended change
bnussman 4098d99
feedback @mjac0bs
bnussman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
packages/manager/.changeset/pr-9657-upcoming-features-1694451006203.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@linode/manager": Upcoming Features | ||
--- | ||
|
||
Add AGLB Create Service Target Drawer ([#9657](https://github.com/linode/manager/pull/9657)) |
230 changes: 230 additions & 0 deletions
230
packages/manager/cypress/e2e/core/loadBalancers/load-balancer-service-targets.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,230 @@ | ||
/** | ||
* @file Integration tests related to Cloud Manager AGLB Service Target management. | ||
*/ | ||
|
||
import { | ||
linodeFactory, | ||
loadbalancerFactory, | ||
serviceTargetFactory, | ||
certificateFactory, | ||
} from '@src/factories'; | ||
import { | ||
mockAppendFeatureFlags, | ||
mockGetFeatureFlagClientstream, | ||
} from 'support/intercepts/feature-flags'; | ||
import { | ||
mockGetLoadBalancer, | ||
mockGetLoadBalancerCertificates, | ||
mockGetServiceTargets, | ||
mockCreateServiceTarget, | ||
} from 'support/intercepts/load-balancers'; | ||
import { makeFeatureFlagData } from 'support/util/feature-flags'; | ||
import type { Linode, ServiceTarget } from '@linode/api-v4'; | ||
import { randomLabel, randomIp, randomNumber } from 'support/util/random'; | ||
import { ui } from 'support/ui'; | ||
import { chooseRegion } from 'support/util/regions'; | ||
import { mockGetLinodes } from 'support/intercepts/linodes'; | ||
|
||
describe('Akamai Global Load Balancer service targets', () => { | ||
// TODO Remove this `beforeEach()` hook and related `cy.wait()` calls when `aglb` feature flag goes away. | ||
beforeEach(() => { | ||
mockAppendFeatureFlags({ | ||
aglb: makeFeatureFlagData(true), | ||
}).as('getFeatureFlags'); | ||
mockGetFeatureFlagClientstream().as('getClientStream'); | ||
}); | ||
|
||
/* | ||
* - Confirms that Load Balancer service targets are listed in the "Service Targets" tab. | ||
*/ | ||
it('lists Load Balancer service targets', () => { | ||
const mockLoadBalancer = loadbalancerFactory.build(); | ||
// const mockServiceTargets = serviceTargetFactory.buildList(5); | ||
const mockServiceTargets = new Array(5).fill(null).map( | ||
(_item: null, i: number): ServiceTarget => { | ||
return serviceTargetFactory.build({ | ||
label: randomLabel(), | ||
}); | ||
} | ||
); | ||
|
||
mockGetLoadBalancer(mockLoadBalancer).as('getLoadBalancer'); | ||
mockGetServiceTargets(mockLoadBalancer, mockServiceTargets).as( | ||
'getServiceTargets' | ||
); | ||
|
||
cy.visitWithLogin(`/loadbalancers/${mockLoadBalancer.id}/service-targets`); | ||
cy.wait([ | ||
'@getFeatureFlags', | ||
'@getClientStream', | ||
'@getLoadBalancer', | ||
'@getServiceTargets', | ||
]); | ||
|
||
// Confirm that each service target is listed as expected. | ||
mockServiceTargets.forEach((serviceTarget: ServiceTarget) => { | ||
cy.findByText(serviceTarget.label).should('be.visible'); | ||
// TODO Assert that endpoints, health checks, algorithm, and certificates are listed. | ||
}); | ||
}); | ||
|
||
/** | ||
* - Confirms that service target page shows empty state when there are no service targets. | ||
* - Confirms that clicking "Create Service Target" opens "Add a Service Target" drawer. | ||
* - Confirms that "Add a Service Target" drawer can be cancelled. | ||
* - Confirms that endpoints can be selected via Linode label and via IP address. | ||
* - Confirms that health check can be disabled or re-enabled, and UI responds to toggle. | ||
* - [TODO] Confirms that service target list updates to reflect created service target. | ||
*/ | ||
it('can create a Load Balancer service target', () => { | ||
const loadBalancerRegion = chooseRegion(); | ||
const mockLinodes = new Array(2).fill(null).map( | ||
(_item: null, _i: number): Linode => { | ||
return linodeFactory.build({ | ||
label: randomLabel(), | ||
region: loadBalancerRegion.id, | ||
ipv4: [randomIp()], | ||
}); | ||
} | ||
); | ||
|
||
const mockLoadBalancer = loadbalancerFactory.build({ | ||
regions: [loadBalancerRegion.id], | ||
}); | ||
const mockServiceTarget = serviceTargetFactory.build({ | ||
label: randomLabel(), | ||
}); | ||
const mockCertificate = certificateFactory.build({ | ||
label: randomLabel(), | ||
}); | ||
|
||
mockGetLinodes(mockLinodes); | ||
mockGetLoadBalancer(mockLoadBalancer).as('getLoadBalancer'); | ||
mockGetServiceTargets(mockLoadBalancer, []).as('getServiceTargets'); | ||
mockGetLoadBalancerCertificates(mockLoadBalancer.id, [mockCertificate]); | ||
|
||
cy.visitWithLogin(`/loadbalancers/${mockLoadBalancer.id}/service-targets`); | ||
cy.wait([ | ||
'@getFeatureFlags', | ||
'@getClientStream', | ||
'@getLoadBalancer', | ||
'@getServiceTargets', | ||
]); | ||
|
||
cy.findByText('No items to display.'); | ||
|
||
ui.button | ||
.findByTitle('Create Service Target') | ||
.should('be.visible') | ||
.should('be.enabled') | ||
.click(); | ||
|
||
// Confirm that drawer can be closed. | ||
ui.drawer | ||
.findByTitle('Add a Service Target') | ||
.should('be.visible') | ||
.within(() => { | ||
ui.button | ||
.findByTitle('Cancel') | ||
.scrollIntoView() | ||
.should('be.visible') | ||
.should('be.enabled') | ||
.click(); | ||
}); | ||
|
||
cy.get('[data-qa-drawer]').should('not.exist'); | ||
|
||
// Re-open "Add a Service Target" drawer. | ||
ui.button | ||
.findByTitle('Create Service Target') | ||
.should('be.visible') | ||
.should('be.enabled') | ||
.click(); | ||
|
||
// Fill out service target drawer, click "Create Service Target". | ||
mockCreateServiceTarget(mockLoadBalancer, mockServiceTarget).as( | ||
'createServiceTarget' | ||
); | ||
|
||
ui.drawer | ||
.findByTitle('Add a Service Target') | ||
.should('be.visible') | ||
.within(() => { | ||
cy.findByText('Service Target Label') | ||
.should('be.visible') | ||
.click() | ||
.type(mockServiceTarget.label); | ||
|
||
// Fill out the first endpoint using the mocked Linode's label. | ||
cy.findByText('Linode or Public IP Address') | ||
.should('be.visible') | ||
.click() | ||
.type(mockLinodes[0].label); | ||
|
||
ui.autocompletePopper | ||
.findByTitle(mockLinodes[0].label) | ||
.should('be.visible') | ||
.click(); | ||
|
||
ui.button.findByTitle('Add Endpoint').should('be.visible').click(); | ||
|
||
// Verify the first endpoint was added to the table | ||
cy.findByText(mockLinodes[0].label, { exact: false }) | ||
.scrollIntoView() | ||
.should('be.visible'); | ||
|
||
// Create another endpoint | ||
cy.findByText('Linode or Public IP Address') | ||
.should('be.visible') | ||
.click() | ||
.type(mockLinodes[1].ipv4[0]); | ||
|
||
ui.autocompletePopper | ||
.findByTitle(mockLinodes[1].label) | ||
.should('be.visible') | ||
.click(); | ||
|
||
ui.button.findByTitle('Add Endpoint').should('be.visible').click(); | ||
|
||
// Verify the second endpoint was added to the table | ||
cy.findByText(mockLinodes[1].label, { exact: false }) | ||
.scrollIntoView() | ||
.should('be.visible'); | ||
|
||
// Select the certificate mocked for this load balancer. | ||
cy.findByText('Certificate').click().type(mockCertificate.label); | ||
|
||
ui.autocompletePopper | ||
.findByTitle(mockCertificate.label) | ||
.should('be.visible') | ||
.click(); | ||
|
||
// Confirm that health check options are hidden when health check is disabled. | ||
cy.findByText('Use Health Checks').should('be.visible').click(); | ||
|
||
cy.get('[data-qa-healthcheck-options]').should('not.exist'); | ||
|
||
// Re-enable health check, fill out form. | ||
cy.findByText('Use Health Checks') | ||
.scrollIntoView() | ||
.should('be.visible') | ||
.click(); | ||
|
||
cy.get('[data-qa-healthcheck-options]') | ||
.scrollIntoView() | ||
.should('be.visible'); | ||
|
||
ui.button | ||
.findByTitle('Create Service Target') | ||
.scrollIntoView() | ||
.should('be.visible') | ||
.should('be.enabled') | ||
.click(); | ||
}); | ||
cy.wait('@createServiceTarget'); | ||
|
||
// TODO Assert that new service target is listed. | ||
// cy.findByText('No items to display.').should('not.exist'); | ||
// cy.findByText(mockServiceTarget.label).should('not.exist'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Fixes
zIndex
issue with new AutocompleteScreen.Recording.2023-09-14.at.5.04.21.PM.mov