diff --git a/src/Components/CreateImageWizard/CreateImageWizard_old.js b/src/Components/CreateImageWizard/CreateImageWizard_old.js deleted file mode 100644 index f710739d..00000000 --- a/src/Components/CreateImageWizard/CreateImageWizard_old.js +++ /dev/null @@ -1,368 +0,0 @@ -import PropTypes from 'prop-types'; -import React, { Component } from 'react'; -import { withRouter } from 'react-router-dom'; -import { connect } from 'react-redux'; -import { actions } from '../../store/actions'; - -import { Button, Wizard } from '@patternfly/react-core'; -import { ExternalLinkAltIcon } from '@patternfly/react-icons'; -import { addNotification } from '@redhat-cloud-services/frontend-components-notifications/redux'; - -import WizardStepImageOutput from './WizardStepImageOutput'; -import WizardStepUploadAWS from './WizardStepUploadAWS'; -import WizardStepUploadAzure from './WizardStepUploadAzure'; -import WizardStepPackages from './WizardStepPackages'; -import WizardStepUploadGoogle from './WizardStepUploadGoogle'; -import WizardStepRegistration from './WizardStepRegistration'; -import WizardStepReview from './WizardStepReview'; -import ImageWizardFooter from './ImageWizardFooter'; - -import './CreateImageWizard.scss'; - -class CreateImageWizard extends Component { - constructor(props) { - super(props); - - this.onStep = this.onStep.bind(this); - this.onSave = this.onSave.bind(this); - this.onClose = this.onClose.bind(this); - this.validate = this.validate.bind(this); - this.validateUploadAmazon = this.validateUploadAmazon.bind(this); - - this.state = { - /* errors take form of $fieldId: error */ - uploadAWSErrors: {}, - uploadAzureErrors: {}, - uploadGoogleErrors: {}, - isSaveInProgress: false, - isValidSubscription: true, - }; - } - - async componentDidMount() { - let user = await insights.chrome.auth.getUser(); - this.setState({ - subscription: { - organization: Number(user.identity.internal.org_id) - } - }); - } - - onStep(step) { - if (step.name === 'Review') { - this.validate(); - } - } - - validate() { - /* upload */ - Object.keys(this.props.uploadDestinations).forEach(provider => { - switch (provider) { - case 'aws': - this.validateUploadAmazon(); - break; - case 'azure': - this.validateUploadAzure(); - break; - case 'google': - break; - default: - break; - } - }); - /* subscription */ - if (this.props.subscribeNow) { - this.setState({ isValidSubscription: this.props.subscription.activationKey ? true : false }); - } else { - this.setState({ isValidSubscription: true }); - } - } - - validateUploadAmazon() { - let uploadAWSErrors = {}; - let share = this.props.uploadAWS.shareWithAccounts; - if (share.length === 0 || share[0].length !== 12 || isNaN(share[0])) { - uploadAWSErrors['aws-account-id'] = - { label: 'AWS account ID', value: 'A 12-digit number is required' }; - } - - this.setState({ uploadAWSErrors }); - } - - validateUploadAzure() { - let uploadAzureErrors = {}; - - let tenant_id = this.props.uploadAzure.tenantId; - if (tenant_id === null || tenant_id === '') { - uploadAzureErrors['azure-resource-group'] = - { label: 'Azure tenant ID', value: 'A tenant ID is required' }; - } - - let subscriptionId = this.props.uploadAzure.subscriptionId; - if (subscriptionId === null || subscriptionId === '') { - uploadAzureErrors['azure-subscription-id'] = - { label: 'Azure subscription ID', value: 'A subscription ID is required' }; - } - - let resource_group = this.props.uploadAzure.resourceGroup; - if (resource_group === null || resource_group === '') { - uploadAzureErrors['azure-resource-group'] = - { label: 'Azure resource group', value: 'A resource group is required' }; - } - // TODO check oauth2 thing too here? - } - - onSave() { - this.setState({ isSaveInProgress: true }); - - let customizations = { - packages: this.props.selectedPackages.map(p => p.name), - }; - if (this.props.subscribeNow) { - customizations.subscription = { - 'activation-key': this.props.subscription.activationKey, - insights: this.props.subscription.insights, - organization: Number(this.props.subscription.organization), - 'server-url': 'subscription.rhsm.redhat.com', - 'base-url': 'https://cdn.redhat.com/', - }; - } - - let requests = []; - if (this.props.uploadDestinations.aws) { - let request = { - distribution: this.props.release.distro, - image_requests: [ - { - architecture: this.props.release.arch, - image_type: 'ami', - upload_request: { - type: 'aws', - options: { - share_with_accounts: this.props.uploadAWS.shareWithAccounts, - }, - }, - }], - customizations, - }; - requests.push(request); - } - - if (this.props.uploadDestinations.google) { - let share = ''; - switch (this.props.uploadGoogle.accountType) { - case 'googleAccount': - share = 'user:' + this.props.uploadGoogle.shareWithAccounts[0].user; - break; - case 'serviceAccount': - share = 'serviceAccount:' + this.props.uploadGoogle.shareWithAccounts[0].serviceAccount; - break; - case 'googleGroup': - share = 'group:' + this.props.uploadGoogle.shareWithAccounts[0].group; - break; - case 'domain': - share = 'domain:' + this.props.uploadGoogle.shareWithAccounts[0].domain; - break; - } - - let request = { - distribution: this.props.release.distro, - image_requests: [ - { - architecture: this.props.release.arch, - image_type: 'vhd', - upload_request: { - type: 'gcp', - options: { - share_with_accounts: [ share ], - }, - }, - }], - customizations, - }; - - requests.push(request); - } - - if (this.props.uploadDestinations.azure) { - let request = { - distribution: this.props.release.distro, - image_requests: [ - { - architecture: this.props.release.arch, - image_type: 'vhd', - upload_request: { - type: 'azure', - options: { - tenant_id: this.props.uploadAzure.tenantId, - subscription_id: this.props.uploadAzure.subscriptionId, - resource_group: this.props.uploadAzure.resourceGroup, - }, - }, - }], - customizations, - }; - requests.push(request); - } - - const composeRequests = requests.map(request => this.props.composeStart(request)); - - Promise.all(composeRequests) - .then(() => { - if (!this.props.composesError) { - this.props.addNotification({ - variant: 'success', - title: 'Your image is being created', - }); - this.props.history.push('/landing'); - } - - this.setState({ isSaveInProgress: false }); - }); - } - - onClose () { - this.props.history.push('/landing'); - } - - render() { - const isValidUploadDestination = this.props.uploadDestinations.aws || - this.props.uploadDestinations.azure || - this.props.uploadDestinations.google; - - const StepImageOutput = { - name: 'Image output', - component: - }; - - const StepUploadAWS = { - name: 'Amazon Web Services', - component: - }; - - const StepUploadAzure = { - name: 'Microsoft Azure', - component: - }; - - const StepUploadGoogle = { - name: 'Google Cloud Platform', - component: - }; - - const uploadDestinationSteps = []; - if (this.props.uploadDestinations.aws) { - uploadDestinationSteps.push(StepUploadAWS); - } - - if (this.props.uploadDestinations.azure) { - uploadDestinationSteps.push(StepUploadAzure); - } - - if (this.props.uploadDestinations.google) { - uploadDestinationSteps.push(StepUploadGoogle); - } - - const StepTargetEnv = { - name: 'Target environment', - steps: uploadDestinationSteps - }; - - const steps = [ - StepImageOutput, - ...(StepTargetEnv.steps.length > 0 ? [ StepTargetEnv ] : []), - { - name: 'Registration', - component: }, - { - name: 'Packages', - component: }, - { - name: 'Review', - component: , - nextButtonText: 'Create', - } - ]; - - return ( - - - Create a RHEL image and push it to cloud providers. - {' '} - - } - onNext={ this.onStep } - onGoToStep={ this.onStep } - steps={ steps } - onClose={ this.onClose } - onSave={ this.onSave } - footer={ } - isOpen /> - - ); - } -} - -function mapStateToProps(state) { - return { - composesError: state.composes.error, - release: state.pendingCompose.release, - uploadDestinations: state.pendingCompose.uploadDestinations, - uploadAWS: state.pendingCompose.uploadAWS, - uploadAzure: state.pendingCompose.uploadAzure, - uploadGoogle: state.pendingCompose.uploadGoogle, - selectedPackages: state.pendingCompose.selectedPackages, - subscription: state.pendingCompose.subscription, - subscribeNow: state.pendingCompose.subscribeNow, - }; -} - -function mapDispatchToProps(dispatch) { - return { - composeUpdated: (compose) => dispatch(actions.composeUpdated(compose)), - composeStart: (composeRequest) => dispatch(actions.composeStart(composeRequest)), - addNotification: (not) => dispatch(addNotification(not)), - }; -} - -CreateImageWizard.propTypes = { - composesError: PropTypes.string, - composeUpdated: PropTypes.func, - composeStart: PropTypes.func, - addNotification: PropTypes.func, - history: PropTypes.object, - release: PropTypes.object, - uploadDestinations: PropTypes.object, - uploadAWS: PropTypes.object, - uploadAzure: PropTypes.object, - uploadGoogle: PropTypes.object, - subscription: PropTypes.object, - subscribeNow: PropTypes.bool, - selectedPackages: PropTypes.array, -}; - -export default connect(mapStateToProps, mapDispatchToProps)(withRouter(CreateImageWizard)); diff --git a/src/Components/CreateImageWizard/ImageWizardFooter.js b/src/Components/CreateImageWizard/ImageWizardFooter.js deleted file mode 100644 index fefa0ec3..00000000 --- a/src/Components/CreateImageWizard/ImageWizardFooter.js +++ /dev/null @@ -1,65 +0,0 @@ -import React from 'react'; -import PropTypes from 'prop-types'; - -import { Button, ButtonVariant, Text, TextContent, WizardContextConsumer, WizardFooter } from '@patternfly/react-core'; -import { ExclamationCircleIcon } from '@patternfly/react-icons'; - -import './ImageWizardFooter.scss'; - -const ImageWizardFooter = (props) => { - return ( - <> - - - {({ activeStep, onNext, onBack, onClose }) => { - let nextButtonText = 'Next'; - if (activeStep.name === 'Review') { - nextButtonText = props.isSaveInProgress ? 'Creating...' : 'Create'; - } - - let nextButtonIsDisabled = props.isSaveInProgress; - - if ((activeStep.name === 'Image output' || activeStep.name === 'Review') && !props.isValidUploadDestination) { - nextButtonIsDisabled = true; - } - - if ((activeStep.name === 'Registration' || activeStep.name === 'Review') && !props.isValidSubscription) { - nextButtonIsDisabled = true; - } - - return ( - <> - - - - - ); - }} - - { props.error && ( - - {props.error} - - )} - - - ); -}; - -ImageWizardFooter.propTypes = { - isValidUploadDestination: PropTypes.bool, - isSaveInProgress: PropTypes.bool, - isValidSubscription: PropTypes.bool, - error: PropTypes.string, -}; - -export default ImageWizardFooter; diff --git a/src/Components/CreateImageWizard/ImageWizardFooter.scss b/src/Components/CreateImageWizard/ImageWizardFooter.scss deleted file mode 100644 index dcf20e1a..00000000 --- a/src/Components/CreateImageWizard/ImageWizardFooter.scss +++ /dev/null @@ -1,4 +0,0 @@ -.footer-error { - flex-basis: 100%; - color: var(--pf-global--palette--red-100); -} diff --git a/src/Components/CreateImageWizard/WizardStepImageOutput.js b/src/Components/CreateImageWizard/WizardStepImageOutput.js deleted file mode 100644 index 8567cfc8..00000000 --- a/src/Components/CreateImageWizard/WizardStepImageOutput.js +++ /dev/null @@ -1,109 +0,0 @@ -import React, { Component } from 'react'; -import PropTypes from 'prop-types'; -import { connect } from 'react-redux'; -import { actions } from '../../store/actions'; - -import { Form, FormGroup, FormSelect, FormSelectOption, Tile, Title } from '@patternfly/react-core'; - -import './WizardStepImageOutput.scss'; - -class WizardStepImageOutput extends Component { - constructor(props) { - super(props); - - this.setDistro = this.setDistro.bind(this); - this.toggleUploadDestination = this.toggleUploadDestination.bind(this); - } - - setDistro(distro) { - this.props.setRelease({ arch: 'x86_64', distro }); - } - - toggleUploadDestination(provider) { - this.props.setUploadDestinations({ - ...this.props.uploadDestinations, - [provider]: !this.props.uploadDestinations[provider] - }); - } - - render() { - const releaseOptions = [ - { value: 'rhel-84', label: 'Red Hat Enterprise Linux (RHEL) 8' }, - { value: 'centos-8', label: 'CentOS Stream 8' }, - ]; - - return ( - <> -
- Image output - - this.setDistro(value) } isRequired - aria-label="Select release input" id="release-select" data-testid="release-select"> - { releaseOptions.map(option => ) } - - - -
- } - onClick={ () => this.toggleUploadDestination('aws') } - isSelected={ this.props.uploadDestinations.aws } - isStacked - isDisplayLarge /> - } - onClick={ () => this.toggleUploadDestination('google') } - isSelected={ this.props.uploadDestinations.google } - isStacked - isDisplayLarge /> - } - onClick={ () => this.toggleUploadDestination('azure') } - isSelected={ this.props.uploadDestinations.azure } - isStacked - isDisplayLarge /> -
-
-
- - ); - } -}; - -function mapStateToProps(state) { - return { - release: state.pendingCompose.release, - uploadDestinations: state.pendingCompose.uploadDestinations, - }; -} - -function mapDispatchToProps(dispatch) { - return { - setRelease: i => dispatch(actions.setRelease(i)), - setUploadDestinations: d => dispatch(actions.setUploadDestinations(d)), - }; -} - -WizardStepImageOutput.propTypes = { - setRelease: PropTypes.func, - setUploadDestinations: PropTypes.func, - release: PropTypes.object, - uploadDestinations: PropTypes.object, -}; - -export default connect(mapStateToProps, mapDispatchToProps)(WizardStepImageOutput); diff --git a/src/Components/CreateImageWizard/WizardStepImageOutput.scss b/src/Components/CreateImageWizard/WizardStepImageOutput.scss deleted file mode 100644 index a30ac36a..00000000 --- a/src/Components/CreateImageWizard/WizardStepImageOutput.scss +++ /dev/null @@ -1,26 +0,0 @@ -.tiles { - display: flex; -} - -.tile { - flex: 1 0 0px; -} - -.pf-c-tile:focus { - --pf-c-tile__title--Color: var(--pf-c-tile__title--Color); - --pf-c-tile__icon--Color: var(---pf-global--Color--100); - --pf-c-tile--before--BorderWidth: var(--pf-global--BorderWidth--sm); - --pf-c-tile--before--BorderColor: var(--pf-global--BorderColor--100); -} - -.pf-c-tile.pf-m-selected:focus { - --pf-c-tile__title--Color: var(--pf-c-tile--focus__title--Color); - --pf-c-tile__icon--Color: var(--pf-c-tile--focus__icon--Color); - --pf-c-tile--before--BorderWidth: var(--pf-c-tile--focus--before--BorderWidth); - --pf-c-tile--before--BorderColor: var(--pf-c-tile--focus--before--BorderColor); -} - -.provider-icon { - width: 1em; - height: 1em; -} diff --git a/src/Components/CreateImageWizard/WizardStepPackages.js b/src/Components/CreateImageWizard/WizardStepPackages.js deleted file mode 100644 index cf526d67..00000000 --- a/src/Components/CreateImageWizard/WizardStepPackages.js +++ /dev/null @@ -1,132 +0,0 @@ -import React, { Component } from 'react'; -import PropTypes from 'prop-types'; -import { connect } from 'react-redux'; -import { Button, DualListSelector, Text, TextContent, Title } from '@patternfly/react-core'; - -import { actions } from '../../store/actions'; -import api from '../../api.js'; - -import './WizardStepPackages.scss'; -class WizardStepPackages extends Component { - constructor(props) { - super(props); - - this.setPackagesSearchName = this.setPackagesSearchName.bind(this); - this.handlePackagesSearch = this.handlePackagesSearch.bind(this); - this.handlePackagesFilter = this.handlePackagesFilter.bind(this); - this.packageListChange = this.packageListChange.bind(this); - this.mapPackagesToComponent = this.mapPackagesToComponent.bind(this); - - const comps = this.mapPackagesToComponent(this.props.selectedPackages); - this.state = { - packagesAvailableComponents: [], - packagesSelectedComponents: comps, - packagesFilteredComponents: comps, - packagesSearchName: '', - }; - } - - setPackagesSearchName(packagesSearchName) { - this.setState({ packagesSearchName }); - } - - mapPackagesToComponent(packages) { - return packages.map((pack) => - - { pack.name } - { pack.summary } - - ); - } - - // this digs into the component properties to extract the package - mapComponentToPackage(component) { - return { name: component.props.children[0].props.children, summary: component.props.children[1].props.children }; - } - - handlePackagesSearch() { - api.getPackages(this.props.release.distro, this.props.release.arch, this.state.packagesSearchName).then(response => { - const packageComponents = this.mapPackagesToComponent(response.data); - this.setState({ - packagesAvailableComponents: packageComponents - }); - }); - }; - - handlePackagesFilter(filter) { - const filteredPackages = this.state.packagesSelectedComponents.filter(component => { - return this.mapComponentToPackage(component).name.includes(filter); - }); - this.setState({ - packagesFilteredComponents: filteredPackages - }); - } - - packageListChange(newAvailablePackages, newChosenPackages) { - const chosenPkgs = newChosenPackages.map(component => this.mapComponentToPackage(component)); - this.setState({ - packagesAvailableComponents: newAvailablePackages, - packagesSelectedComponents: newChosenPackages, - packagesFilteredComponents: newChosenPackages, - }); - - this.props.setSelectedPackages(chosenPkgs); - } - - render() { - const availableOptionsActions = [ - - ]; - return ( - <> - - Additional packages - Add optional additional packages to your image by searching available packages. - - true } - id="basicSelectorWithSearch" /> - - ); - } -}; - -function mapStateToProps(state) { - return { - release: state.pendingCompose.release, - selectedPackages: state.pendingCompose.selectedPackages, - }; -} - -function mapDispatchToProps(dispatch) { - return { - setSelectedPackages: (p) => dispatch(actions.setSelectedPackages(p)), - }; -} - -WizardStepPackages.propTypes = { - release: PropTypes.object, - selectedPackages: PropTypes.array, - setSelectedPackages: PropTypes.func, -}; - -export default connect(mapStateToProps, mapDispatchToProps)(WizardStepPackages); diff --git a/src/Components/CreateImageWizard/WizardStepPackages.scss b/src/Components/CreateImageWizard/WizardStepPackages.scss deleted file mode 100644 index 88d7d724..00000000 --- a/src/Components/CreateImageWizard/WizardStepPackages.scss +++ /dev/null @@ -1,3 +0,0 @@ -.pf-c-dual-list-selector__menu { - --pf-c-dual-list-selector__menu--MinHeight: 17.5rem -} diff --git a/src/Components/CreateImageWizard/WizardStepRegistration.js b/src/Components/CreateImageWizard/WizardStepRegistration.js deleted file mode 100644 index 8b1e4fd9..00000000 --- a/src/Components/CreateImageWizard/WizardStepRegistration.js +++ /dev/null @@ -1,81 +0,0 @@ -import React, { Component } from 'react'; -import PropTypes from 'prop-types'; -import { connect } from 'react-redux'; -import { Form, FormGroup, TextInput, Radio, Title } from '@patternfly/react-core'; - -import { actions } from '../../store/actions'; - -class WizardStepRegistration extends Component { - constructor(props) { - super(props); - - } - - async componentDidMount() { - let user = await insights.chrome.auth.getUser(); - this.props.setSubscription(Object.assign(this.props.subscription, { organization: user.identity.internal.org_id })); - } - - render() { - return ( -
- Registration - - this.props.setSubscribeNow(true) } - data-testid="register-now-radio-button" /> - this.props.setSubscribeNow(false) } - data-testid="register-later-radio-button" /> - - { this.props.subscribeNow && - <> - - - - - this.props.setSubscription(Object.assign(this.props.subscription, { activationKey })) } - validated={ !this.props.isValidSubscription && this.props.subscription.activationKey !== null ? 'error' : 'default' } - isRequired /> - - } -
- ); - } -}; - -function mapStateToProps(state) { - return { - subscription: state.pendingCompose.subscription, - subscribeNow: state.pendingCompose.subscribeNow, - }; -} - -function mapDispatchToProps(dispatch) { - return { - setSubscription: s => dispatch(actions.setSubscription(s)), - setSubscribeNow: s => dispatch(actions.setSubscribeNow(s)), - }; -} - -WizardStepRegistration.propTypes = { - setSubscription: PropTypes.func, - setSubscribeNow: PropTypes.func, - subscription: PropTypes.object, - subscribeNow: PropTypes.bool, - isValidSubscription: PropTypes.bool, -}; - -export default connect(mapStateToProps, mapDispatchToProps)(WizardStepRegistration); diff --git a/src/Components/CreateImageWizard/WizardStepReview.js b/src/Components/CreateImageWizard/WizardStepReview.js deleted file mode 100644 index f3dd9f9b..00000000 --- a/src/Components/CreateImageWizard/WizardStepReview.js +++ /dev/null @@ -1,162 +0,0 @@ -import React, { Component } from 'react'; -import PropTypes from 'prop-types'; -import { connect } from 'react-redux'; - -import { - Alert, - Text, TextVariants, TextContent, TextList, TextListVariants, TextListItem, TextListItemVariants, - Title -} from '@patternfly/react-core'; -import { ExclamationCircleIcon } from '@patternfly/react-icons'; - -import './WizardStepReview.scss'; - -class WizardStepReview extends Component { - constructor(props) { - super(props); - } - - render() { - const releaseLabels = { - 'rhel-84': 'Red Hat Enterprise Linux (RHEL) 8', - 'centos-8': 'CentOS Stream 8' - }; - - const awsReview = ( - <> - Amazon Web Services - - Account ID - {this.props.uploadAWSErrors['aws-account-id'] ? ( - - { this.props.uploadAWSErrors['aws-account-id'].value } - - ) : ( - {this.props.uploadAWS.shareWithAccounts[0]} - )} - - - ); - - const googleReview = ( - <> - Google Cloud Platform - - {this.props.uploadGoogle.accountType === 'googleAccount' && ( - <> - Google account - {this.props.uploadGoogle.shareWithAccounts[0] ? - this.props.uploadGoogle.shareWithAccounts[0].user || '' : - ''} - - - )} - {this.props.uploadGoogle.accountType === 'serviceAccount' && ( - <> - Service account - {this.props.uploadGoogle.shareWithAccounts[0] ? - this.props.uploadGoogle.shareWithAccounts[0].serviceAccount || '' : - ''} - - - )} - {this.props.uploadGoogle.accountType === 'googleGroup' && ( - <> - Google group - {this.props.uploadGoogle.shareWithAccounts[0] ? - this.props.uploadGoogle.shareWithAccounts[0].group || '' : - ''} - - - )} - {this.props.uploadGoogle.accountType === 'domain' && ( - <> - Domain - {this.props.uploadGoogle.shareWithAccounts[0] ? - this.props.uploadGoogle.shareWithAccounts[0].domain || '' : - ''} - - - )} - - - ); - - let subscriptionReview = Register the system later; - if (this.props.subscribeNow) { - subscriptionReview = (<> - Register the system on first boot - Activation key - { !this.props.isValidSubscription || !this.props.subscription.activationKey ? ( - - { 'A value is required' } - - ) : ( - - {'*'.repeat(this.props.subscription.activationKey.length)} - - )} - ); - } - - const registrationReview = ( - <> - Registration - - Subscription - { subscriptionReview } - - - ); - - return ( - <> - { (Object.keys(this.props.uploadAWSErrors).length > 0 || - !this.props.isValidSubscription) && - } - Review - - - Review the information and click the Create button - to create your image using the following criteria. - - Image output - - Release - {releaseLabels[this.props.release.distro]} - - Target environment - {this.props.uploadDestinations.aws && awsReview } - {this.props.uploadDestinations.google && googleReview } - {this.props.release.distro === 'rhel-84' && registrationReview } - - - ); - } -}; - -function mapStateToProps(state) { - return { - release: state.pendingCompose.release, - uploadDestinations: state.pendingCompose.uploadDestinations, - uploadAWS: state.pendingCompose.uploadAWS, - uploadAzure: state.pendingCompose.uploadAzure, - uploadGoogle: state.pendingCompose.uploadGoogle, - subscribeNow: state.pendingCompose.subscribeNow, - subscription: state.pendingCompose.subscription, - }; -} - -WizardStepReview.propTypes = { - release: PropTypes.object, - uploadAWS: PropTypes.object, - uploadGoogle: PropTypes.object, - uploadDestinations: PropTypes.object, - uploadAzure: PropTypes.object, - subscription: PropTypes.object, - subscribeNow: PropTypes.bool, - uploadAWSErrors: PropTypes.object, - isValidSubscription: PropTypes.bool, -}; - -export default connect(mapStateToProps, null)(WizardStepReview); diff --git a/src/Components/CreateImageWizard/WizardStepReview.scss b/src/Components/CreateImageWizard/WizardStepReview.scss deleted file mode 100644 index 43bf9a9c..00000000 --- a/src/Components/CreateImageWizard/WizardStepReview.scss +++ /dev/null @@ -1,21 +0,0 @@ -.error { - color: var(--pf-global--danger-color--100); - } -// Increasing margins for h3 for better spacing and readability -.textcontent-review h3 { - margin-top: var(--pf-global--spacer--xl); -} -// Decreasing gap between dl items for better spacing and readability -// Also setting a first column width to 25% instead of auto, -// to guarantee the same width for each section. -@media screen and (min-width: 576px) { - .textcontent-review dl { - grid-template: 1fr / 25% 1fr; - grid-gap: var(--pf-global--spacer--sm); - } -} - -#destination-header { - font-size: 18px; - margin-bottom: var(--pf-global--spacer--sm); -} diff --git a/src/Components/CreateImageWizard/WizardStepUploadAWS.js b/src/Components/CreateImageWizard/WizardStepUploadAWS.js deleted file mode 100644 index 62417dfc..00000000 --- a/src/Components/CreateImageWizard/WizardStepUploadAWS.js +++ /dev/null @@ -1,54 +0,0 @@ -import React, { Component } from 'react'; -import PropTypes from 'prop-types'; -import { connect } from 'react-redux'; -import { actions } from '../../store/actions'; - -import { Form, FormGroup, TextInput, Title } from '@patternfly/react-core'; - -class WizardStepUploadAWS extends Component { - constructor(props) { - super(props); - } - - render() { - return ( -
- Target Environment - Amazon Web Services -

- Your image will be uploaded to a temporary account on Amazon Web Services.
- The image will be shared with the account you provide below.
- Within the next 14 days you will need to copy the shared image to your own account. - After 14 days it will be unavailable and will have to be regenerated. -

- - this.props.setUploadAWS({ shareWithAccounts: [ value ]}) } /> - -
- ); - } -}; - -function mapStateToProps(state) { - return { - uploadAWS: state.pendingCompose.uploadAWS, - }; -} - -function mapDispatchToProps(dispatch) { - return { - setUploadAWS: u => dispatch(actions.setUploadAWS(u)), - }; -} - -WizardStepUploadAWS.propTypes = { - setUploadAWS: PropTypes.func, - uploadAWS: PropTypes.object, - errors: PropTypes.object, -}; - -export default connect(mapStateToProps, mapDispatchToProps)(WizardStepUploadAWS); diff --git a/src/Components/CreateImageWizard/WizardStepUploadAzure.js b/src/Components/CreateImageWizard/WizardStepUploadAzure.js deleted file mode 100644 index b881262b..00000000 --- a/src/Components/CreateImageWizard/WizardStepUploadAzure.js +++ /dev/null @@ -1,107 +0,0 @@ -import React, { Component } from 'react'; -import PropTypes from 'prop-types'; -import { connect } from 'react-redux'; -import { actions } from '../../store/actions'; - -import { Button, Form, FormGroup, Text, TextContent, TextInput, Title } from '@patternfly/react-core'; -import { ExternalLinkAltIcon } from '@patternfly/react-icons'; - -import './WizardStepUploadAzure.scss'; - -class WizardStepUploadAzure extends Component { - constructor(props) { - super(props); - } - - render() { - return ( - <> - - Target Environment - Microsoft Azure - - Image Builder will send an image to an authorized Azure account. - - OAuth permissions - - To authorize Image Builder to push images to Microsoft Azure, the account owner - must configure Image Builder as an authorized application and give it the role of - "Contributor" to at least one resource group.
-
- - - - - Authorize Image Builder on Azure - -
- Destination - - Your image will be uploaded to the resource group in the subscription you specify. - -
-
- - - this.props.setUploadAzure(Object.assign(this.props.uploadAzure, { tenantId: value })) } /> - - - - this.props.setUploadAzure(Object.assign(this.props.uploadAzure, { subscriptionId: value })) } /> - - - - this.props.setUploadAzure(Object.assign(this.props.uploadAzure, { resourceGroup: value })) } /> - -
- - ); - } -}; - -function mapStateToProps(state) { - return { - uploadAzure: state.pendingCompose.uploadAzure, - }; -} - -function mapDispatchToProps(dispatch) { - return { - setUploadAzure: u => dispatch(actions.setUploadAzure(u)), - }; -} - -WizardStepUploadAzure.propTypes = { - setUploadAzure: PropTypes.func, - uploadAzure: PropTypes.object, - errors: PropTypes.object, -}; - -export default connect(mapStateToProps, mapDispatchToProps)(WizardStepUploadAzure); diff --git a/src/Components/CreateImageWizard/WizardStepUploadAzure.scss b/src/Components/CreateImageWizard/WizardStepUploadAzure.scss deleted file mode 100644 index 6e93139b..00000000 --- a/src/Components/CreateImageWizard/WizardStepUploadAzure.scss +++ /dev/null @@ -1,11 +0,0 @@ -.textcontent-azure { - margin-bottom: var(--pf-global--spacer--lg); - h3, h4 { - margin-top: var(--pf-global--spacer--sm); - margin-bottom: var(--pf-global--spacer--xs); - } - p { - margin-bottom: 0; - } -} - diff --git a/src/Components/CreateImageWizard/WizardStepUploadGoogle.js b/src/Components/CreateImageWizard/WizardStepUploadGoogle.js deleted file mode 100644 index 0b7877b2..00000000 --- a/src/Components/CreateImageWizard/WizardStepUploadGoogle.js +++ /dev/null @@ -1,166 +0,0 @@ -import React, { Component } from 'react'; -import PropTypes from 'prop-types'; -import { connect } from 'react-redux'; -import { actions } from '../../store/actions'; - -import { Form, FormGroup, TextList, TextListItem, Popover, Radio, TextContent, Text, TextInput, Title } from '@patternfly/react-core'; -import { HelpIcon } from '@patternfly/react-icons'; -import './WizardStepUploadGoogle.scss'; - -const accountTypePopover = ( - - The following account types can have an image shared with them: - - - Google account: A Google account represents a developer, an administrator, - or any other person who interacts with Google Cloud. e.g., `alice@gmail.com`. - - - Service account: A service account is an account for an application instead - of an individual end user. e.g., `myapp@appspot.gserviceaccount.com`. - - - Google group: A Google group is a named collection of Google accounts and - and service accounts. e.g., `admins@example.com`. - - - Google workspace domain/Cloud identity domain: A Google workspace or cloud identity - domain represents a virtual group of all the Google accounts in an organization. These domains - represent your organization's internet domain name. e.g., `mycompany.com`. - - - }> - - -); - -class WizardStepUploadGoogle extends Component { - constructor(props) { - super(props); - } - - render() { - return ( - <> - - Target Environment - Google Cloud Platform - - Your image will be uploaded to Google Cloud Platform and shared with the email you provide below.
- The image should be copied to your account within 14 days. -
-
-
- - this.props.setUploadGoogle({ accountType: 'googleAccount', shareWithAccounts: [{ user: null }]}) } - isChecked={ this.props.uploadGoogle.accountType === 'googleAccount' } - label="Google account" - id="radio-google-account" - value="googleAccount" /> - - this.props.setUploadGoogle({ accountType: 'serviceAccount', shareWithAccounts: [{ serviceAccount: null }]}) } - isChecked={ this.props.uploadGoogle.accountType === 'serviceAccount' } - label="Service account" - id="radio-service-account" - value="serviceAccount" /> - this.props.setUploadGoogle({ accountType: 'googleGroup', shareWithAccounts: [{ group: null }]}) } - isChecked={ this.props.uploadGoogle.accountType === 'googleGroup' } - label="Google group" - id="radio-google-group" - value="googleGroup" /> - this.props.setUploadGoogle({ accountType: 'domain', shareWithAccounts: [{ domain: null }]}) } - isChecked={ this.props.uploadGoogle.accountType === 'domain' } - label="Google Workspace Domain or Cloud Identity Domain" - id="radio-domain" - value="domain" /> - - {this.props.uploadGoogle.accountType === 'googleAccount' && ( - - this.props.setUploadGoogle( - { accountType: 'googleAccount', shareWithAccounts: [{ user: value }]} - ) } /> - - )} - {this.props.uploadGoogle.accountType === 'serviceAccount' && ( - - this.props.setUploadGoogle( - { accountType: 'serviceAccount', shareWithAccounts: [{ serviceAccount: value }]} - ) } /> - - )} - {this.props.uploadGoogle.accountType === 'googleGroup' && ( - - this.props.setUploadGoogle( - { accountType: 'googleGroup', shareWithAccounts: [{ group: value }]} - ) } /> - - )} - {this.props.uploadGoogle.accountType === 'domain' && ( - - this.props.setUploadGoogle( - { accountType: 'domain', shareWithAccounts: [{ domain: value }]} - ) } /> - - )} -
- - ); - } -}; - -function mapStateToProps(state) { - return { - uploadGoogle: state.pendingCompose.uploadGoogle, - }; -} - -function mapDispatchToProps(dispatch) { - return { - setUploadGoogle: u => dispatch(actions.setUploadGoogle(u)), - }; -} - -WizardStepUploadGoogle.propTypes = { - setUploadGoogle: PropTypes.func, - uploadGoogle: PropTypes.object, - errors: PropTypes.object, -}; - -export default connect(mapStateToProps, mapDispatchToProps)(WizardStepUploadGoogle); diff --git a/src/Components/CreateImageWizard/WizardStepUploadGoogle.scss b/src/Components/CreateImageWizard/WizardStepUploadGoogle.scss deleted file mode 100644 index b3ea92ee..00000000 --- a/src/Components/CreateImageWizard/WizardStepUploadGoogle.scss +++ /dev/null @@ -1,8 +0,0 @@ -.pf-c-radio { - --pf-c-radio__label--LineHeight: 32px; - --pf-c-radio__input--Height: 32px; -} - -.textcontent-google { - margin-bottom: var(--pf-global--spacer--lg); -} diff --git a/src/test/Components/CreateImageWizard/CreateImageWizard.test.js b/src/test/Components/CreateImageWizard/CreateImageWizard.test.js index 0f82b51a..33e13bad 100644 --- a/src/test/Components/CreateImageWizard/CreateImageWizard.test.js +++ b/src/test/Components/CreateImageWizard/CreateImageWizard.test.js @@ -558,10 +558,11 @@ describe('Click through all steps', () => { const composeImage = jest .spyOn(api, 'composeImage') .mockImplementation(body => { + console.log(body, 'huuuh!'); let id; if (body.image_requests[0].upload_request.type === 'aws') { expect(body).toEqual({ - distribution: 'rhel-84', + distribution: 'rhel-8', image_requests: [{ architecture: 'x86_64', image_type: 'ami', @@ -586,7 +587,7 @@ describe('Click through all steps', () => { id = 'edbae1c2-62bc-42c1-ae0c-3110ab718f56'; } else if (body.image_requests[0].upload_request.type === 'gcp') { expect(body).toEqual({ - distribution: 'rhel-84', + distribution: 'rhel-8', image_requests: [{ architecture: 'x86_64', image_type: 'vhd', @@ -611,7 +612,7 @@ describe('Click through all steps', () => { id = 'edbae1c2-62bc-42c1-ae0c-3110ab718f57'; } else if (body.image_requests[0].upload_request.type === 'azure') { expect(body).toEqual({ - distribution: 'rhel-84', + distribution: 'rhel-8', image_requests: [{ architecture: 'x86_64', image_type: 'vhd',