-
Notifications
You must be signed in to change notification settings - Fork 370
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-7021] - Added Firewall panel to create NodeBalancer flow #9733
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@linode/manager": Upcoming Features | ||
--- | ||
|
||
Added Firewall Panel to NodeBalancer Create flow ([#9733](https://github.com/linode/manager/pull/9733)) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,8 +21,10 @@ import { CheckoutSummary } from 'src/components/CheckoutSummary/CheckoutSummary' | |
import { ConfirmationDialog } from 'src/components/ConfirmationDialog/ConfirmationDialog'; | ||
import { DocumentTitleSegment } from 'src/components/DocumentTitle'; | ||
import { LandingHeader } from 'src/components/LandingHeader'; | ||
import { Link } from 'src/components/Link'; | ||
import { Notice } from 'src/components/Notice/Notice'; | ||
import { Paper } from 'src/components/Paper'; | ||
import { SelectFirewallPanel } from 'src/components/SelectFirewallPanel/SelectFirewallPanel'; | ||
import { SelectRegionPanel } from 'src/components/SelectRegionPanel/SelectRegionPanel'; | ||
import { Tag, TagsInput } from 'src/components/TagsInput/TagsInput'; | ||
import { TextField } from 'src/components/TextField'; | ||
|
@@ -56,6 +58,7 @@ import type { APIError } from '@linode/api-v4/lib/types'; | |
|
||
interface NodeBalancerFieldsState { | ||
configs: (NodeBalancerConfigFieldsWithStatus & { errors?: any })[]; | ||
firewall_id?: number; | ||
label?: string; | ||
region?: string; | ||
tags?: string[]; | ||
|
@@ -399,17 +402,28 @@ const NodeBalancerCreate = () => { | |
regionId: nodeBalancerFields.region, | ||
}); | ||
|
||
const summaryItems = [ | ||
{ title: regionLabel }, | ||
{ details: nodeBalancerFields.configs.length, title: 'Configs' }, | ||
{ | ||
details: nodeBalancerFields.configs.reduce( | ||
(acc, config) => acc + config.nodes.length, | ||
0 | ||
), | ||
title: 'Nodes', | ||
}, | ||
].filter((item) => Boolean(item.title)); | ||
const summaryItems = []; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Cleaned up summary item logic so its consistent with the Linode create flow. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Its also easier this way to conditionally add items (like "Firewall Assigned") |
||
|
||
if (regionLabel) { | ||
summaryItems.push({ title: regionLabel }); | ||
} | ||
|
||
if (nodeBalancerFields.firewall_id) { | ||
summaryItems.push({ title: 'Firewall Assigned' }); | ||
} | ||
|
||
summaryItems.push({ | ||
details: nodeBalancerFields.configs.length, | ||
title: 'Configs', | ||
}); | ||
|
||
summaryItems.push({ | ||
details: nodeBalancerFields.configs.reduce( | ||
(acc, config) => acc + config.nodes.length, | ||
0 | ||
), | ||
title: 'Nodes', | ||
}); | ||
|
||
if (nodeBalancerFields.region) { | ||
summaryItems.unshift({ title: `$${price}/month` }); | ||
|
@@ -472,6 +486,23 @@ const NodeBalancerCreate = () => { | |
regions={regions ?? []} | ||
selectedID={nodeBalancerFields.region} | ||
/> | ||
<SelectFirewallPanel | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I also decided to keep the "Create Firewall" link below the input for consistency with the Linode Create flow, also I think its a useful feature. |
||
handleFirewallChange={(firewallId: number) => { | ||
setNodeBalancerFields((prev) => ({ | ||
...prev, | ||
firewall_id: firewallId > 0 ? firewallId : undefined, | ||
})); | ||
}} | ||
helperText={ | ||
<Typography> | ||
Assign an existing Firewall to this NodeBalancer to control inbound | ||
network traffic. If you want to assign a new Firewall to this | ||
NodeBalancer, go to <Link to="/firewalls">Firewalls</Link>.{' '} | ||
{/* @TODO Firewall-NodeBalancer: Update link */} | ||
<Link to="">Learn more about creating Firewalls</Link>. | ||
</Typography> | ||
} | ||
/> | ||
<Box marginBottom={2} marginTop={2}> | ||
{nodeBalancerFields.configs.map((nodeBalancerConfig, idx) => { | ||
const onChange = (key: keyof NodeBalancerConfigFieldsWithStatus) => ( | ||
|
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.
This is from Dajahi's most recent PR: #9635