From 3c957597725f306b4ca06cebfa54fbf0f2622938 Mon Sep 17 00:00:00 2001 From: Maciej Malewski Date: Wed, 27 Jan 2021 08:54:20 +0100 Subject: 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 --- openecomp-ui/src/sdc-app/config/config.json | 3 +- .../softwareProduct/SoftwareProductActionHelper.js | 60 ++++++++++++++++++---- 2 files changed, 52 insertions(+), 11 deletions(-) (limited to 'openecomp-ui/src/sdc-app') diff --git a/openecomp-ui/src/sdc-app/config/config.json b/openecomp-ui/src/sdc-app/config/config.json index c2c794024c..b79adf2f82 100644 --- a/openecomp-ui/src/sdc-app/config/config.json +++ b/openecomp-ui/src/sdc-app/config/config.json @@ -12,5 +12,6 @@ "defaultWebsocketPath": "notification-api/ws/notificationHandler", "defaultNotificationsWorkerUpdateMillisecond": 10000, "showBrowseVNF": true, - "allTestScenario": "onap-dublin" + "allTestScenario": "onap-dublin", + "displayAlertValidationAfterMilisec": 3000 } 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) + ); }); }, -- cgit 1.2.3-korg