Skip to content

Commit dc4e474

Browse files
fix: [UIE-9523] - Show edit RDNS button for VPC NAT IPv4 address row in linode network tab (#13170)
1 parent bb76191 commit dc4e474

File tree

4 files changed

+51
-2
lines changed

4 files changed

+51
-2
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@linode/manager": Fixed
3+
---
4+
5+
Show edit RDNS button for VPC NAT IPv4 address row in linode network tab ([#13170](https://github.com/linode/manager/pull/13170))

packages/manager/src/features/Linodes/LinodesDetail/LinodeNetworking/LinodeIPAddressRow.test.tsx

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ const ipDisplay = ipResponseToDisplayRows({
1616
ipResponse: ips,
1717
isLinodeInterface: false,
1818
})[0];
19-
const ipDisplayVPC = createVPCIPv4Display([vpcIPv4Factory.build()])[0];
19+
const [ipDisplayVPC, ipDisplayVPCNAT] = createVPCIPv4Display([
20+
vpcIPv4Factory.build(),
21+
]);
2022

2123
const handlers: IPAddressRowHandlers = {
2224
handleOpenEditRDNS: vi.fn(),
@@ -72,6 +74,26 @@ describe('LinodeIPAddressRow', () => {
7274
expect(queryByText('Edit RDNS')).not.toBeInTheDocument();
7375
});
7476

77+
it('should render a VPC NAT IPv4 Address row', () => {
78+
const { getAllByText } = renderWithTheme(
79+
wrapWithTableBody(
80+
<LinodeIPAddressRow
81+
isLinodeInterface={false}
82+
isUnreachablePublicIPv4={false}
83+
linodeId={1}
84+
readOnly={false}
85+
{...handlers}
86+
{...ipDisplayVPCNAT}
87+
/>
88+
)
89+
);
90+
91+
getAllByText(ipDisplayVPCNAT.address);
92+
getAllByText(ipDisplayVPCNAT.type);
93+
// Check if actions were rendered
94+
getAllByText('Edit RDNS');
95+
});
96+
7597
it('should disable the row if disabled is true and display a tooltip', async () => {
7698
const { findByRole, getByTestId } = renderWithTheme(
7799
wrapWithTableBody(

packages/manager/src/features/Linodes/LinodesDetail/LinodeNetworking/LinodeNetworkingActionMenu.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ export const LinodeNetworkingActionMenu = (props: Props) => {
4949
'Reserved IPv4 (private)',
5050
'Reserved IPv4 (public)',
5151
'VPC – IPv4',
52-
'VPC NAT – IPv4',
52+
'VPC – IPv6',
53+
'VPC – Range – IPv4',
54+
'VPC – Range – IPv6',
5355
].includes(ipType);
5456

5557
const deletableIPTypes = ['Private – IPv4', 'Public – IPv4', 'Range – IPv6'];

packages/manager/src/features/Linodes/LinodesDetail/LinodeNetworking/utils.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,25 @@ export const ipToDisplay = (ip: IPAddress, key: IPKey): IPDisplay => {
138138
};
139139
};
140140

141+
const ipAddressForVPC = (
142+
ip: VPCIP,
143+
ipAddress: string,
144+
ipType: string
145+
): IPAddress => {
146+
return {
147+
address: ipAddress,
148+
gateway: ip.gateway,
149+
interface_id: ip.interface_id,
150+
linode_id: ip.linode_id!,
151+
prefix: ip.prefix!,
152+
public: false,
153+
rdns: null,
154+
region: ip.region,
155+
subnet_mask: ip.subnet_mask,
156+
type: ipType,
157+
};
158+
};
159+
141160
export const createVPCIPv4Display = (ips: VPCIP[]): IPDisplay[] => {
142161
const emptyProps = {
143162
gateway: '',
@@ -163,6 +182,7 @@ export const createVPCIPv4Display = (ips: VPCIP[]): IPDisplay[] => {
163182
}
164183
if (ip.nat_1_1) {
165184
vpcIPDisplay.push({
185+
_ip: ipAddressForVPC(ip, ip.nat_1_1, 'VPC NAT – IPv4'),
166186
address: ip.nat_1_1,
167187
type: 'VPC NAT – IPv4',
168188
...emptyProps,

0 commit comments

Comments
 (0)