Skip to content

Commit

Permalink
Enhabce oVirt provider create/edit credentials help text fields
Browse files Browse the repository at this point in the history
Reference: #646
Reference: #541

Rephrase all oVirt fields help text messages and add hints for the following dialogs:
1. Create oVirt provider,
2. oVirt Credentials view/edit modes.

The main changes include:
1. Rephrase all help text messages.
2. Support 'warning' validation state for the 'user' field.
3. Add hint sections for insecureSkipVerify, cacert fields.
4. In Create/edit dialogs, hide the 'cacert' field help text message and the hint section if
   insecureSkipVerify=true.

This fix assumes that leaving the 'cacert' field empty, will trigger verifying the the system CA certificates.

Signed-off-by: Sharon Gratch <[email protected]>
  • Loading branch information
sgratch committed Nov 22, 2023
1 parent 7ac736d commit 533c808
Show file tree
Hide file tree
Showing 6 changed files with 161 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@
"24 hours": "24 hours",
"404: Not Found": "404: Not Found",
"7 days": "7 days",
"A CA certificate to be trusted when connecting to the Red Hat Virtualization Manager (RHVM) API endpoint. Ensure the CA certificate format is in a PEM encoded X.509 format. To use a custom CA certificate, drag the file to the text box or browse for it. To use the system CA certificates, leave the field empty.": "A CA certificate to be trusted when connecting to the Red Hat Virtualization Manager (RHVM) API endpoint. Ensure the CA certificate format is in a PEM encoded X.509 format. To use a custom CA certificate, drag the file to the text box or browse for it. To use the system CA certificates, leave the field empty.",
"A Secret containing credentials and other confidential information.": "A Secret containing credentials and other confidential information.",
"A Secret containing credentials and other confidential information. Empty may be used for the host provider.": "A Secret containing credentials and other confidential information. Empty may be used for the host provider.",
"A user name for connecting to the Red Hat Virtualization Manager (RHVM) API endpoint. Ensure the user name is in the format of username@user-domain. For example: admin@internal.": "A user name for connecting to the Red Hat Virtualization Manager (RHVM) API endpoint. Ensure the user name is in the format of username@user-domain. For example: admin@internal.",
"A user password for connecting to the Red Hat Virtualization Manager (RHVM) API endpoint.": "A user password for connecting to the Red Hat Virtualization Manager (RHVM) API endpoint.",
"Actions": "Actions",
"Add source and target providers for the migration.": "Add source and target providers for the migration.",
"Application credential ID": "Application credential ID",
Expand All @@ -28,7 +31,9 @@
"Authentication type": "Authentication type",
"Bandwidth": "Bandwidth",
"CA certificate": "CA certificate",
"CA certificate - disabled and ignored when 'Skip certificate validation' is checked": "CA certificate - disabled and ignored when 'Skip certificate validation' is checked",
"CA certificate - disabled when skip certificate validation is checked": "CA certificate - disabled when skip certificate validation is checked",
"CA certificate - leave empty to use system CA certificates": "CA certificate - leave empty to use system CA certificates",
"CA certificate - leave empty to use system certificates": "CA certificate - leave empty to use system certificates",
"Cancel": "Cancel",
"Cancel scheduled cutover": "Cancel scheduled cutover",
Expand Down Expand Up @@ -63,7 +68,6 @@
"Credentials": "Credentials",
"Critical concerns": "Critical concerns",
"Custom certification used to verify the OpenStack REST API server, when empty use system certificate.": "Custom certification used to verify the OpenStack REST API server, when empty use system certificate.",
"Custom certification used to verify the RH Virtualization REST API server, when empty use system certificate.": "Custom certification used to verify the RH Virtualization REST API server, when empty use system certificate.",
"Data centers": "Data centers",
"Data stores": "Data stores",
"Dates are compared in UTC. End of the interval is included.": "Dates are compared in UTC. End of the interval is included.",
Expand Down Expand Up @@ -110,9 +114,13 @@
"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: The format of the provided CA Certificate is invalid. Ensure the CA certificate format is in a PEM encoded X.509 format.": "Error: The format of the provided CA Certificate is invalid. Ensure the CA certificate format is in a PEM encoded X.509 format.",
"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: The format of the provided user name is invalid. Ensure the user name doesn't include whitespace characters.": "Error: The format of the provided user name is invalid. Ensure the user name doesn't include whitespace characters.",
"Error: The format of the provided user password is invalid. Ensure the user password doesn't include whitespace characters.": "Error: The format of the provided user password is invalid. Ensure the user password doesn't include whitespace characters.",
"Error: This field must be a boolean.": "Error: This field must be a boolean.",
"Error: this field must be set to a boolean value.": "Error: this field must be set to a boolean value.",
"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.",
"Error: URL must be valid.": "Error: URL must be valid.",
Expand Down Expand Up @@ -140,6 +148,7 @@
"Host": "Host",
"Host cluster": "Host cluster",
"Hosts": "Hosts",
"If true (check box is checked), the provider's CA certificate won't be validated.": "If true (check box is checked), the provider's CA certificate won't be validated.",
"If true, the provider's REST API TLS certificate won't be validated.": "If true, the provider's REST API TLS certificate won't be validated.",
"If true, the provider's TLS certificate won't be validated.": "If true, the provider's TLS certificate won't be validated.",
"Image": "Image",
Expand Down Expand Up @@ -223,6 +232,8 @@
"No StorageMaps found in namespace <1>{namespace}</1>.": "No StorageMaps found in namespace <1>{namespace}</1>.",
"No StorageMaps found.": "No StorageMaps found.",
"Not Ready": "Not Ready",
"Note: enter the Manager CA certificate. unless it was replaced by a third-party certificate, in which case enter the Manager Apache CA certificate. You can retrieve the Manager CA certificate at: ": "Note: enter the Manager CA certificate. unless it was replaced by a third-party certificate, in which case enter the Manager Apache CA certificate. You can retrieve the Manager CA certificate at: ",
"Note: if 'Skip certificate validation' field is checked/true, the migration from this provider will be insecure. Insecure migration means that the transferred data is sent over an insecure connection and potentially sensitive data could be exposed.": "Note: if 'Skip certificate validation' field is checked/true, the migration from this provider will be insecure. Insecure migration means that the transferred data is sent over an insecure connection and potentially sensitive data could be exposed.",
"Number of cluster in provider": "Number of cluster in provider",
"Number of data centers in provider": "Number of data centers in provider",
"Number of data stores in provider": "Number of data stores in provider",
Expand Down Expand Up @@ -298,8 +309,6 @@
"Restore default columns": "Restore default columns",
"Return to the providers list page": "Return to the providers list page",
"Reveal values": "Reveal values",
"RH Virtualization engine REST API password credentials.": "RH Virtualization engine REST API password credentials.",
"RH Virtualization engine REST API user name.": "RH Virtualization engine REST API user name.",
"Run the migration plan.": "Run the migration plan.",
"Running - performing incremental data copies": "Running - performing incremental data copies",
"Running - preparing for cutover": "Running - preparing for cutover",
Expand Down Expand Up @@ -345,7 +354,6 @@
"Target provider": "Target provider",
"Template": "Template",
"Tenant": "Tenant",
"The CA certificate is the /etc/pki/ovirt-engine/apache-ca.pem file on the Manager machine.": "The CA certificate is the /etc/pki/ovirt-engine/apache-ca.pem file on the Manager machine.",
"The interval in minutes for precopy. Default value is 60.": "The interval in minutes for precopy. Default value is 60.",
"The interval in seconds for snapshot pooling. Default value is 10.": "The interval in seconds for snapshot pooling. Default value is 10.",
"The limit for CPU usage by the controller, specified in milliCPU. Default value is 500m.": "The limit for CPU usage by the controller, specified in milliCPU. Default value is 500m.",
Expand Down Expand Up @@ -416,6 +424,7 @@
"Warning concerns": "Warning concerns",
"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",
"Warning: The provided user name does not include the user domain. Ensure the user name is in the format of username@user-domain. For example: admin@internal.": "Warning: The provided user name does not include the user domain. Ensure the user name is in the format of username@user-domain. For example: admin@internal.",
"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 @@ -90,3 +90,9 @@ export function validateNoSpaces(value: string) {
// any string without spaces
return /^[^\s]+$/.test(value);
}

export function validateUsernameAndDomain(value: string) {
// any string without spaces that includes appearance of the at '@' sign
// example: user@domain
return /^[^\s]+(@+)+[^\s]+$/.test(value);
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Validation } from '../../types';
import { validateNoSpaces, validatePublicCert } from '../common';
import { validateNoSpaces, validatePublicCert, validateUsernameAndDomain } from '../common';

/**
* Validates form input fields based on their id.
Expand All @@ -10,6 +10,7 @@ import { validateNoSpaces, validatePublicCert } from '../common';
* @return {Validation} - The validation state of the form field. Can be one of the following:
* 'default' - The default state of the form field, used when the field is empty or a value hasn't been entered yet.
* 'success' - The field's value has passed validation.
* 'warning' - The field's value might fail the validation, but it's not mandatory and not disabling the form saving.
* 'error' - The field's value has failed validation.
*/
export const ovirtSecretFieldValidator = (id: string, value: string) => {
Expand All @@ -19,7 +20,7 @@ export const ovirtSecretFieldValidator = (id: string, value: string) => {

switch (id) {
case 'user':
validationState = validateUser(trimmedValue) ? 'success' : 'error';
validationState = validateUser(trimmedValue);
break;
case 'password':
validationState = validatePassword(trimmedValue) ? 'success' : 'error';
Expand All @@ -39,7 +40,11 @@ export const ovirtSecretFieldValidator = (id: string, value: string) => {
};

const validateUser = (value: string) => {
return validateNoSpaces(value);
return validateNoSpaces(value)
? validateUsernameAndDomain(value)
? 'success'
: 'warning'
: 'error';
};

const validatePassword = (value: string) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
padding-bottom: var(--pf-global--spacer--xm);
}

.forklift-page-secret-hint-div {
padding-top: var(--pf-global--spacer--md);
padding-bottom: var(--pf-global--spacer--xm);
}

.forklift-page-secret-title {
margin-top: var(--pf-global--spacer--sm);
margin-bottom: 0;
Expand Down
Loading

0 comments on commit 533c808

Please sign in to comment.