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-8': 'Red Hat Enterprise Linux (RHEL) 8.3',
'centos-8': 'CentOS Stream 8'
};
const awsReview = (
<>
Account ID
{this.props.uploadAWSErrors['aws-account-id'] ? (
{ this.props.uploadAWSErrors['aws-account-id'].value }
) : (
{this.props.uploadAWS.shareWithAccounts[0]}
)}
>
);
const googleReview = (
<>
{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)}
)}
>);
}
return (
<>
{ (Object.keys(this.props.uploadAWSErrors).length > 0 ||
!this.props.isValidSubscription) &&
}
Review
Review the information and click Create image
to create the image using the following criteria.
Image output
Release
{releaseLabels[this.props.release]}
Target environment
{this.props.uploadDestinations.aws && awsReview }
{this.props.uploadDestinations.google && googleReview }
Registration
Subscription
{ subscriptionReview }
>
);
}
};
function mapStateToProps(state) {
return {
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.string,
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);