From 42aff6db086ab78d7d0f5773afbbe43dc9effca6 Mon Sep 17 00:00:00 2001 From: Hana Xu <115299789+hana-linode@users.noreply.github.com> Date: Tue, 17 Oct 2023 15:08:20 -0400 Subject: [PATCH] fix: [M3-7270] - Edit Linode VLAN config interface (#9798) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Description ๐Ÿ“ Bug from https://github.com/linode/manager/pull/9709 On the prod env, we were unable to edit a config due to the config interface being deleted. This was due to the `regionHasVPCs` variable being coupled with `regionHasVLANS` in the if statement to delete config interfaces. The fix was to handle VPCs and VLANs separately. ## How to test ๐Ÿงช ### Prerequisites - Point to the prod environment ### Reproduction steps - Go to a Linode's details page and click on the `Configurations` tab - Click the edit button and scroll down to the Networking section - Select a VLAN and save changes ### Verification steps - The VLAN changes should be reflected in the Configurations table --- .../LinodeConfigs/LinodeConfigDialog.tsx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/manager/src/features/Linodes/LinodesDetail/LinodeConfigs/LinodeConfigDialog.tsx b/packages/manager/src/features/Linodes/LinodesDetail/LinodeConfigs/LinodeConfigDialog.tsx index 222b10f9cbc..b39b68bdfad 100644 --- a/packages/manager/src/features/Linodes/LinodesDetail/LinodeConfigs/LinodeConfigDialog.tsx +++ b/packages/manager/src/features/Linodes/LinodesDetail/LinodeConfigs/LinodeConfigDialog.tsx @@ -368,8 +368,16 @@ export const LinodeConfigDialog = (props: Props) => { configData.initrd = finnixDiskID; } - if (!regionHasVLANS || !regionHasVPCs) { - delete configData.interfaces; + if (!regionHasVLANS) { + configData.interfaces = configData.interfaces?.filter( + (_interface) => _interface.purpose !== 'vlan' + ); + } + + if (!regionHasVPCs) { + configData.interfaces = configData.interfaces?.filter( + (_interface) => _interface.purpose !== 'vpc' + ); } const actionType = Boolean(config) ? 'updated' : 'created';