Skip to content

Commit

Permalink
[PLAT-14530] - fix : Edit Azure Provider is failing
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Lingeshwar committed Jul 1, 2024
1 parent cfa6300 commit a446f27
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand All @@ -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,
Expand Down Expand Up @@ -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';
Expand Down

0 comments on commit a446f27

Please sign in to comment.