Skip to content

Commit

Permalink
Merge pull request #751 from sgratch/release-v2.5.1-
Browse files Browse the repository at this point in the history
Fix vSphere provider url help text field
  • Loading branch information
yaacov authored Oct 4, 2023
2 parents c3a4a9b + 1cc9775 commit ae21538
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,16 +98,15 @@
"Edit VDDK init image": "Edit VDDK init image",
"Empty": "Empty",
"Endpoint": "Endpoint",
"Enter the URL of the SDK endpoint in vCenter. Ensure it includes the \"sdk\" path, e.g., https://vcenter.com/sdk.": "Enter the URL of the SDK endpoint in vCenter. Ensure it includes the \"sdk\" path, e.g., https://vcenter.com/sdk.",
"Error": "Error",
"Error: CA Certificate must be valid.": "Error: CA Certificate must be valid.",
"Error: Fingerprint is required and must be valid.": "Error: Fingerprint is required and must be valid.",
"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: NFS mount end point should be in the form NFS_SERVER:EXPORTED_DIRECTORY, for example: 10.10.0.10:/ova.": "Error: NFS mount end point should be in the form NFS_SERVER:EXPORTED_DIRECTORY, for example: 10.10.0.10:/ova.",
"Error: Password is required and must be valid.": "Error: Password is required and must be valid.",
"Error: Please provide a valid URL with a schema, domain, and path. For example: https://vcenter.com/sdk.": "Error: Please provide a valid URL with a schema, domain, and path. For example: https://vcenter.com/sdk.",
"Error: The format of the provided URL is invalid. Ensure the URL includes a scheme, a domain name, and a path. For example: https://rhv-host-example.com/ovirt-engine/api": "Error: The format of the provided URL is invalid. Ensure the URL includes a scheme, a domain name, and a path. For example: https://rhv-host-example.com/ovirt-engine/api",
"Error: The format of the provided URL is invalid. Ensure the URL includes a scheme, a domain name, and a path. For example: https://vCenter-host-example.com/sdk": "Error: The format of the provided URL is invalid. Ensure the URL includes a scheme, a domain name, and a path. For example: https://vCenter-host-example.com/sdk",
"Error: This field must be a boolean.": "Error: This field must be a boolean.",
"Error: token is a required field, the token must be a valid kubernetes token.": "Error: token is a required field, the token must be a valid kubernetes token.",
"Error: URL is required and must be valid.": "Error: URL is required and must be valid.",
Expand Down Expand Up @@ -365,6 +364,7 @@
"URL of the provider": "URL of the provider",
"URL of the provider, leave empty to use this providers URL": "URL of the provider, leave empty to use this providers URL",
"URL of the Red Hat Virtualization Manager (RHVM) API endpoint. Ensure the URL includes the \"/ovirt-engine/api\" path. for example: https://rhv-host-example.com/ovirt-engine/api": "URL of the Red Hat Virtualization Manager (RHVM) API endpoint. Ensure the URL includes the \"/ovirt-engine/api\" path. for example: https://rhv-host-example.com/ovirt-engine/api",
"URL of the vCenter SDK endpoint. Ensure the URL includes the \"/sdk\" path. For example: https://vCenter-host-example.com/sdk": "URL of the vCenter SDK endpoint. Ensure the URL includes the \"/sdk\" path. For example: https://vCenter-host-example.com/sdk",
"User ID": "User ID",
"User or service account bearer token for service accounts or user authentication.": "User or service account bearer token for service accounts or user authentication.",
"Username": "Username",
Expand All @@ -384,8 +384,8 @@
"vSphere product name": "vSphere product name",
"vSphere REST API password credentials.": "vSphere REST API password credentials.",
"vSphere REST API user name.": "vSphere REST API user name.",
"Warning: The provided URL does not end with \"sdk\". Ensure it includes the correct path, like: https://vcenter.com/sdk.": "Warning: The provided URL does not end with \"sdk\". Ensure it includes the correct path, like: https://vcenter.com/sdk.",
"Warning: The provided URL does not end with the RHVM API endpoint path: \"ovirt-engine/api\". Ensure the URL includes the correct path. For example: https://rhv-host-example.com/ovirt-engine/api": "Warning: The provided URL does not end with the RHVM API endpoint path: \"ovirt-engine/api\". Ensure the URL includes the correct path. For example: https://rhv-host-example.com/ovirt-engine/api",
"Warning: The provided URL does not end with the SDK endpoint path: \"/sdk\". Ensure the URL includes the correct path. For example: https://vCenter-host-example.com/sdk": "Warning: The provided URL does not end with the SDK endpoint path: \"/sdk\". Ensure the URL includes the correct path. For example: https://vCenter-host-example.com/sdk",
"Welcome": "Welcome",
"When a plan is archived, its history, metadata, and logs are deleted. The plan cannot be edited or restarted but it can be viewed.": "When a plan is archived, its history, metadata, and logs are deleted. The plan cannot be edited or restarted but it can be viewed.",
"YAML": "YAML",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,22 @@ export const VSphereProviderCreateForm: React.FC<VSphereProviderCreateFormProps>
const url = provider?.spec?.url || '';
const vddkInitImage = provider?.spec?.settings?.['vddkInitImage'] || '';

const helperTextInvalid = {
const helperTextMsgs = {
error: t(
'Error: Please provide a valid URL with a schema, domain, and path. For example: https://vcenter.com/sdk.',
'Error: The format of the provided URL is invalid. Ensure the URL includes a scheme, a domain name, and a path. For example: https://vCenter-host-example.com/sdk',
),
warning: t(
'Warning: The provided URL does not end with "sdk". Ensure it includes the correct path, like: https://vcenter.com/sdk.',
'Warning: The provided URL does not end with the SDK endpoint path: "/sdk". Ensure the URL includes the correct path. For example: https://vCenter-host-example.com/sdk',
),
success: t(
'URL of the vCenter SDK endpoint. Ensure the URL includes the "/sdk" path. For example: https://vCenter-host-example.com/sdk',
),
};

const initialState = {
validation: {
url: 'default' as Validation,
urlHelperTextInvalid: '',
urlHelperText: helperTextMsgs.success,
vddkInitImage: 'default' as Validation,
},
};
Expand Down Expand Up @@ -84,8 +87,8 @@ export const VSphereProviderCreateForm: React.FC<VSphereProviderCreateFormProps>
dispatch({
type: 'SET_FIELD_VALIDATED',
payload: {
field: 'urlHelperTextInvalid',
validationState: helperTextInvalid[validationState],
field: 'urlHelperText',
validationState: helperTextMsgs[validationState],
},
});

Expand All @@ -97,7 +100,7 @@ export const VSphereProviderCreateForm: React.FC<VSphereProviderCreateFormProps>

const getURLValidationState = (url: string): Validation => {
if (!validateURL(url)) return 'error';
if (!url.endsWith('sdk')) return 'warning';
if (!url.endsWith('sdk') && !url.endsWith('sdk/')) return 'warning';
return 'success';
};

Expand All @@ -107,11 +110,9 @@ export const VSphereProviderCreateForm: React.FC<VSphereProviderCreateFormProps>
label={t('URL')}
isRequired
fieldId="url"
helperText={t(
'Enter the URL of the SDK endpoint in vCenter. Ensure it includes the "sdk" path, e.g., https://vcenter.com/sdk.',
)}
helperText={state.validation.urlHelperText}
validated={state.validation.url}
helperTextInvalid={state.validation.urlHelperTextInvalid}
helperTextInvalid={state.validation.urlHelperText}
>
<TextInput
isRequired
Expand Down

0 comments on commit ae21538

Please sign in to comment.