Wizard: Add beta flag for AWS sources
This commit makes the new AWS sources feature only available in beta. Note that the RTKQ hooks related to AWS sources are called in several places outside of the AWS Target step (a prefetch on the Image Output step and useQuery hook on the review step) but have not been hidden behind beta flags - this should not present any problems and will make exposing this feature in stable much easier when the time comes.
This commit is contained in:
parent
a474163343
commit
53ce67ab47
4 changed files with 221 additions and 126 deletions
|
|
@ -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();
|
||||
|
|
|
|||
192
src/Components/CreateImageWizard/steps/aws.beta.js
Normal file
192
src/Components/CreateImageWizard/steps/aws.beta.js
Normal file
|
|
@ -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 (
|
||||
<Button
|
||||
component="a"
|
||||
target="_blank"
|
||||
variant="link"
|
||||
icon={<ExternalLinkAltIcon />}
|
||||
iconPosition="right"
|
||||
isInline
|
||||
href={'settings/sources'}
|
||||
>
|
||||
Create and manage sources here
|
||||
</Button>
|
||||
);
|
||||
};
|
||||
|
||||
export default {
|
||||
StepTemplate,
|
||||
id: 'wizard-target-aws',
|
||||
title: 'Amazon Web Services',
|
||||
customTitle: (
|
||||
<Title headingLevel="h1" size="xl">
|
||||
Target environment - Amazon Web Services
|
||||
</Title>
|
||||
),
|
||||
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: (
|
||||
<p>
|
||||
Your image will be uploaded to AWS and shared with the account you
|
||||
provide below.
|
||||
</p>
|
||||
),
|
||||
},
|
||||
{
|
||||
component: componentTypes.PLAIN_TEXT,
|
||||
name: 'plain-text-component',
|
||||
label: (
|
||||
<p>
|
||||
<b>The shared image will expire within 14 days.</b> To permanently
|
||||
access the image, copy the image, which will be shared to your account
|
||||
by Red Hat, to your own AWS account.
|
||||
</p>
|
||||
),
|
||||
},
|
||||
{
|
||||
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: <SourcesButton />,
|
||||
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: (
|
||||
<HelperText>
|
||||
<HelperTextItem component="div" variant="indeterminate">
|
||||
Images are built in the default region but can be copied to
|
||||
other regions later.
|
||||
</HelperTextItem>
|
||||
</HelperText>
|
||||
),
|
||||
},
|
||||
{
|
||||
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: (
|
||||
<HelperText>
|
||||
<HelperTextItem component="div" variant="indeterminate">
|
||||
This is the account associated with the source.
|
||||
</HelperTextItem>
|
||||
</HelperText>
|
||||
),
|
||||
condition: {
|
||||
when: 'aws-target-type',
|
||||
is: 'aws-target-type-source',
|
||||
},
|
||||
},
|
||||
{
|
||||
component: 'field-listener',
|
||||
name: 'aws-associated-account-id-listener',
|
||||
hideField: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
|
@ -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 (
|
||||
<Button
|
||||
component="a"
|
||||
target="_blank"
|
||||
variant="link"
|
||||
icon={<ExternalLinkAltIcon />}
|
||||
iconPosition="right"
|
||||
isInline
|
||||
href={'settings/sources'}
|
||||
>
|
||||
Create and manage sources here
|
||||
</Button>
|
||||
);
|
||||
};
|
||||
|
||||
export default {
|
||||
StepTemplate,
|
||||
id: 'wizard-target-aws',
|
||||
|
|
@ -67,54 +45,6 @@ export default {
|
|||
</p>
|
||||
),
|
||||
},
|
||||
{
|
||||
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: <SourcesButton />,
|
||||
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: (
|
||||
<HelperText>
|
||||
<HelperTextItem component="div" variant="indeterminate">
|
||||
Images are built in the default region but can be copied to
|
||||
other regions later.
|
||||
</HelperTextItem>
|
||||
</HelperText>
|
||||
),
|
||||
},
|
||||
{
|
||||
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: (
|
||||
<HelperText>
|
||||
<HelperTextItem component="div" variant="indeterminate">
|
||||
This is the account associated with the source.
|
||||
</HelperTextItem>
|
||||
</HelperText>
|
||||
),
|
||||
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: (
|
||||
<HelperText>
|
||||
<HelperTextItem
|
||||
component="div"
|
||||
variant="indeterminate"
|
||||
className="pf-u-w-25"
|
||||
>
|
||||
Images are built in the default region but can be copied to other
|
||||
regions later.
|
||||
</HelperTextItem>
|
||||
</HelperText>
|
||||
),
|
||||
},
|
||||
],
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue