From 4a43e735c6a5d5f5225b0a804b6ff7972cf5cce8 Mon Sep 17 00:00:00 2001 From: Sharon Gratch Date: Thu, 28 Mar 2024 22:01:12 +0200 Subject: [PATCH] Support validation for the openStack CA certificate field Fix a bug for supporting field validation of the CA certificate field for the openStack provider. Signed-off-by: Sharon Gratch --- .../en/plugin__forklift-console-plugin.json | 1 - .../edit/OpenstackCredentialsEdit.tsx | 17 ++++------------- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/packages/forklift-console-plugin/locales/en/plugin__forklift-console-plugin.json b/packages/forklift-console-plugin/locales/en/plugin__forklift-console-plugin.json index 3a5f39106..e07610a2a 100644 --- a/packages/forklift-console-plugin/locales/en/plugin__forklift-console-plugin.json +++ b/packages/forklift-console-plugin/locales/en/plugin__forklift-console-plugin.json @@ -142,7 +142,6 @@ "Error": "Error", "Error: Insecure Skip Verify must be a boolean value.": "Error: Insecure Skip Verify must be a boolean value.", "Error: Name is required and must be a unique within a namespace and valid Kubernetes name (i.e., must contain no more than 253 characters, consists of lower case alphanumeric characters , '-' or '.' and starts and ends with an alphanumeric character).": "Error: Name is required and must be a unique within a namespace and valid Kubernetes name (i.e., must contain no more than 253 characters, consists of lower case alphanumeric characters , '-' or '.' and starts and ends with an alphanumeric character).", - "Error: The format of the provided CA certificate is invalid. Ensure the CA certificate format is valid.": "Error: The format of the provided CA certificate is invalid. Ensure the CA certificate format is valid.", "Error: this field must be set to a boolean value.": "Error: this field must be set to a boolean value.", "ESXi": "ESXi", "Expiration date": "Expiration date", diff --git a/packages/forklift-console-plugin/src/modules/Providers/views/details/components/CredentialsSection/components/edit/OpenstackCredentialsEdit.tsx b/packages/forklift-console-plugin/src/modules/Providers/views/details/components/CredentialsSection/components/edit/OpenstackCredentialsEdit.tsx index e6a513417..78dff3269 100644 --- a/packages/forklift-console-plugin/src/modules/Providers/views/details/components/CredentialsSection/components/edit/OpenstackCredentialsEdit.tsx +++ b/packages/forklift-console-plugin/src/modules/Providers/views/details/components/CredentialsSection/components/edit/OpenstackCredentialsEdit.tsx @@ -26,15 +26,6 @@ export const OpenstackCredentialsEdit: React.FC = ({ secret, successAndNotSkipped: t("The provider's CA certificate will be validated."), }; - const cacertHelperTextMsgs = { - error: t( - 'Error: The format of the provided CA certificate is invalid. Ensure the CA certificate format is valid.', - ), - success: t( - 'A CA certificate to be trusted when connecting to the OpenStack Identity (Keystone) endpoint. Ensure the CA certificate format is valid. To use a CA certificate, drag the file to the text box or browse for it. To use the system CA certificate, leave the field empty.', - ), - }; - const insecureSkipVerifyHelperTextPopover = ( Note: If Skip certificate validation is selected, migrations from this @@ -278,16 +269,16 @@ export const OpenstackCredentialsEdit: React.FC = ({ secret, : t('CA certificate - leave empty to use system CA certificates') } fieldId="cacert" - helperText={cacertHelperTextMsgs.success} - validated={state.validation.cacert} - helperTextInvalid={cacertHelperTextMsgs.error} + helperText={state.validation.cacert.msg} + validated={state.validation.cacert.type} + helperTextInvalid={state.validation.cacert.msg} > handleChange('cacert', value)} onTextChange={(value) => handleChange('cacert', value)} onClearClick={() => handleChange('cacert', '')}