diff options
Diffstat (limited to 'openecomp-ui/src/sdc-app')
8 files changed, 99 insertions, 37 deletions
diff --git a/openecomp-ui/src/sdc-app/AppStore.js b/openecomp-ui/src/sdc-app/AppStore.js index 5cab6ae561..db47650723 100644 --- a/openecomp-ui/src/sdc-app/AppStore.js +++ b/openecomp-ui/src/sdc-app/AppStore.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. @@ -17,6 +17,7 @@ import { createStore, applyMiddleware, compose } from 'redux'; import Reducers from './Reducers.js'; import filterUpdater from 'sdc-app/onboarding/onboard/filter/FilterMiddleware.js'; +import notifications from 'nfvo-components/notification/NotificationsMiddleware.js'; const thunk = store => next => action => typeof action === 'function' @@ -29,7 +30,7 @@ export const storeCreator = initialState => createStore( Reducers, initialState, - composeEnhancers(applyMiddleware(thunk, filterUpdater)) + composeEnhancers(applyMiddleware(thunk, filterUpdater, notifications)) ); const store = storeCreator(); diff --git a/openecomp-ui/src/sdc-app/Application.jsx b/openecomp-ui/src/sdc-app/Application.jsx index abebb6d89a..f96bd73c21 100644 --- a/openecomp-ui/src/sdc-app/Application.jsx +++ b/openecomp-ui/src/sdc-app/Application.jsx @@ -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. @@ -17,6 +17,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { Provider } from 'react-redux'; import GlobalModal from 'nfvo-components/modal/GlobalModal.js'; +import Notifications from 'nfvo-components/notification/Notifications.js'; import Loader from 'nfvo-components/loader/Loader.jsx'; import WebSocketUtil from 'nfvo-utils/WebSocketUtil.js'; import UserNotificationsActionHelper from 'sdc-app/onboarding/userNotifications/UserNotificationsActionHelper.js'; @@ -44,6 +45,7 @@ class Application extends React.Component { <Provider store={store}> <div> <GlobalModal /> + <Notifications /> {this.props.children} <Loader /> </div> diff --git a/openecomp-ui/src/sdc-app/Reducers.js b/openecomp-ui/src/sdc-app/Reducers.js index 9f424235cb..684c20c878 100644 --- a/openecomp-ui/src/sdc-app/Reducers.js +++ b/openecomp-ui/src/sdc-app/Reducers.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. @@ -20,7 +20,7 @@ import flowsReducersMap from './flows/FlowsReducersMap.js'; import loaderReducer from 'nfvo-components/loader/LoaderReducer.js'; import globalModalReducer from 'nfvo-components/modal/GlobalModalReducer.js'; import notificationsReducer from 'sdc-app/onboarding/userNotifications/NotificationsReducer.js'; - +import { default as popupNotifications } from 'nfvo-components/notification/NotificationsReducer.js'; export default combineReducers({ // on-boarding reducers ...onBoardingReducersMap, @@ -29,5 +29,6 @@ export default combineReducers({ ...flowsReducersMap, modal: globalModalReducer, loader: loaderReducer, - notifications: notificationsReducer + notifications: notificationsReducer, + popupNotifications }); 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 }); }, diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProduct.js b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProduct.js index db3cc04f76..d3d7b96a5d 100644 --- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProduct.js +++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProduct.js @@ -127,7 +127,8 @@ const buildNavigationBarProps = ({ screen, componentId, componentsList, - mapOfExpandedIds + mapOfExpandedIds, + isCertified }) => { const { softwareProductEditor: { data: currentSoftwareProduct = {} } @@ -235,7 +236,7 @@ const buildNavigationBarProps = ({ return { activeItemId, groups, - disabled: !!candidateOnboardingOrigin + disabled: !!candidateOnboardingOrigin && !isCertified }; }; @@ -268,7 +269,8 @@ const buildVersionControllerProps = ({ userInfo, usersList, isManual: onboardingMethod === onboardingMethodType.MANUAL, - candidateInProcess: !!candidateOnboardingOrigin + candidateInProcess: + !!candidateOnboardingOrigin && !itemPermission.isCertified }; }; @@ -360,7 +362,8 @@ const mapStateToProps = ( screen, componentId, componentsList, - mapOfExpandedIds + mapOfExpandedIds, + isCertified: itemPermission.isCertified }), meta }; diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachments.js b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachments.js index 4d5887be6f..9b0f681eaf 100644 --- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachments.js +++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachments.js @@ -36,7 +36,8 @@ export const mapStateToProps = state => { heatSetupCache, heatValidation: { errorList } } - } + }, + currentScreen: { itemPermission: { isCertified } } } = state; let { unassigned = [], modules = [] } = heatSetup; @@ -61,7 +62,8 @@ export const mapStateToProps = state => { version, onboardingOrigin, activeTab, - candidateInProcess: !!currentSoftwareProduct.candidateOnboardingOrigin + candidateInProcess: + !!currentSoftwareProduct.candidateOnboardingOrigin && !isCertified }; }; diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/landingPage/SoftwareProductLandingPage.js b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/landingPage/SoftwareProductLandingPage.js index f5f3b7ebdb..52a69803a6 100644 --- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/landingPage/SoftwareProductLandingPage.js +++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/landingPage/SoftwareProductLandingPage.js @@ -25,7 +25,8 @@ import VNFImportActionHelper from '../vnfMarketPlace/VNFImportActionHelper.js'; export const mapStateToProps = ({ softwareProduct, - licenseModel: { licenseAgreement } + licenseModel: { licenseAgreement }, + currentScreen: { itemPermission: { isCertified } } }) => { let { softwareProductEditor: { data: currentSoftwareProduct = {} }, @@ -67,6 +68,7 @@ export const mapStateToProps = ({ licenseAgreementName, fullCategoryDisplayName }, + isCertified, componentsList, isManual: currentSoftwareProduct.onboardingMethod === onboardingMethod.MANUAL diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/landingPage/SoftwareProductLandingPageView.jsx b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/landingPage/SoftwareProductLandingPageView.jsx index 00f0c2a0cb..dcc9645750 100644 --- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/landingPage/SoftwareProductLandingPageView.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/landingPage/SoftwareProductLandingPageView.jsx @@ -65,8 +65,12 @@ class SoftwareProductLandingPageView extends React.Component { onAddComponent: PropTypes.func }; componentDidMount() { - const { onCandidateInProcess, currentSoftwareProduct } = this.props; - if (currentSoftwareProduct.candidateOnboardingOrigin) { + const { + onCandidateInProcess, + currentSoftwareProduct, + isCertified + } = this.props; + if (currentSoftwareProduct.candidateOnboardingOrigin && !isCertified) { onCandidateInProcess(currentSoftwareProduct.id); } } |