summaryrefslogtreecommitdiffstats
path: root/openecomp-ui/src/sdc-app/onboarding/OnboardingActionHelper.js
diff options
context:
space:
mode:
authorsvishnev <shlomo-stanisla.vishnevetskiy@amdocs.com>2018-05-24 13:20:51 +0300
committerEinav Keidar <einavw@amdocs.com>2018-05-24 12:01:09 +0000
commit7c727c1a2bc672f20e87260ad3dc9c33ca31bbd4 (patch)
tree5d14fd827b96058e8478a023fa567dbefe02531f /openecomp-ui/src/sdc-app/onboarding/OnboardingActionHelper.js
parentbc65a048ed742cfa3457b8159a5c5c316341d594 (diff)
Healing process flow integration
Issue-ID: SDC-1360 Change-Id: I4d786b53b4357901d10e041c31145b7b1b065725 Signed-off-by: svishnev <shlomo-stanisla.vishnevetskiy@amdocs.com>
Diffstat (limited to 'openecomp-ui/src/sdc-app/onboarding/OnboardingActionHelper.js')
-rw-r--r--openecomp-ui/src/sdc-app/onboarding/OnboardingActionHelper.js91
1 files changed, 69 insertions, 22 deletions
diff --git a/openecomp-ui/src/sdc-app/onboarding/OnboardingActionHelper.js b/openecomp-ui/src/sdc-app/onboarding/OnboardingActionHelper.js
index b8ce714bce..b9ffdc3076 100644
--- a/openecomp-ui/src/sdc-app/onboarding/OnboardingActionHelper.js
+++ b/openecomp-ui/src/sdc-app/onboarding/OnboardingActionHelper.js
@@ -1,5 +1,5 @@
/*
- * Copyright © 2016-2017 European Support Limited
+ * Copyright © 2016-2018 European Support Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -47,6 +47,8 @@ import { tabsMapping as attachmentsTabsMapping } from 'sdc-app/onboarding/softwa
import SoftwareProductAttachmentsActionHelper from 'sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsActionHelper.js';
import { actionTypes as filterActionTypes } from './onboard/filter/FilterConstants.js';
import FeaturesActionHelper from 'sdc-app/features/FeaturesActionHelper.js';
+import { notificationActions } from 'nfvo-components/notification/NotificationsConstants.js';
+import i18n from 'nfvo-utils/i18n/i18n.js';
function setCurrentScreen(dispatch, screen, props = {}) {
dispatch({
@@ -208,37 +210,82 @@ const OnboardingActionHelper = {
status
});
},
+ async getUpdatedSoftwareProduct(dispatch, { softwareProductId, version }) {
+ const response = await SoftwareProductActionHelper.fetchSoftwareProduct(
+ dispatch,
+ {
+ softwareProductId,
+ version
+ }
+ );
+ let newResponse = false;
+ let newVersion = false;
+ // checking if there was healing and a new version should be open
+ if (response[0].version !== version.id) {
+ newResponse = await SoftwareProductActionHelper.fetchSoftwareProduct(
+ dispatch,
+ {
+ softwareProductId,
+ version: { ...version, id: response[0].version }
+ }
+ );
+ newVersion = await ItemsHelper.fetchVersion({
+ itemId: softwareProductId,
+ versionId: response[0].version
+ });
- navigateToSoftwareProductLandingPage(
+ dispatch(
+ notificationActions.showInfo({
+ message: i18n(
+ 'This is the current version of the VSP, as a result of healing'
+ )
+ })
+ );
+ }
+ return Promise.resolve(
+ newResponse
+ ? { softwareProduct: newResponse[0], newVersion }
+ : { softwareProduct: response[0], newVersion: version }
+ );
+ },
+ async navigateToSoftwareProductLandingPage(
dispatch,
{ softwareProductId, version, status }
) {
SoftwareProductComponentsActionHelper.clearComponentsStore(dispatch);
+ /**
+ * TODO remove when Filter toggle will be removed
+ */
LicenseModelActionHelper.fetchFinalizedLicenseModels(dispatch);
- SoftwareProductActionHelper.fetchSoftwareProduct(dispatch, {
+
+ const {
+ softwareProduct,
+ newVersion
+ } = await this.getUpdatedSoftwareProduct(dispatch, {
softwareProductId,
version
- }).then(response => {
- let { vendorId: licenseModelId, licensingVersion } = response[0];
- SoftwareProductActionHelper.loadSoftwareProductDetailsData(
- dispatch,
- { licenseModelId, licensingVersion }
- );
- SoftwareProductComponentsActionHelper.fetchSoftwareProductComponents(
- dispatch,
- { softwareProductId, version: version }
- );
- if (response[0].onboardingOrigin === onboardingOriginTypes.ZIP) {
- SoftwareProductActionHelper.loadSoftwareProductHeatCandidate(
- dispatch,
- { softwareProductId, version: version }
- );
- }
- setCurrentScreen(
+ });
+
+ let { vendorId: licenseModelId, licensingVersion } = softwareProduct;
+ SoftwareProductActionHelper.loadSoftwareProductDetailsData(dispatch, {
+ licenseModelId,
+ licensingVersion
+ });
+ SoftwareProductComponentsActionHelper.fetchSoftwareProductComponents(
+ dispatch,
+ { softwareProductId, version: newVersion }
+ );
+ if (softwareProduct.onboardingOrigin === onboardingOriginTypes.ZIP) {
+ SoftwareProductActionHelper.loadSoftwareProductHeatCandidate(
dispatch,
- enums.SCREEN.SOFTWARE_PRODUCT_LANDING_PAGE,
- { softwareProductId, licenseModelId, version, status }
+ { softwareProductId, version: newVersion }
);
+ }
+ setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_LANDING_PAGE, {
+ softwareProductId,
+ licenseModelId,
+ version: newVersion,
+ status
});
},