summaryrefslogtreecommitdiffstats
path: root/openecomp-ui/src/sdc-app/heatvalidation/UploadScreenActionHelper.js
diff options
context:
space:
mode:
authortalig <talig@amdocs.com>2017-12-20 14:30:43 +0200
committerVitaly Emporopulo <Vitaliy.Emporopulo@amdocs.com>2017-12-21 11:12:33 +0000
commit8e9c0653dd6c6862123c9609ae34e1206d86456e (patch)
tree5eeef00ec0677133baa439ca8d7ffd7aca4804b6 /openecomp-ui/src/sdc-app/heatvalidation/UploadScreenActionHelper.js
parent785ebcc95de3e064e843bec04ba7a209d854fc7c (diff)
Add collaboration feature
Issue-ID: SDC-767 Change-Id: I14fb4c1f54086ed03a56a7ff7fab9ecd40381795 Signed-off-by: talig <talig@amdocs.com>
Diffstat (limited to 'openecomp-ui/src/sdc-app/heatvalidation/UploadScreenActionHelper.js')
-rw-r--r--openecomp-ui/src/sdc-app/heatvalidation/UploadScreenActionHelper.js36
1 files changed, 19 insertions, 17 deletions
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 => {