heat validation tabs and download fix

Issue-ID: SDC-1084
Change-Id: I548c42c1cad316e336017269e6793d1750639e0a
Signed-off-by: svishnev <shlomo-stanisla.vishnevetskiy@amdocs.com>
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 90dd769..4ced98f 100644
--- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsView.jsx
+++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsView.jsx
@@ -44,12 +44,12 @@
 		return (
 			<div className='vsp-attachments-view'>
 				<div className='attachments-view-controllers'>
-					{(activeTab === tabsMapping.SETUP) &&	
-						<Button btnType='outline' 
+					{(activeTab === tabsMapping.SETUP) && candidateInProcess &&	
+						<Button  
 							data-test-id='proceed-to-validation-btn'
 							disabled={!isValidationAvailable} 
 							className='proceed-to-validation-btn'
-							onClick={()=>this.handleTabPress(tabsMapping.VALIDATION)}>{i18n('PROCEED TO VALIDATION')}</Button>					
+							onClick={()=>this.validate()}>{i18n('PROCEED TO VALIDATION')}</Button>					
 					}		
 					{candidateInProcess && <SVGIcon							
 						onClick={onUploadAbort}
@@ -73,7 +73,7 @@
 						name='download'
 						className='icon-component'														
 						color='dark-gray'
-						onClick={heatDataExist ? () => onDownload({heatCandidate: heatSetup, isReadOnlyMode, version}) : undefined}
+						onClick={heatDataExist ? () => onDownload({heatCandidate: heatSetup, isReadOnlyMode: isReadOnlyMode || !candidateInProcess, version}) : undefined}
 						data-test-id='download-heat'/>
 
 					<SVGIcon
@@ -104,7 +104,7 @@
 							isReadOnlyMode={isReadOnlyMode}
 							version={version}/>
 					</Tab>
-					<Tab tabId={tabsMapping.VALIDATION} title='Validation' disabled={!isValidationAvailable}>
+					<Tab tabId={tabsMapping.VALIDATION} title='Validation' disabled={!isValidationAvailable || candidateInProcess}>
 						<HeatValidation {...other}/>
 					</Tab>
 				</Tabs>
@@ -113,12 +113,10 @@
 	}
 
 	handleTabPress(key) {
-		let {heatSetup, heatSetupCache, onProcessAndValidate, isReadOnlyMode, version, setActiveTab} = this.props;
+		let {setActiveTab} = this.props;
 		switch (key) {
 			case tabsMapping.VALIDATION:
-				onProcessAndValidate({heatData: heatSetup, heatDataCache: heatSetupCache, isReadOnlyMode, version}).then(
-					() => setActiveTab({activeTab: tabsMapping.VALIDATION})
-				);
+				setActiveTab({activeTab: tabsMapping.VALIDATION});		
 				return;
 			case tabsMapping.SETUP:
 				setActiveTab({activeTab: tabsMapping.SETUP});
@@ -139,7 +137,12 @@
 		this.refs.hiddenImportFileInput.value = '';
 		this.props.onUpload(formData, version);
 	}
-
+	validate() {
+		let {heatSetup, heatSetupCache, onProcessAndValidate, isReadOnlyMode, version, setActiveTab} = this.props;
+		onProcessAndValidate({heatData: heatSetup, heatDataCache: heatSetupCache, isReadOnlyMode, version}).then(
+			() => setActiveTab({activeTab: tabsMapping.VALIDATION})
+		);
+	}
 	save() {
 
 		return this.props.onboardingOrigin === onboardingOriginTypes.ZIP ?
diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/setup/HeatSetupView.jsx b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/setup/HeatSetupView.jsx
index 17b3179..ce6d526 100644
--- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/setup/HeatSetupView.jsx
+++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/setup/HeatSetupView.jsx
@@ -97,13 +97,11 @@
 };
 
 const EmptyListContent = props => {
-	let {onClick, heatDataExist, isReadOnlyMode} = props;
+	let {heatDataExist} = props;
 	let displayText = heatDataExist ? 'All Files Are Assigned' : '';
 	return (
 		<div className='go-to-validation-button-wrapper'>
-			<div className='all-files-assigned'>{i18n(displayText)}</div>
-			{heatDataExist && <SVGIcon disabled={isReadOnlyMode} name='angleRight' onClick={onClick}
-				data-test-id='go-to-validation' label={i18n('Proceed To Validation')} labelPosition='left' color='primary'/>}
+			<div className='all-files-assigned'>{i18n(displayText)}</div>			
 		</div>
 	);
 };
@@ -283,7 +281,7 @@
 	}
 
 	render() {
-		let {modules, heatSetupCache, isReadOnlyMode, heatDataExist, unassigned, artifacts, nested, onArtifactListChange, onAddAllUnassigned} = this.props;
+		let {modules, isReadOnlyMode, heatDataExist, unassigned, artifacts, nested, onArtifactListChange, onAddAllUnassigned} = this.props;
 
 		const formattedUnassigned = unassigned.map(buildLabelValueObject);
 		const formattedArtifacts = artifacts.map(buildLabelValueObject);
@@ -317,9 +315,7 @@
 						(<ul>{formattedUnassigned.map(file => <UnassignedFile key={file.label} name={file.label}/>)}</ul>)
 						:
 						(<EmptyListContent
-							heatDataExist={heatDataExist}
-							isReadOnlyMode={this.props.isReadOnlyMode}
-							onClick={() => this.processAndValidateHeat({modules, unassigned, artifacts, nested}, heatSetupCache)}/>)
+							heatDataExist={heatDataExist}/>)
 					}
 				</UnassignedFileList>
 			</div>