From a446f27e64e6444dc5b7b1d5bb8e7260c51ba2da Mon Sep 17 00:00:00 2001 From: Lingeshwar S Date: Mon, 1 Jul 2024 15:36:35 +0530 Subject: [PATCH] [PLAT-14530] - fix : Edit Azure Provider is failing Summary: The reason for this issue is Validation is getting fired even when string is fired. This is not just happening with Edit flow and it is also with Create flow Test Plan: Tested manually Reviewers: kkannan Reviewed By: kkannan Subscribers: ui, yugaware Differential Revision: https://phorge.dev.yugabyte.com/D36273 --- .../forms/azu/AZUProviderCreateForm.tsx | 28 +++++++++---------- .../forms/azu/AZUProviderEditForm.tsx | 28 +++++++++---------- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/managed/ui/src/components/configRedesign/providerRedesign/forms/azu/AZUProviderCreateForm.tsx b/managed/ui/src/components/configRedesign/providerRedesign/forms/azu/AZUProviderCreateForm.tsx index 4e8ab6848a77..32be49a58be8 100644 --- a/managed/ui/src/components/configRedesign/providerRedesign/forms/azu/AZUProviderCreateForm.tsx +++ b/managed/ui/src/components/configRedesign/providerRedesign/forms/azu/AZUProviderCreateForm.tsx @@ -121,7 +121,7 @@ const VALIDATION_SCHEMA = object().shape({ .required('Azure Client ID is required.') .matches( UUID_REGEX, - "UUID format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, where each x is a hexadecimal digit (0-9, a-f, A-F)" + 'UUID format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, where each x is a hexadecimal digit (0-9, a-f, A-F)' ), azuClientSecret: mixed().when('providerCredentialType', { is: AzuProviderCredentialType.SPECIFIED_SERVICE_PRINCIPAL, @@ -131,19 +131,19 @@ const VALIDATION_SCHEMA = object().shape({ .required('Azure Resource Group is required.') .matches( RG_REGEX, - "Resource group names can only include alphanumeric, underscore, parentheses, hyphen, period (except at end)" + 'Resource group names can only include alphanumeric, underscore, parentheses, hyphen, period (except at end)' ), azuSubscriptionId: string() .required('Azure Subscription ID is required.') .matches( UUID_REGEX, - "UUID format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, where each x is a hexadecimal digit (0-9, a-f, A-F)" + 'UUID format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, where each x is a hexadecimal digit (0-9, a-f, A-F)' ), azuTenantId: string() .required('Azure Tenant ID is required.') .matches( UUID_REGEX, - "UUID format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, where each x is a hexadecimal digit (0-9, a-f, A-F)" + 'UUID format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, where each x is a hexadecimal digit (0-9, a-f, A-F)' ), sshPrivateKeyContent: mixed().when('sshKeypairManagement', { is: KeyPairManagement.SELF_MANAGED, @@ -164,16 +164,16 @@ const VALIDATION_SCHEMA = object().shape({ ) }), regions: array().min(1, 'Provider configurations must contain at least one region.'), - azuNetworkRG: string() - .matches( - RG_REGEX, - "Resource group names can only include alphanumeric, underscore, parentheses, hyphen, period (except at end)") - , - azuNetworkSubscriptionId: string() - .matches( - UUID_REGEX, - "UUID format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, where each x is a hexadecimal digit (0-9, a-f, A-F)" - ) + azuNetworkRG: string().matches(RG_REGEX, { + message: + 'Resource group names can only include alphanumeric, underscore, parentheses, hyphen, period (except at end)', + excludeEmptyString: true + }), + azuNetworkSubscriptionId: string().matches(UUID_REGEX, { + message: + 'UUID format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, where each x is a hexadecimal digit (0-9, a-f, A-F)', + excludeEmptyString: true + }) }); const FORM_NAME = 'AZUProviderCreateForm'; diff --git a/managed/ui/src/components/configRedesign/providerRedesign/forms/azu/AZUProviderEditForm.tsx b/managed/ui/src/components/configRedesign/providerRedesign/forms/azu/AZUProviderEditForm.tsx index 8125325d0285..2c08efd5db80 100644 --- a/managed/ui/src/components/configRedesign/providerRedesign/forms/azu/AZUProviderEditForm.tsx +++ b/managed/ui/src/components/configRedesign/providerRedesign/forms/azu/AZUProviderEditForm.tsx @@ -141,7 +141,7 @@ const VALIDATION_SCHEMA = object().shape({ .required('Azure Client ID is required.') .matches( UUID_REGEX, - "UUID format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, where each x is a hexadecimal digit (0-9, a-f, A-F)" + 'UUID format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, where each x is a hexadecimal digit (0-9, a-f, A-F)' ), azuClientSecret: mixed().test({ test: (value, context) => { @@ -160,19 +160,19 @@ const VALIDATION_SCHEMA = object().shape({ .required('Azure Resource Group is required.') .matches( RG_REGEX, - "Resource group names can only include alphanumeric, underscore, parentheses, hyphen, period (except at end)" + 'Resource group names can only include alphanumeric, underscore, parentheses, hyphen, period (except at end)' ), azuSubscriptionId: string() .required('Azure Subscription ID is required.') .matches( UUID_REGEX, - "UUID format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, where each x is a hexadecimal digit (0-9, a-f, A-F)" + 'UUID format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, where each x is a hexadecimal digit (0-9, a-f, A-F)' ), azuTenantId: string() .required('Azure Tenant ID is required.') .matches( UUID_REGEX, - "UUID format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, where each x is a hexadecimal digit (0-9, a-f, A-F)" + 'UUID format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, where each x is a hexadecimal digit (0-9, a-f, A-F)' ), sshKeypairManagement: mixed().when('editSSHKeypair', { is: true, @@ -201,16 +201,16 @@ const VALIDATION_SCHEMA = object().shape({ ) }), regions: array().min(1, 'Provider configurations must contain at least one region.'), - azuNetworkRG: string() - .matches( - RG_REGEX, - "Resource group names can only include alphanumeric, underscore, parentheses, hyphen, period (except at end)" - ), - azuNetworkSubscriptionId: string() - .matches( - UUID_REGEX, - "UUID format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, where each x is a hexadecimal digit (0-9, a-f, A-F)" - ) + azuNetworkRG: string().matches(RG_REGEX, { + message: + 'Resource group names can only include alphanumeric, underscore, parentheses, hyphen, period (except at end)', + excludeEmptyString: true + }), + azuNetworkSubscriptionId: string().matches(UUID_REGEX, { + message: + 'UUID format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, where each x is a hexadecimal digit (0-9, a-f, A-F)', + excludeEmptyString: true + }) }); const FORM_NAME = 'AZUProviderEditForm';