From b59a7d4dc97909dfeb0ea60a8637317533d8b650 Mon Sep 17 00:00:00 2001 From: Tyler Ouyang Date: Fri, 6 Sep 2024 17:06:28 -0700 Subject: [PATCH 1/2] Fix null value --- .../deploy_board/templates/configs/new_capacity_adv.html | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/deploy-board/deploy_board/templates/configs/new_capacity_adv.html b/deploy-board/deploy_board/templates/configs/new_capacity_adv.html index df4226d1ce..e094154c52 100644 --- a/deploy-board/deploy_board/templates/configs/new_capacity_adv.html +++ b/deploy-board/deploy_board/templates/configs/new_capacity_adv.html @@ -560,9 +560,9 @@

Capacity

globalNotificationBanner.error = "Replacement timeout must be a number between 5 and 1440 minutes (24 hours)"; return false; } - var access_role = clusterInfo.configs['access_role'].trim(); - if (!access_role) { - globalNotificationBanner.error = "Access Role must be specified"; + var access_role = clusterInfo.configs['access_role']; + if (!access_role || access_role.trim()) { + globalNotificationBanner.error = "Access Role must be specified can not be empty"; return false; } @@ -644,7 +644,8 @@

Capacity

} let accessRoleObj = this.allUserData.find(({name}) => name === "access_role"); - clusterInfo.configs['access_role'] = accessRoleObj.value; + clusterInfo.configs['access_role'] = accessRoleObj ? accessRoleObj.value : null; + if (this.validateInput(clusterInfo)) { //Send request this.sendRequest(clusterInfo); From b284267aeab78e45a5cb29623d4aa09bb043f888 Mon Sep 17 00:00:00 2001 From: Tyler Ouyang Date: Fri, 6 Sep 2024 17:19:57 -0700 Subject: [PATCH 2/2] update the logic --- .../deploy_board/templates/configs/new_capacity_adv.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/deploy-board/deploy_board/templates/configs/new_capacity_adv.html b/deploy-board/deploy_board/templates/configs/new_capacity_adv.html index e094154c52..0f13a8d25b 100644 --- a/deploy-board/deploy_board/templates/configs/new_capacity_adv.html +++ b/deploy-board/deploy_board/templates/configs/new_capacity_adv.html @@ -560,9 +560,9 @@

Capacity

globalNotificationBanner.error = "Replacement timeout must be a number between 5 and 1440 minutes (24 hours)"; return false; } - var access_role = clusterInfo.configs['access_role']; - if (!access_role || access_role.trim()) { - globalNotificationBanner.error = "Access Role must be specified can not be empty"; + var access_role = clusterInfo.configs['access_role'] ?? ''; + if (access_role.trim().length === 0) { + globalNotificationBanner.error = "Access Role must be specified and cannot be empty"; return false; } @@ -644,7 +644,7 @@

Capacity

} let accessRoleObj = this.allUserData.find(({name}) => name === "access_role"); - clusterInfo.configs['access_role'] = accessRoleObj ? accessRoleObj.value : null; + clusterInfo.configs['access_role'] = accessRoleObj?.value; if (this.validateInput(clusterInfo)) { //Send request