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);