summaryrefslogtreecommitdiffstats
path: root/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductActionHelper.js
diff options
context:
space:
mode:
authorandre.schmid <andre.schmid@est.tech>2022-01-25 19:38:32 +0000
committerMichael Morris <michael.morris@est.tech>2022-01-31 15:23:21 +0000
commit4594cba0c53461bc1a273458e0a7a314da6bfb68 (patch)
treec78010c789d726aa72ee8591ab12720b72d1c675 /openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductActionHelper.js
parent99b7fb519806870b3c84e9e1ac0ac2f59320a6b0 (diff)
Obtain and control VSP package upload status
Obtain the upload status and control the upload from the frontend perspective. Change-Id: Idcc921cf592efea33df35c557afcfae827af3a39 Issue-ID: SDC-3862 Signed-off-by: andre.schmid <andre.schmid@est.tech>
Diffstat (limited to 'openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductActionHelper.js')
-rw-r--r--openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductActionHelper.js44
1 files changed, 38 insertions, 6 deletions
diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductActionHelper.js b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductActionHelper.js
index 5c82c70830..3364edfe11 100644
--- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductActionHelper.js
+++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductActionHelper.js
@@ -112,12 +112,19 @@ function getModelUrl() {
return `${restCatalogPrefix}/v1/catalog/model?modelType=normative`;
}
-function uploadFile(vspId, formData, version) {
+function uploadFile(vspId, formData, version, onUploadProgress = undefined) {
+ const options = {
+ noLoading: true
+ };
+ if (onUploadProgress) {
+ options.onUploadProgress = onUploadProgress;
+ }
return RestAPIUtil.post(
`${baseUrl()}${vspId}/versions/${
version.id
}/orchestration-template-candidate`,
- formData
+ formData,
+ options
);
}
@@ -346,6 +353,19 @@ const SoftwareProductActionHelper = {
);
},
+ fetchUploadStatus(vspId, versionId) {
+ const options = {
+ validateStatus: function(status) {
+ return status < 400 || status === 404;
+ },
+ noLoading: true
+ };
+ return RestAPIUtil.get(
+ `${baseUrl()}${vspId}/versions/${versionId}/orchestration-template-candidate/upload`,
+ options
+ );
+ },
+
loadSoftwareProductAssociatedData(dispatch) {
fetchSoftwareProductCategories(dispatch);
fetchModelList(dispatch);
@@ -435,15 +455,27 @@ const SoftwareProductActionHelper = {
uploadFile(
dispatch,
- { softwareProductId, formData, failedNotificationTitle, version }
+ {
+ softwareProductId,
+ formData,
+ failedNotificationTitle,
+ version,
+ onUploadProgress = undefined
+ }
) {
dispatch({
type: HeatSetupActions.FILL_HEAT_SETUP_CACHE,
payload: {}
});
- displayTimingValidationInfo(dispatch);
- Promise.resolve()
- .then(() => uploadFile(softwareProductId, formData, version))
+ return Promise.resolve()
+ .then(() =>
+ uploadFile(
+ softwareProductId,
+ formData,
+ version,
+ onUploadProgress
+ )
+ )
.then(response => {
if (response.status === 'Success') {
dispatch({