summaryrefslogtreecommitdiffstats
path: root/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductActionHelper.js
diff options
context:
space:
mode:
authorMurali-P <murali.p@huawei.com>2018-03-29 17:46:39 +0530
committerVitaly Emporopulo <Vitaliy.Emporopulo@amdocs.com>2018-04-30 13:51:11 +0000
commit72d62fb1aaaaeaed462083e232f3571b3bde6b08 (patch)
tree0691b2378b76270b7b7dbd8e32aff2afe895042f /openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductActionHelper.js
parentdb69b87869091b774d6d87f3b6a9155d34d26b12 (diff)
Integrate VNF Repository in Beijing release
Migrate the code Change-Id: Ifccacf83634af32b034fd9c413e68f894f06d2f7 Issue-ID: VNFSDK-155 Signed-off-by: Murali-P <murali.p@huawei.com>
Diffstat (limited to 'openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductActionHelper.js')
-rw-r--r--openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductActionHelper.js54
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 }