From c8a540b3c234449163f6fb1899807bba951113b4 Mon Sep 17 00:00:00 2001 From: shrek2000 Date: Mon, 11 Sep 2017 15:45:37 +0300 Subject: Create new VSP, onboard from TOSCA file - UI Change-Id: I018c6d07a4b9ec7e6b1507ab37e2550865423cfe Issue-ID: SDC-230 Signed-off-by: shrek2000 --- .../attachments/SoftwareProductAttachmentsView.jsx | 42 +++++++++++----------- 1 file changed, 22 insertions(+), 20 deletions(-) (limited to 'openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsView.jsx') 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 3da26cc20f..8c59b2b1cc 100644 --- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsView.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsView.jsx @@ -20,34 +20,34 @@ import {tabsMapping} from './SoftwareProductAttachmentsConstants.js'; import i18n from 'nfvo-utils/i18n/i18n.js'; import SVGIcon from 'sdc-ui/lib/react/SVGIcon.js'; import HeatValidation from './validation/HeatValidation.js'; +import {onboardingOriginTypes} from 'sdc-app/onboarding/softwareProduct/SoftwareProductConstants.js'; class HeatScreenView extends Component { static propTypes = { isValidationAvailable: PropTypes.bool, - goToOverview: PropTypes.bool - }; - - state = { - activeTab: tabsMapping.SETUP + goToOverview: PropTypes.bool, + setActiveTab: PropTypes.function }; render() { - let {isValidationAvailable, isReadOnlyMode, heatDataExist, onDownload, softwareProductId, onProcessAndValidate, heatSetup, HeatSetupComponent, onGoToOverview, version, ...other} = this.props; + let {isValidationAvailable, isReadOnlyMode, heatDataExist, onDownload, softwareProductId, onProcessAndValidate, + heatSetup, HeatSetupComponent, onGoToOverview, version, onboardingOrigin, activeTab, setActiveTab, ...other} = this.props; + return (
- {(this.state.activeTab === tabsMapping.SETUP) && + {(activeTab === tabsMapping.SETUP) && onDownload({heatCandidate: heatSetup, isReadOnlyMode, version}) : undefined} data-test-id='download-heat'/>} - {(this.state.activeTab === tabsMapping.VALIDATION && softwareProductId) && + {(activeTab === tabsMapping.VALIDATION && softwareProductId) && onGoToOverview({version}) : undefined} @@ -60,7 +60,7 @@ class HeatScreenView extends Component { this.handleImport(evt)}/>
- this.handleTabPress(key)}> - + this.handleTabPress(key)}> + this.setState({activeTab: tab})} + changeAttachmentsTab={tab => setActiveTab({activeTab: tab})} onProcessAndValidate={onProcessAndValidate} softwareProductId={softwareProductId} isReadOnlyMode={isReadOnlyMode} version={version}/> - + @@ -92,15 +92,15 @@ class HeatScreenView extends Component { } handleTabPress(key) { - let {heatSetup, heatSetupCache, onProcessAndValidate, isReadOnlyMode, version} = this.props; + let {heatSetup, heatSetupCache, onProcessAndValidate, isReadOnlyMode, version, setActiveTab} = this.props; switch (key) { case tabsMapping.VALIDATION: onProcessAndValidate({heatData: heatSetup, heatDataCache: heatSetupCache, isReadOnlyMode, version}).then( - () => this.setState({activeTab: tabsMapping.VALIDATION}) + () => setActiveTab({activeTab: tabsMapping.VALIDATION}) ); return; case tabsMapping.SETUP: - this.setState({activeTab: tabsMapping.SETUP}); + setActiveTab({activeTab: tabsMapping.SETUP}); return; } } @@ -112,11 +112,13 @@ class HeatScreenView extends Component { formData.append('upload', this.refs.hiddenImportFileInput.files[0]); this.refs.hiddenImportFileInput.value = ''; this.props.onUpload(formData, version); - this.setState({activeTab: tabsMapping.SETUP}); } save() { - return this.props.onSave(this.props.heatSetup, this.props.version); + + return this.props.onboardingOrigin === onboardingOriginTypes.ZIP ? + this.props.onSave(this.props.heatSetup, this.props.version) : + Promise.resolve(); } } -- cgit 1.2.3-korg