Skip to content

Commit 312c07b

Browse files
change: [UIE-9890] - changes related to private IP field in create linode flow (#13253)
1 parent 34557c0 commit 312c07b

File tree

4 files changed

+54
-4
lines changed

4 files changed

+54
-4
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+
Changes related to private IP field in create linode flow ([#13253](https://github.com/linode/manager/pull/13253))

packages/manager/src/features/Linodes/LinodeCreate/Addons/Addons.test.tsx

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,34 @@ describe('Linode Create Addons', () => {
3737
'Backups and Private IP are not available for distributed regions.'
3838
);
3939
});
40+
41+
it('should hide the Private IP addon if interface generation is "linode"', () => {
42+
const { queryByText } = renderWithThemeAndHookFormContext({
43+
component: <Addons />,
44+
useFormOptions: {
45+
values: {
46+
interface_generation: 'linode',
47+
},
48+
},
49+
});
50+
51+
const privateIPLabel = queryByText('Private IP');
52+
53+
expect(privateIPLabel).not.toBeInTheDocument();
54+
});
55+
56+
it('should show the Private IP addon if interface generation is not "linode"', () => {
57+
const { queryByText } = renderWithThemeAndHookFormContext({
58+
component: <Addons />,
59+
useFormOptions: {
60+
values: {
61+
interface_generation: 'legacy_config',
62+
},
63+
},
64+
});
65+
66+
const privateIPLabel = queryByText('Private IP');
67+
68+
expect(privateIPLabel).toBeVisible();
69+
});
4070
});

packages/manager/src/features/Linodes/LinodeCreate/Addons/Addons.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ import { PrivateIP } from './PrivateIP';
99
import type { CreateLinodeRequest } from '@linode/api-v4';
1010

1111
export const Addons = () => {
12-
const regionId = useWatch<CreateLinodeRequest, 'region'>({ name: 'region' });
12+
const [regionId, interfaceGeneration] = useWatch<
13+
CreateLinodeRequest,
14+
['region', 'interface_generation']
15+
>({ name: ['region', 'interface_generation'] });
1316

1417
const { data: regions } = useRegionsQuery();
1518

@@ -21,6 +24,8 @@ export const Addons = () => {
2124
const isDistributedRegionSelected =
2225
selectedRegion?.site_type === 'distributed';
2326

27+
const shouldShowPrivateIP = interfaceGeneration !== 'linode';
28+
2429
return (
2530
<Paper data-qa-add-ons>
2631
<Stack spacing={2}>
@@ -33,7 +38,7 @@ export const Addons = () => {
3338
)}
3439
<Stack divider={<Divider />} spacing={2}>
3540
<Backups />
36-
<PrivateIP />
41+
{shouldShowPrivateIP && <PrivateIP />}
3742
</Stack>
3843
</Stack>
3944
</Paper>

packages/manager/src/features/Linodes/LinodeCreate/Addons/PrivateIP.tsx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { useRegionsQuery } from '@linode/queries';
22
import {
33
Checkbox,
44
FormControlLabel,
5+
NewFeatureChip,
56
Notice,
67
Stack,
78
Typography,
@@ -55,9 +56,18 @@ export const PrivateIP = () => {
5556
/>
5657
)}
5758
<Typography component="span" display="block" variant="body1">
58-
Use Private IP for a backend node to a NodeBalancer. Use VPC instead
59-
for private communication between your Linodes.
59+
Lets you connect with other Linodes in the same region over the data
60+
center&apos;s private network, without using a public IPv4 address.
6061
</Typography>
62+
<Notice variant="tip">
63+
<Stack alignItems="center" direction="row" spacing={1}>
64+
<NewFeatureChip />
65+
<Typography>
66+
You can use VPC for private networking instead. NodeBalancers
67+
now connect to backend nodes without a private IPv4 address.
68+
</Typography>
69+
</Stack>
70+
</Notice>
6171
</Stack>
6272
}
6373
onChange={field.onChange}

0 commit comments

Comments
 (0)