From 8e9c0653dd6c6862123c9609ae34e1206d86456e Mon Sep 17 00:00:00 2001 From: talig Date: Wed, 20 Dec 2017 14:30:43 +0200 Subject: Add collaboration feature Issue-ID: SDC-767 Change-Id: I14fb4c1f54086ed03a56a7ff7fab9ecd40381795 Signed-off-by: talig --- .../heatvalidation/UploadScreenActionHelper.js | 36 ++++++++++++---------- 1 file changed, 19 insertions(+), 17 deletions(-) (limited to 'openecomp-ui/src/sdc-app/heatvalidation/UploadScreenActionHelper.js') diff --git a/openecomp-ui/src/sdc-app/heatvalidation/UploadScreenActionHelper.js b/openecomp-ui/src/sdc-app/heatvalidation/UploadScreenActionHelper.js index 4e9120956e..3c41b126e6 100644 --- a/openecomp-ui/src/sdc-app/heatvalidation/UploadScreenActionHelper.js +++ b/openecomp-ui/src/sdc-app/heatvalidation/UploadScreenActionHelper.js @@ -26,7 +26,7 @@ import {actionTypes as HeatSetupActions} from '../onboarding/softwareProduct/att const options = { headers: { - HTTP_CSP_ATTUID: 'validationOnlyVspUser' + USER_ID: 'validationOnlyVspUser' } }; @@ -37,16 +37,18 @@ function getTimestampString() { return `${date.getFullYear()}-${z(date.getMonth())}-${z(date.getDate())}_${z(date.getHours())}-${z(date.getMinutes())}`; } -function fetchVspId() { +function fetchVspIdAndVersion() { let vspId = sessionStorage.getItem('validationAppVspId'); + let versionId = sessionStorage.getItem('validationAppVersionId'); if (vspId) { - return Promise.resolve({value: vspId}); + return Promise.resolve({value: vspId, versionId}); }else { return RestAPIUtil.fetch('/sdc1/feProxy/onboarding-api/v1.0/vendor-software-products/validation-vsp', options) .then(response => { - sessionStorage.setItem('validationAppVspId', response.value); - return Promise.resolve(response); + sessionStorage.setItem('validationAppVspId', response.itemId); + sessionStorage.setItem('validationAppVersionId', response.version.id); + return Promise.resolve({value: response.itemId, versionId: response.version.id}); }); } @@ -82,16 +84,16 @@ function showFileSaveDialog({blob, xhr, defaultFilename, addTimestamp}) { function uploadFile(formData) { - return fetchVspId() + return fetchVspIdAndVersion() .then(response => { - return RestAPIUtil.post(`/sdc1/feProxy/onboarding-api/v1.0/vendor-software-products/${response.value}/versions/0.1/orchestration-template-candidate`, formData, options); + return RestAPIUtil.post(`/sdc1/feProxy/onboarding-api/v1.0/vendor-software-products/${response.value}/versions/${response.versionId}/orchestration-template-candidate`, formData, options); }); } function loadSoftwareProductHeatCandidate(dispatch){ - return fetchVspId() + return fetchVspIdAndVersion() .then(response => { - return RestAPIUtil.fetch(`/sdc1/feProxy/onboarding-api/v1.0/vendor-software-products/${response.value}/versions/0.1/orchestration-template-candidate/manifest`, options) + return RestAPIUtil.fetch(`/sdc1/feProxy/onboarding-api/v1.0/vendor-software-products/${response.value}/versions/${response.versionId}/orchestration-template-candidate/manifest`, options) .then(response => dispatch({ type: HeatSetupActions.MANIFEST_LOADED, response @@ -100,9 +102,9 @@ function loadSoftwareProductHeatCandidate(dispatch){ } function updateHeatCandidate(dispatch, heatCandidate) { - return fetchVspId() + return fetchVspIdAndVersion() .then(response => { - return RestAPIUtil.put(`/sdc1/feProxy/onboarding-api/v1.0/vendor-software-products/${response.value}/versions/0.1/orchestration-template-candidate/manifest`, + return RestAPIUtil.put(`/sdc1/feProxy/onboarding-api/v1.0/vendor-software-products/${response.value}/versions/${response.versionId}/orchestration-template-candidate/manifest`, heatCandidate.heatData, options) .then(null, error => { dispatch({ @@ -122,16 +124,16 @@ function updateHeatCandidate(dispatch, heatCandidate) { } function fetchSoftwareProduct() { - return fetchVspId() + return fetchVspIdAndVersion() .then(response => { - return RestAPIUtil.fetch(`/sdc1/feProxy/onboarding-api/v1.0/vendor-software-products/${response.value}/versions/0.1`, options); + return RestAPIUtil.fetch(`/sdc1/feProxy/onboarding-api/v1.0/vendor-software-products/${response.value}/versions/${response.versionId}`, options); }); } function downloadHeatFile() { - return fetchVspId() + return fetchVspIdAndVersion() .then(response => { - RestAPIUtil.fetch(`/sdc1/feProxy/onboarding-api/v1.0/vendor-software-products/${response.value}/versions/0.1/orchestration-template-candidate`, { + RestAPIUtil.fetch(`/sdc1/feProxy/onboarding-api/v1.0/vendor-software-products/${response.value}/versions/${response.versionId}/orchestration-template-candidate`, { ...options, dataType: 'binary' }) @@ -145,9 +147,9 @@ function downloadHeatFile() { } function processAndValidateHeatCandidate(dispatch) { - return fetchVspId() + return fetchVspIdAndVersion() .then(response => { - return RestAPIUtil.put(`/sdc1/feProxy/onboarding-api/v1.0/vendor-software-products/${response.value}/versions/0.1/orchestration-template-candidate/process`, {}, options) + return RestAPIUtil.put(`/sdc1/feProxy/onboarding-api/v1.0/vendor-software-products/${response.value}/versions/${response.versionId}/orchestration-template-candidate/process`, {}, options) .then(response => { if (response.status === 'Success') { fetchSoftwareProduct().then(response => { -- cgit 1.2.3-korg