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 a75a136a2..bd989b023 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 @@ -36,6 +36,7 @@ "Cannot delete migration plan": "Cannot delete migration plan", "Cannot delete network mapping": "Cannot delete network mapping", "Cannot delete storage mapping": "Cannot delete storage mapping", + "Certification.": "Certification.", "Clear all filters": "Clear all filters", "Click the update credentials button to save your changes, button is disabled until a change is detected.": "Click the update credentials button to save your changes, button is disabled until a change is detected.", "Close": "Close", @@ -144,7 +145,6 @@ "Invalid password.": "Invalid password.", "Invalid Project ID.": "Invalid Project ID.", "Invalid project name.": "Invalid project name.", - "Invalid Project.": "Invalid Project.", "Invalid region name.": "Invalid region name.", "Invalid token.": "Invalid token.", "Invalid User ID.": "Invalid User ID.", @@ -172,6 +172,7 @@ "Migration networks maps are used to map network interfaces between source and target workloads.": "Migration networks maps are used to map network interfaces between source and target workloads.", "Migration plans are used to plan migration or virtualization workloads from source providers to target providers.": "Migration plans are used to plan migration or virtualization workloads from source providers to target providers.", "Migration plans are used to plan migration or virtualization workloads from source providers to target providers. At least one source and one target provider must be available in order to create a migration plan, <2>Learn more.": "Migration plans are used to plan migration or virtualization workloads from source providers to target providers. At least one source and one target provider must be available in order to create a migration plan, <2>Learn more.", + "Migration region and project.": "Migration region and project.", "Migration storage maps are used to map storage interfaces between source and target workloads, at least one source and one target provider must be available in order to create a migration plan, <2>Learn more.": "Migration storage maps are used to map storage interfaces between source and target workloads, at least one source and one target provider must be available in order to create a migration plan, <2>Learn more.", "Migration storage maps are used to map storage interfaces between source and target workloads.": "Migration storage maps are used to map storage interfaces between source and target workloads.", "Migration Toolkit for Virtualization": "Migration Toolkit for Virtualization", @@ -235,7 +236,9 @@ "OpenStack project for password credentials.": "OpenStack project for password credentials.", "OpenStack project for token credentials.": "OpenStack project for token credentials.", "OpenStack project ID for token credentials.": "OpenStack project ID for token credentials.", + "OpenStack project.": "OpenStack project.", "OpenStack region for password credentials.": "OpenStack region for password credentials.", + "OpenStack region.": "OpenStack region.", "OpenStack REST API application credential ID.": "OpenStack REST API application credential ID.", "OpenStack REST API application credential name.": "OpenStack REST API application credential name.", "OpenStack REST API application credential secret.": "OpenStack REST API application credential secret.", diff --git a/packages/forklift-console-plugin/src/modules/Providers/utils/validators/secret/openstackSecretValidator.ts b/packages/forklift-console-plugin/src/modules/Providers/utils/validators/secret/openstackSecretValidator.ts index 573a17413..4a01b5f2d 100644 --- a/packages/forklift-console-plugin/src/modules/Providers/utils/validators/secret/openstackSecretValidator.ts +++ b/packages/forklift-console-plugin/src/modules/Providers/utils/validators/secret/openstackSecretValidator.ts @@ -25,18 +25,27 @@ export function openstackSecretValidator(secret: V1Secret) { break; case 'token': if (secret?.data?.['username']) { - requiredFields = ['token', 'username', 'projectName', 'domainName']; + requiredFields = ['token', 'username', 'regionName', 'projectName', 'domainName']; validateFields = [ 'token', 'username', + 'regionName', 'projectName', 'domainName', 'cacert', 'insecureSkipVerify', ]; } else { - requiredFields = ['token', 'userID', 'projectID']; - validateFields = ['token', 'userID', 'projectID', 'cacert', 'insecureSkipVerify']; + requiredFields = ['token', 'userID', 'projectID', 'regionName', 'projectName']; + validateFields = [ + 'token', + 'userID', + 'projectID', + 'regionName', + 'projectName', + 'cacert', + 'insecureSkipVerify', + ]; } break; case 'applicationcredential': @@ -46,20 +55,31 @@ export function openstackSecretValidator(secret: V1Secret) { 'applicationCredentialSecret', 'username', 'domainName', + 'regionName', + 'projectName', ]; validateFields = [ 'applicationCredentialName', 'applicationCredentialSecret', 'username', 'domainName', + 'regionName', + 'projectName', 'cacert', 'insecureSkipVerify', ]; } else { - requiredFields = ['applicationCredentialID', 'applicationCredentialSecret']; + requiredFields = [ + 'applicationCredentialID', + 'applicationCredentialSecret', + 'regionName', + 'projectName', + ]; validateFields = [ 'applicationCredentialID', 'applicationCredentialSecret', + 'projectName', + 'regionName', 'cacert', 'insecureSkipVerify', ]; 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 f0f50c35c..f850555dc 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 @@ -7,7 +7,17 @@ import { } from 'src/modules/Providers/utils'; import { useForkliftTranslation } from 'src/utils/i18n'; -import { Checkbox, Divider, FileUpload, Form, FormGroup, Radio } from '@patternfly/react-core'; +import { + Checkbox, + Divider, + FileUpload, + Form, + FormGroup, + Radio, + Text, + TextInput, + TextVariants, +} from '@patternfly/react-core'; import { EditComponentProps } from '../BaseCredentialsSection'; @@ -26,6 +36,8 @@ export const OpenstackCredentialsEdit: React.FC = ({ secret, const username = safeBase64Decode(secret?.data?.username || ''); const insecureSkipVerify = safeBase64Decode(secret?.data?.insecureSkipVerify || '') === 'true'; const cacert = safeBase64Decode(secret?.data?.cacert || ''); + const regionName = safeBase64Decode(secret?.data?.regionName || ''); + const projectName = safeBase64Decode(secret?.data?.projectName || ''); let authenticationType: | 'passwordSecretFields' @@ -62,6 +74,8 @@ export const OpenstackCredentialsEdit: React.FC = ({ secret, authenticationType: authenticationType, validation: { cacert: 'default' as Validation, + regionName: 'default' as Validation, + projectName: 'default' as Validation, }, }; @@ -208,7 +222,53 @@ export const OpenstackCredentialsEdit: React.FC = ({ secret, )} - +
+ + {t('Migration region and project.')} +
+ + + handleChange('regionName', value)} + validated={state.validation.regionName} + /> + + + + handleChange('projectName', value)} + validated={state.validation.projectName} + /> + + +
+ + {t('Certification.')} +
= ({ const username = safeBase64Decode(secret?.data?.username || ''); const password = safeBase64Decode(secret?.data?.password || ''); - const regionName = safeBase64Decode(secret?.data?.regionName || ''); - const projectName = safeBase64Decode(secret?.data?.projectName || ''); const domainName = safeBase64Decode(secret?.data?.domainName || ''); const initialState = { @@ -30,8 +28,6 @@ export const PasswordSecretFieldsFormGroup: React.FC = ({ validation: { username: 'default' as Validation, password: 'default' as Validation, - regionName: 'default' as Validation, - projectName: 'default' as Validation, domainName: 'default' as Validation, }, }; @@ -118,44 +114,6 @@ export const PasswordSecretFieldsFormGroup: React.FC = ({ - - handleChange('regionName', value)} - validated={state.validation.regionName} - /> - - - - handleChange('projectName', value)} - validated={state.validation.projectName} - /> - - - - handleChange('projectName', value)} - validated={state.validation.projectName} - /> -