diff --git a/src/PresentationalComponents/CreateImageWizard/ImageWizardFooter.js b/src/PresentationalComponents/CreateImageWizard/ImageWizardFooter.js index 211bcf60..2923bd0e 100644 --- a/src/PresentationalComponents/CreateImageWizard/ImageWizardFooter.js +++ b/src/PresentationalComponents/CreateImageWizard/ImageWizardFooter.js @@ -14,24 +14,32 @@ const ImageWizardFooter = (props) => { {({ activeStep, onNext, onBack, onClose }) => { let nextButtonText = 'Next'; if (activeStep.name === 'Review') { - nextButtonText = props.disable ? 'Creating...' : 'Create'; + nextButtonText = props.isSaveInProgress ? 'Creating...' : 'Create'; + } + + let nextButtonIsDisabled = props.isSaveInProgress; + + if ((activeStep.name === 'Image output' || activeStep.name === 'Review') && !props.isValidUploadDestination) { + nextButtonIsDisabled = true; } return ( <> - );}} + + ); + }} { props.error && ( @@ -44,7 +52,8 @@ const ImageWizardFooter = (props) => { }; ImageWizardFooter.propTypes = { - disable: PropTypes.bool, + isValidUploadDestination: PropTypes.bool, + isSaveInProgress: PropTypes.bool, error: PropTypes.string, }; diff --git a/src/SmartComponents/CreateImageWizard/CreateImageWizard.js b/src/SmartComponents/CreateImageWizard/CreateImageWizard.js index ac7d7839..2fa620f7 100644 --- a/src/SmartComponents/CreateImageWizard/CreateImageWizard.js +++ b/src/SmartComponents/CreateImageWizard/CreateImageWizard.js @@ -89,7 +89,7 @@ class CreateImageWizard extends Component { packagesFilteredComponents: [], packagesSelectedNames: [], packagesSearchName: '', - onSaveInProgress: false, + isSaveInProgress: false, onSaveError: null, }; } @@ -289,7 +289,7 @@ class CreateImageWizard extends Component { onSave() { this.setState({ - onSaveInProgress: true, + isSaveInProgress: true, }); let requests = []; @@ -398,7 +398,7 @@ class CreateImageWizard extends Component { this.props.history.push('/landing'); }) .catch(err => { - this.setState({ onSaveInProgress: false }); + this.setState({ isSaveInProgress: false }); if (err.response.status === 500) { this.setState({ onSaveError: 'Error: Something went wrong serverside' }); } @@ -410,6 +410,10 @@ class CreateImageWizard extends Component { } render() { + const isValidUploadDestination = this.state.uploadDestinations.aws || + this.state.uploadDestinations.azure || + this.state.uploadDestinations.google; + const StepImageOutput = { name: 'Image output', component: } + footer={ } isOpen /> ); diff --git a/src/test/SmartComponents/CreateImageWizard/CreateImageWizard.test.js b/src/test/SmartComponents/CreateImageWizard/CreateImageWizard.test.js index e2c24476..0daf04b4 100644 --- a/src/test/SmartComponents/CreateImageWizard/CreateImageWizard.test.js +++ b/src/test/SmartComponents/CreateImageWizard/CreateImageWizard.test.js @@ -355,6 +355,10 @@ describe('Step Packages', () => { const { _component, history } = renderWithReduxRouter(); historySpy = jest.spyOn(history, 'push'); + // select aws as upload destination + const awsTile = screen.getByTestId('upload-aws'); + awsTile.click(); + // left sidebar navigation const sidebar = screen.getByRole('navigation'); const anchor = getByText(sidebar, 'Packages');