diff options
Diffstat (limited to 'openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments')
2 files changed, 62 insertions, 33 deletions
diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachments.js b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachments.js index 234953ec3b..d942172973 100644 --- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachments.js +++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachments.js @@ -1,5 +1,5 @@ /*! - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright © 2016-2018 European Support Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -55,7 +55,8 @@ export const mapStateToProps = (state) => { HeatSetupComponent: HeatSetup, version, onboardingOrigin, - activeTab + activeTab, + candidateInProcess: !!currentSoftwareProduct.candidateOnboardingOrigin }; }; @@ -67,6 +68,8 @@ export const mapActionsToProps = (dispatch, {softwareProductId, version}) => { data:{ msg: i18n('Upload will erase existing data. Do you want to continue?'), confirmationButtonText: i18n('Continue'), + title: i18n('WARNING'), + onConfirmed: ()=>SoftwareProductActionHelper.uploadFile(dispatch, { softwareProductId, formData, @@ -75,6 +78,15 @@ export const mapActionsToProps = (dispatch, {softwareProductId, version}) => { }) } }), + onUploadAbort: () => { + SoftwareProductActionHelper.abortCandidateValidation(dispatch, {softwareProductId, version}) + .then(()=>{ + ScreensHelper.loadScreen(dispatch, { + screen: enums.SCREEN.SOFTWARE_PRODUCT_LANDING_PAGE, screenType: screenTypes.SOFTWARE_PRODUCT, + props: {softwareProductId, version} + }); + }); + }, onInvalidFileUpload: () => dispatch({ type: modalActionTypes.GLOBAL_MODAL_ERROR, data: { diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsView.jsx b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsView.jsx index a23015732b..90dd7692bf 100644 --- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsView.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsView.jsx @@ -1,5 +1,5 @@ /*! - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright © 2016-2018 European Support Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,6 +21,7 @@ import {tabsMapping} from './SoftwareProductAttachmentsConstants.js'; import i18n from 'nfvo-utils/i18n/i18n.js'; import HeatValidation from './validation/HeatValidation.js'; import {onboardingOriginTypes} from 'sdc-app/onboarding/softwareProduct/SoftwareProductConstants.js'; +import Button from 'sdc-ui/lib/react/Button.js'; class HeatScreenView extends Component { @@ -30,40 +31,56 @@ class HeatScreenView extends Component { setActiveTab: PropTypes.func }; + componentDidMount() { + if (!this.props.goToOverview && this.props.candidateInProcess) { + this.props.setActiveTab({activeTab: tabsMapping.VALIDATION}); + } + } + render() { - let {isValidationAvailable, isReadOnlyMode, heatDataExist, onDownload, softwareProductId, onProcessAndValidate, - heatSetup, HeatSetupComponent, onGoToOverview, version, onboardingOrigin, activeTab, setActiveTab, ...other} = this.props; + let {isValidationAvailable, isReadOnlyMode, heatDataExist, onDownload, softwareProductId, onProcessAndValidate, onUploadAbort, + candidateInProcess, heatSetup, HeatSetupComponent, onGoToOverview, version, onboardingOrigin, activeTab, setActiveTab, ...other} = this.props; return ( <div className='vsp-attachments-view'> <div className='attachments-view-controllers'> - {(activeTab === tabsMapping.SETUP) && - <SVGIcon - disabled={heatDataExist ? false : true} - name='download' - className='icon-component' - label={i18n('Export Validation')} - labelPosition='right' - color='secondary' - onClick={heatDataExist ? () => onDownload({heatCandidate: heatSetup, isReadOnlyMode, version}) : undefined} - data-test-id='download-heat'/>} + {(activeTab === tabsMapping.SETUP) && + <Button btnType='outline' + data-test-id='proceed-to-validation-btn' + disabled={!isValidationAvailable} + className='proceed-to-validation-btn' + onClick={()=>this.handleTabPress(tabsMapping.VALIDATION)}>{i18n('PROCEED TO VALIDATION')}</Button> + } + {candidateInProcess && <SVGIcon + onClick={onUploadAbort} + name='close' + className='icon-component abort-btn' + label={i18n('ABORT')} + labelPosition='right' + color='secondary' + data-test-id='abort-btn'/> + } + {(activeTab === tabsMapping.VALIDATION && softwareProductId) && - <SVGIcon + <Button btnType='outline' + data-test-id='go-to-overview' disabled={this.props.goToOverview !== true} - onClick={this.props.goToOverview ? () => onGoToOverview({version}) : undefined} - name='proceedToOverview' - className='icon-component' - label={i18n('Go to Overview')} - labelPosition='right' - color={this.props.goToOverview ? 'primary' : 'secondary'} - data-test-id='go-to-overview'/>} + className='go-to-overview-btn' + onClick={this.props.goToOverview ? () => onGoToOverview({version}) : undefined}>{i18n('GO TO OVERVIEW')}</Button>} + <div className='separator'></div> + <SVGIcon + disabled={heatDataExist ? false : true} + name='download' + className='icon-component' + color='dark-gray' + onClick={heatDataExist ? () => onDownload({heatCandidate: heatSetup, isReadOnlyMode, version}) : undefined} + data-test-id='download-heat'/> + <SVGIcon name='upload' - className='icon-component' - label={i18n('Upload New File')} - labelPosition='right' - color='secondary' - disabled={isReadOnlyMode} + className='icon-component' + color='dark-gray' + disabled={isReadOnlyMode || candidateInProcess} onClick={isReadOnlyMode ? undefined : evt => this.refs.hiddenImportFileInput.click(evt)} data-test-id='upload-heat'/> <input @@ -73,11 +90,11 @@ class HeatScreenView extends Component { accept='.zip, .csar' onChange={evt => this.handleImport(evt)}/> </div> - <Tabs - className='attachments-tabs' - type='header' - activeTab={activeTab} - onTabClick={key => this.handleTabPress(key)}> + <Tabs + className='attachments-tabs' + type='header' + activeTab={activeTab} + onTabClick={key => this.handleTabPress(key)}> <Tab tabId={tabsMapping.SETUP} title='Setup' disabled={onboardingOrigin === onboardingOriginTypes.CSAR}> <HeatSetupComponent heatDataExist={heatDataExist} |