diff options
Diffstat (limited to 'openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductActionHelper.js')
-rw-r--r-- | openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductActionHelper.js | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductActionHelper.js b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductActionHelper.js index 25bd32e468..877c7869bd 100644 --- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductActionHelper.js +++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductActionHelper.js @@ -81,6 +81,12 @@ function uploadFile(vspId, formData, version) { ); } +function uploadVNFFile(csarId, softwareProductId, version) { + let verId = typeof version === 'object' ? version.id : version; + return RestAPIUtil.post( + `${baseUrl()}${softwareProductId}/versions/${verId}/vnfrepository/vnfpackage/${csarId}/import` + ); +} function putSoftwareProduct({ softwareProduct, version }) { return RestAPIUtil.put( `${baseUrl()}${softwareProduct.id}/versions/${version.id}`, @@ -421,6 +427,54 @@ const SoftwareProductActionHelper = { }); }, + uploadVNFFile( + dispatch, + { csarId, failedNotificationTitle, softwareProductId, version } + ) { + dispatch({ + type: HeatSetupActions.FILL_HEAT_SETUP_CACHE, + payload: {} + }); + + Promise.resolve() + .then(() => uploadVNFFile(csarId, softwareProductId, version)) + .then(response => { + if (response.status === 'Success') { + dispatch({ + type: commonActionTypes.DATA_CHANGED, + deltaData: { + onboardingOrigin: response.onboardingOrigin + }, + formName: forms.VENDOR_SOFTWARE_PRODUCT_DETAILS + }); + switch (response.onboardingOrigin) { + case onboardingOriginTypes.ZIP: + OnboardingActionHelper.navigateToSoftwareProductAttachmentsSetupTab( + dispatch, + { softwareProductId, version } + ); + break; + case onboardingOriginTypes.CSAR: + OnboardingActionHelper.navigateToSoftwareProductAttachmentsValidationTab( + dispatch, + { softwareProductId, version } + ); + break; + } + } else { + throw new Error(parseUploadErrorMsg(response.errors)); + } + }) + .catch(error => { + dispatch({ + type: modalActionTypes.GLOBAL_MODAL_ERROR, + data: { + title: failedNotificationTitle, + msg: error.message + } + }); + }); + }, downloadHeatFile( dispatch, { softwareProductId, heatCandidate, isReadOnlyMode, version } |