summaryrefslogtreecommitdiffstats
path: root/openecomp-ui/src/sdc-app/onboarding/softwareProduct
diff options
context:
space:
mode:
authorMaciej Malewski <maciej.malewski@nokia.com>2021-01-27 08:54:20 +0100
committerMaciej Malewski <maciej.malewski@nokia.com>2021-01-28 14:22:52 +0100
commit3c957597725f306b4ca06cebfa54fbf0f2622938 (patch)
tree21388ff2e3c08c343b329b09c48d099475df819c /openecomp-ui/src/sdc-app/onboarding/softwareProduct
parent87eec9a2ad04e1cbe1304f23071ac6d85bdd5503 (diff)
Add popup informing about long validation time for large pm_dictionary files.
For large pm_dictionary files, validation may take up to several minutes (average ~ 17s). The popup informs the user that the system is still working properly. Issue-ID: SDC-3390 Change-Id: Ia9ef211f2cab8a557aa1631d311ed06439fb3c26 Signed-off-by: Maciej Malewski <maciej.malewski@nokia.com>
Diffstat (limited to 'openecomp-ui/src/sdc-app/onboarding/softwareProduct')
-rw-r--r--openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductActionHelper.js60
1 files changed, 50 insertions, 10 deletions
diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductActionHelper.js b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductActionHelper.js
index 9a177b2a53..4e3133216b 100644
--- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductActionHelper.js
+++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductActionHelper.js
@@ -1,5 +1,6 @@
/*!
* Copyright © 2016-2018 European Support Limited
+ * Modifications copyright (c) 2021 Nokia
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -51,6 +52,11 @@ import {
versionStatus
} from 'sdc-app/common/helpers/ItemsHelperConstants.js';
+let shouldDisplayTimingValidationInfo = true;
+let alertValidationTiming = Configuration.get(
+ 'displayAlertValidationAfterMilisec'
+);
+
function getLicensingData(licensingData = {}) {
const { licenseAgreement, featureGroups } = licensingData;
const newlicenseAgreement = getValue(licenseAgreement);
@@ -63,6 +69,33 @@ function getLicensingData(licensingData = {}) {
: undefined;
}
+function getTimingInfoWarning() {
+ return {
+ type: modalActionTypes.GLOBAL_MODAL_WARNING,
+ data: {
+ title: 'Please be patient',
+ msg: 'Large files processing may take up to several minutes.',
+ cancelButtonText: i18n('Cancel')
+ }
+ };
+}
+
+function displayTimingValidationInfo(dispatch) {
+ shouldDisplayTimingValidationInfo = true;
+ setTimeout(() => {
+ if (shouldDisplayTimingValidationInfo) {
+ dispatch(getTimingInfoWarning());
+ }
+ }, alertValidationTiming);
+}
+
+function closeTimingValidationInfo(dispatch) {
+ shouldDisplayTimingValidationInfo = false;
+ dispatch({
+ type: modalActionTypes.GLOBAL_MODAL_CLOSE
+ });
+}
+
function baseUrl() {
const restPrefix = Configuration.get('restPrefix');
return `${restPrefix}/v1.0/vendor-software-products/`;
@@ -345,6 +378,7 @@ const SoftwareProductActionHelper = {
},
processAndValidateHeatCandidate(dispatch, { softwareProductId, version }) {
+ displayTimingValidationInfo(dispatch);
return validateHeatCandidate(softwareProductId, version).then(
response => {
if (response.status === 'Success') {
@@ -362,6 +396,7 @@ const SoftwareProductActionHelper = {
version
});
}
+ closeTimingValidationInfo(dispatch);
}
);
},
@@ -374,7 +409,7 @@ const SoftwareProductActionHelper = {
type: HeatSetupActions.FILL_HEAT_SETUP_CACHE,
payload: {}
});
-
+ displayTimingValidationInfo(dispatch);
Promise.resolve()
.then(() => uploadFile(softwareProductId, formData, version))
.then(response => {
@@ -410,20 +445,25 @@ const SoftwareProductActionHelper = {
});
break;
}
+ closeTimingValidationInfo(dispatch);
} else {
throw new Error(parseUploadErrorMsg(response.errors));
}
})
.catch(error => {
- dispatch({
- type: modalActionTypes.GLOBAL_MODAL_ERROR,
- data: {
- title: failedNotificationTitle,
- msg:
- error.message ||
- (error.responseJSON && error.responseJSON.message)
- }
- });
+ dispatch(
+ {
+ type: modalActionTypes.GLOBAL_MODAL_ERROR,
+ data: {
+ title: failedNotificationTitle,
+ msg:
+ error.message ||
+ (error.responseJSON &&
+ error.responseJSON.message)
+ }
+ },
+ closeTimingValidationInfo(dispatch)
+ );
});
},