diff --git a/src/Components/CreateImageWizard/CreateImageWizard.js b/src/Components/CreateImageWizard/CreateImageWizard.js index fad339d0..76e4745c 100644 --- a/src/Components/CreateImageWizard/CreateImageWizard.js +++ b/src/Components/CreateImageWizard/CreateImageWizard.js @@ -7,7 +7,8 @@ import { useLocation, useNavigate } from 'react-router-dom'; import ImageCreator from './ImageCreator'; import { - awsTarget, + awsTargetStable, + awsTargetBeta, fileSystemConfiguration, googleCloudTarger, imageName, @@ -475,6 +476,8 @@ const formStepHistory = (composeRequest) => { }; const CreateImageWizard = () => { + const awsTarget = insights.chrome.isBeta() ? awsTargetBeta : awsTargetStable; + const dispatch = useDispatch(); const navigate = useNavigate(); const location = useLocation(); diff --git a/src/Components/CreateImageWizard/steps/aws.beta.js b/src/Components/CreateImageWizard/steps/aws.beta.js new file mode 100644 index 00000000..07ec8349 --- /dev/null +++ b/src/Components/CreateImageWizard/steps/aws.beta.js @@ -0,0 +1,192 @@ +import React from 'react'; + +import componentTypes from '@data-driven-forms/react-form-renderer/component-types'; +import validatorTypes from '@data-driven-forms/react-form-renderer/validator-types'; +import { + Button, + HelperText, + HelperTextItem, + Title, +} from '@patternfly/react-core'; +import { ExternalLinkAltIcon } from '@patternfly/react-icons'; + +import nextStepMapper from './imageOutputStepMapper'; +import StepTemplate from './stepTemplate'; + +import { DEFAULT_AWS_REGION } from '../../../constants'; +import CustomButtons from '../formComponents/CustomButtons'; + +const SourcesButton = () => { + return ( + + ); +}; + +export default { + StepTemplate, + id: 'wizard-target-aws', + title: 'Amazon Web Services', + customTitle: ( + + Target environment - Amazon Web Services + + ), + name: 'aws-target-env', + substepOf: 'Target environment', + nextStep: ({ values }) => nextStepMapper(values, { skipAws: true }), + buttons: CustomButtons, + fields: [ + { + component: componentTypes.PLAIN_TEXT, + name: 'plain-text-component', + label: ( +

+ Your image will be uploaded to AWS and shared with the account you + provide below. +

+ ), + }, + { + component: componentTypes.PLAIN_TEXT, + name: 'plain-text-component', + label: ( +

+ The shared image will expire within 14 days. To permanently + access the image, copy the image, which will be shared to your account + by Red Hat, to your own AWS account. +

+ ), + }, + { + component: componentTypes.RADIO, + label: 'Share method:', + name: 'aws-target-type', + initialValue: 'aws-target-type-source', + autoFocus: true, + options: [ + { + label: 'Use an account configured from Sources.', + description: + 'Use a configured source to launch environments directly from the console.', + value: 'aws-target-type-source', + 'data-testid': 'aws-radio-source', + autoFocus: true, + }, + { + label: 'Manually enter an account ID.', + value: 'aws-target-type-account-id', + 'data-testid': 'aws-radio-account-id', + className: 'pf-u-mt-sm', + }, + ], + }, + { + component: 'aws-sources-select', + name: 'aws-sources-select', + className: 'pf-u-max-width', + label: 'Source Name', + isRequired: true, + validate: [ + { + type: validatorTypes.REQUIRED, + }, + ], + condition: { + when: 'aws-target-type', + is: 'aws-target-type-source', + }, + }, + { + component: componentTypes.PLAIN_TEXT, + name: 'aws-sources-select-description', + label: , + condition: { + when: 'aws-target-type', + is: 'aws-target-type-source', + }, + }, + { + component: componentTypes.TEXT_FIELD, + name: 'aws-account-id', + className: 'pf-u-w-25', + 'data-testid': 'aws-account-id', + type: 'text', + label: 'AWS account ID', + isRequired: true, + validate: [ + { + type: validatorTypes.REQUIRED, + }, + { + type: validatorTypes.EXACT_LENGTH, + threshold: 12, + }, + ], + condition: { + when: 'aws-target-type', + is: 'aws-target-type-account-id', + }, + }, + { + name: 'gallery-layout', + component: 'gallery-layout', + minWidths: { default: '12.5rem' }, + maxWidths: { default: '12.5rem' }, + fields: [ + { + component: componentTypes.TEXT_FIELD, + name: 'aws-default-region', + value: DEFAULT_AWS_REGION, + 'data-testid': 'aws-default-region', + type: 'text', + label: 'Default Region', + isReadOnly: true, + isRequired: true, + helperText: ( + + + Images are built in the default region but can be copied to + other regions later. + + + ), + }, + { + component: componentTypes.TEXT_FIELD, + name: 'aws-associated-account-id', + 'data-testid': 'aws-associated-account-id', + type: 'text', + label: 'Associated Account ID', + isReadOnly: true, + isRequired: true, + helperText: ( + + + This is the account associated with the source. + + + ), + condition: { + when: 'aws-target-type', + is: 'aws-target-type-source', + }, + }, + { + component: 'field-listener', + name: 'aws-associated-account-id-listener', + hideField: true, + }, + ], + }, + ], +}; diff --git a/src/Components/CreateImageWizard/steps/aws.js b/src/Components/CreateImageWizard/steps/aws.js index 07ec8349..31eb6a3c 100644 --- a/src/Components/CreateImageWizard/steps/aws.js +++ b/src/Components/CreateImageWizard/steps/aws.js @@ -2,13 +2,7 @@ import React from 'react'; import componentTypes from '@data-driven-forms/react-form-renderer/component-types'; import validatorTypes from '@data-driven-forms/react-form-renderer/validator-types'; -import { - Button, - HelperText, - HelperTextItem, - Title, -} from '@patternfly/react-core'; -import { ExternalLinkAltIcon } from '@patternfly/react-icons'; +import { HelperText, HelperTextItem, Title } from '@patternfly/react-core'; import nextStepMapper from './imageOutputStepMapper'; import StepTemplate from './stepTemplate'; @@ -16,22 +10,6 @@ import StepTemplate from './stepTemplate'; import { DEFAULT_AWS_REGION } from '../../../constants'; import CustomButtons from '../formComponents/CustomButtons'; -const SourcesButton = () => { - return ( - - ); -}; - export default { StepTemplate, id: 'wizard-target-aws', @@ -67,54 +45,6 @@ export default {

), }, - { - component: componentTypes.RADIO, - label: 'Share method:', - name: 'aws-target-type', - initialValue: 'aws-target-type-source', - autoFocus: true, - options: [ - { - label: 'Use an account configured from Sources.', - description: - 'Use a configured source to launch environments directly from the console.', - value: 'aws-target-type-source', - 'data-testid': 'aws-radio-source', - autoFocus: true, - }, - { - label: 'Manually enter an account ID.', - value: 'aws-target-type-account-id', - 'data-testid': 'aws-radio-account-id', - className: 'pf-u-mt-sm', - }, - ], - }, - { - component: 'aws-sources-select', - name: 'aws-sources-select', - className: 'pf-u-max-width', - label: 'Source Name', - isRequired: true, - validate: [ - { - type: validatorTypes.REQUIRED, - }, - ], - condition: { - when: 'aws-target-type', - is: 'aws-target-type-source', - }, - }, - { - component: componentTypes.PLAIN_TEXT, - name: 'aws-sources-select-description', - label: , - condition: { - when: 'aws-target-type', - is: 'aws-target-type-source', - }, - }, { component: componentTypes.TEXT_FIELD, name: 'aws-account-id', @@ -123,6 +53,7 @@ export default { type: 'text', label: 'AWS account ID', isRequired: true, + autoFocus: true, validate: [ { type: validatorTypes.REQUIRED, @@ -132,61 +63,29 @@ export default { threshold: 12, }, ], - condition: { - when: 'aws-target-type', - is: 'aws-target-type-account-id', - }, }, { - name: 'gallery-layout', - component: 'gallery-layout', - minWidths: { default: '12.5rem' }, - maxWidths: { default: '12.5rem' }, - fields: [ - { - component: componentTypes.TEXT_FIELD, - name: 'aws-default-region', - value: DEFAULT_AWS_REGION, - 'data-testid': 'aws-default-region', - type: 'text', - label: 'Default Region', - isReadOnly: true, - isRequired: true, - helperText: ( - - - Images are built in the default region but can be copied to - other regions later. - - - ), - }, - { - component: componentTypes.TEXT_FIELD, - name: 'aws-associated-account-id', - 'data-testid': 'aws-associated-account-id', - type: 'text', - label: 'Associated Account ID', - isReadOnly: true, - isRequired: true, - helperText: ( - - - This is the account associated with the source. - - - ), - condition: { - when: 'aws-target-type', - is: 'aws-target-type-source', - }, - }, - { - component: 'field-listener', - name: 'aws-associated-account-id-listener', - hideField: true, - }, - ], + component: componentTypes.TEXT_FIELD, + name: 'aws-default-region', + className: 'pf-u-w-25', + 'data-testid': 'aws-default-region', + type: 'text', + label: 'Default Region', + value: DEFAULT_AWS_REGION, + isReadOnly: true, + isRequired: true, + helperText: ( + + + Images are built in the default region but can be copied to other + regions later. + + + ), }, ], }; diff --git a/src/Components/CreateImageWizard/steps/index.js b/src/Components/CreateImageWizard/steps/index.js index 08a1e7d7..4cb9aac6 100644 --- a/src/Components/CreateImageWizard/steps/index.js +++ b/src/Components/CreateImageWizard/steps/index.js @@ -1,4 +1,5 @@ -export { default as awsTarget } from './aws'; +export { default as awsTargetStable } from './aws'; +export { default as awsTargetBeta } from './aws.beta'; export { default as googleCloudTarger } from './googleCloud'; export { default as msAzureTarget } from './msAzure'; export { default as packages } from './packages';