Skip to content

Commit a3a554b

Browse files
authored
upcoming: [M3-10575] - VPC Create page feedback (linode#12807)
## Description πŸ“ Address VPC Create page feedback from Mark Greve ## Changes πŸ”„ - Add `192.168.128.0/17` exclusion to the VPC IP Stack tooltips - Set the minimum number of Linodes to 0 instead of negative numbers ## How to test πŸ§ͺ ### Prerequisites (How to setup test environment) - Ensure your account has the VPC IPv6 customer tags ### Reproduction steps (How to reproduce the issue, if applicable) - [ ] On another branch or devcloud, go to the VPC Create page - [ ] Hover over the IP Stack VPC tooltips, the text incorrectly says entire RFC 1918 range - [ ] In the Subnets section, set the IP Address Range to a `/32` and IPv6 Prefix Length to `/62`. The number of Linodes is a negative number ### Verification steps (How to verify changes) - [ ] Check the PR preview link or pull locally and point to devcloud, go to the VPC Create page - [ ] Hover over the IP Stack VPC tooltips, the text includes the `192.168.128.0/17` exception - [ ] In the Subnets section, set the IP Address Range to a `/32` and IPv6 Prefix Length to `/62`. The lowest number is 0 instead of negative
1 parent e6bc7a1 commit a3a554b

File tree

6 files changed

+49
-16
lines changed

6 files changed

+49
-16
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@linode/manager": Upcoming Features
3+
---
4+
5+
VPC Create page feedback ([#12807](https://github.com/linode/manager/pull/12807))

β€Žpackages/manager/src/features/VPCs/VPCCreate/FormComponents/VPCTopSectionContent.tsxβ€Ž

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ import { useFlags } from 'src/hooks/useFlags';
2929
import { useVPCDualStack } from 'src/hooks/useVPCDualStack';
3030
import { sendLinodeCreateFormInputEvent } from 'src/utilities/analytics/formEventAnalytics';
3131

32-
import { VPC_CREATE_FORM_VPC_HELPER_TEXT } from '../../constants';
32+
import {
33+
RFC1918HelperText,
34+
VPC_CREATE_FORM_VPC_HELPER_TEXT,
35+
} from '../../constants';
3336
import { StyledBodyTypography } from './VPCCreateForm.styles';
3437

3538
import type { Region } from '@linode/api-v4';
@@ -170,10 +173,12 @@ export const VPCTopSectionContent = (props: Props) => {
170173
padding: '8px',
171174
}}
172175
text={
173-
<Typography>
174-
The VPC uses IPv4 addresses only. The VPC can use
175-
the entire RFC 1918 specified range for subnetting.
176-
</Typography>
176+
<Stack spacing={2}>
177+
<Typography>
178+
The VPC uses IPv4 addresses only.
179+
</Typography>
180+
<Typography>{RFC1918HelperText}</Typography>
181+
</Stack>
177182
}
178183
width={250}
179184
/>
@@ -215,10 +220,7 @@ export const VPCTopSectionContent = (props: Props) => {
215220
<Typography>
216221
The VPC supports both IPv4 and IPv6 addresses.
217222
</Typography>
218-
<Typography>
219-
For IPv4, the VPC can use the entire RFC 1918
220-
specified range for subnetting.
221-
</Typography>
223+
<Typography>{RFC1918HelperText}</Typography>
222224
<Typography>
223225
For IPv6, the VPC is assigned an IPv6 prefix
224226
length of <Code>/52</Code> by default.

β€Žpackages/manager/src/features/VPCs/VPCCreate/SubnetNode.test.tsxβ€Ž

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,4 +161,25 @@ describe('SubnetNode', () => {
161161
screen.queryByText('Number of Available IP Addresses: 252')
162162
).not.toBeInTheDocument();
163163
});
164+
165+
it('should display zero instead of negative numbers for linodes helper text', () => {
166+
renderWithThemeAndHookFormContext({
167+
component: <SubnetNode {...props} shouldDisplayIPv6={true} />,
168+
useFormOptions: {
169+
defaultValues: {
170+
...formOptions.defaultValues,
171+
ipv6: [{ range: '/52' }],
172+
subnets: [
173+
{
174+
ipv4: '10.0.0.0/32',
175+
ipv6: [{ range: '/56' }],
176+
label: 'subnet 0',
177+
},
178+
],
179+
},
180+
},
181+
});
182+
183+
expect(screen.getByText('Number of Linodes: 0')).toBeVisible();
184+
});
164185
});

β€Žpackages/manager/src/features/VPCs/VPCCreate/SubnetNode.tsxβ€Ž

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ export const SubnetNode = (props: Props) => {
3838
}`
3939
: undefined;
4040

41-
const numberOfAvailableIPv4Linodes = numberOfAvailIPs
42-
? numberOfAvailIPs - RESERVED_IP_NUMBER
43-
: 0;
44-
41+
const numberOfAvailableIPv4Linodes =
42+
numberOfAvailIPs && numberOfAvailIPs > 4
43+
? numberOfAvailIPs - RESERVED_IP_NUMBER
44+
: 0;
4545
const showRemoveButton = !(isCreateVPCDrawer && idx === 0);
4646

4747
return (

β€Žpackages/manager/src/features/VPCs/VPCDetail/SubnetCreateDrawer.tsxβ€Ž

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,11 @@ export const SubnetCreateDrawer = (props: Props) => {
8282

8383
const ipv4 = watch('ipv4');
8484
const numberOfAvailableIPv4IPs = calculateAvailableIPv4sRFC1918(ipv4 ?? '');
85-
const numberOfAvailableIPv4Linodes = numberOfAvailableIPv4IPs
86-
? numberOfAvailableIPv4IPs - RESERVED_IP_NUMBER
87-
: 0;
85+
86+
const numberOfAvailableIPv4Linodes =
87+
numberOfAvailableIPv4IPs && numberOfAvailableIPv4IPs > 4
88+
? numberOfAvailableIPv4IPs - RESERVED_IP_NUMBER
89+
: 0;
8890

8991
const onCreateSubnet = async (values: CreateSubnetPayload) => {
9092
try {

β€Žpackages/manager/src/features/VPCs/constants.tsβ€Ž

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,6 @@ export const VPC_DETAILS_ROUTE = '/vpcs/$vpcId';
7272
export const VPC_CREATE_ROUTE = '/vpcs/create';
7373
export const SUBNET_ACTION_PATH =
7474
'/vpcs/$vpcId/subnets/$subnetId/$subnetAction';
75+
76+
export const RFC1918HelperText =
77+
'The VPC can use the entire RFC 1918 specified range for subnetting except for 192.168.128.0/17.';

0 commit comments

Comments
Β (0)