From 091edfdac90f66d91caff1b93131f99ba74f9aeb Mon Sep 17 00:00:00 2001 From: svishnev Date: Mon, 19 Mar 2018 12:15:19 +0200 Subject: ui support for archive items Issue-ID: SDC-1088 Change-Id: I836e4896a8ec6bb065f9d2571f514916ccf6759f Signed-off-by: svishnev --- .../src/sdc-app/common/helpers/ItemsHelper.js | 52 ++++- .../src/sdc-app/common/helpers/ScreensHelper.js | 259 ++++++++------------- .../src/sdc-app/common/modal/ModalContentMapper.js | 8 +- .../src/sdc-app/features/FeaturesConstants.js | 7 +- openecomp-ui/src/sdc-app/features/featureToggle.js | 9 +- openecomp-ui/src/sdc-app/features/restToggle.js | 24 ++ .../sdc-app/onboarding/OnboardingActionHelper.js | 110 ++++----- .../src/sdc-app/onboarding/OnboardingConstants.js | 16 +- .../src/sdc-app/onboarding/OnboardingPunchOut.jsx | 13 +- .../src/sdc-app/onboarding/OnboardingReducers.js | 10 +- .../sdc-app/onboarding/OnboardingReducersMap.js | 6 +- .../ArchivedLicenseModelListReducer.js | 25 ++ .../onboarding/licenseModel/LicenseModel.js | 20 +- .../licenseModel/LicenseModelActionHelper.js | 39 ++-- .../licenseModel/LicenseModelConstants.js | 17 +- .../licenseModel/creation/LicenseModelCreation.js | 27 +-- .../EntitlementPoolsActionHelper.js | 10 +- .../featureGroups/FeatureGroupsActionHelper.js | 6 +- .../LicenseAgreementActionHelper.js | 6 +- .../LicenseKeyGroupsActionHelper.js | 10 +- .../src/sdc-app/onboarding/onboard/CatalogList.jsx | 26 ++- .../onboarding/onboard/DetailsCatalogView.jsx | 6 +- .../src/sdc-app/onboarding/onboard/Onboard.js | 33 ++- .../src/sdc-app/onboarding/onboard/OnboardView.jsx | 7 +- .../sdc-app/onboarding/onboard/filter/Filter.jsx | 34 ++- .../onboarding/onboard/filter/FilterConstants.js | 5 + .../OnboardingCatalogConstants.js | 22 +- .../onboardingCatalog/OnboardingCatalogReducer.js | 18 +- .../onboardingCatalog/OnboardingCatalogView.jsx | 85 +++++-- .../ArchivedSoftwareProductReducer.js | 25 ++ .../onboarding/softwareProduct/SoftwareProduct.js | 6 +- .../softwareProduct/SoftwareProductActionHelper.js | 22 +- .../softwareProduct/SoftwareProductConstants.js | 1 + .../attachments/SoftwareProductAttachmentsView.jsx | 21 +- .../creation/SoftwareProductCreation.js | 13 +- .../details/SoftwareProductDetails.js | 30 ++- .../SoftwareProductDetailsVendorSelector.jsx | 78 +++++++ .../details/SoftwareProductDetailsView.jsx | 77 ++++-- .../userNotifications/UserNotifications.jsx | 21 +- .../UserNotificationsConstants.js | 5 +- .../onboarding/versionsPage/VersionsPage.js | 16 +- .../onboarding/versionsPage/VersionsPage.jsx | 33 ++- .../versionsPage/VersionsPageActionHelper.js | 18 +- .../versionsPage/components/VersionList.jsx | 10 +- 44 files changed, 824 insertions(+), 462 deletions(-) create mode 100644 openecomp-ui/src/sdc-app/features/restToggle.js create mode 100644 openecomp-ui/src/sdc-app/onboarding/licenseModel/ArchivedLicenseModelListReducer.js create mode 100644 openecomp-ui/src/sdc-app/onboarding/softwareProduct/ArchivedSoftwareProductReducer.js create mode 100644 openecomp-ui/src/sdc-app/onboarding/softwareProduct/details/SoftwareProductDetailsVendorSelector.jsx (limited to 'openecomp-ui/src/sdc-app') diff --git a/openecomp-ui/src/sdc-app/common/helpers/ItemsHelper.js b/openecomp-ui/src/sdc-app/common/helpers/ItemsHelper.js index b82bc92017..05affe981f 100644 --- a/openecomp-ui/src/sdc-app/common/helpers/ItemsHelper.js +++ b/openecomp-ui/src/sdc-app/common/helpers/ItemsHelper.js @@ -18,6 +18,19 @@ import Configuration from 'sdc-app/config/Configuration.js'; import {permissionTypes} from 'sdc-app/onboarding/permissions/PermissionsConstants.js'; import {actionsEnum as VersionControllerActionsEnum} from 'nfvo-components/panel/versionController/VersionControllerConstants.js'; import {actionTypes as onboardingActionTypes} from 'sdc-app/onboarding/OnboardingConstants.js'; +import restToggle from 'sdc-app/features/restToggle.js'; +import {featureToggleNames} from 'sdc-app/features/FeaturesConstants.js'; +export const archiveActions = { + ARCHIVE: 'ARCHIVE', + RESTORE: 'RESTORE' +}; + +export const itemStatus = { + ARCHIVED: 'ARCHIVED', + DRAFT: 'Draft', + CERTIFIED: 'Certified' +}; + function baseUrl() { const restPrefix = Configuration.get('restPrefix'); @@ -58,21 +71,36 @@ const ItemsHelper = { return RestAPIUtil.put(`${baseUrl()}/${itemId}/permissions/${permissionTypes.OWNER}`, {removedUsersIds: [], addedUsersIds: [ownerId]}); }, - checkItemStatus(dispatch, {itemId, versionId}) { - return ItemsHelper.fetchVersion({itemId, versionId}).then(response => { - let state = response && response.state || {}; - const {baseId, description, id, name, status} = response; - - dispatch({ - type: onboardingActionTypes.UPDATE_ITEM_STATUS, - itemState: state, - itemStatus: response.status, - updatedVersion: {baseId, description, id, name, status} - }); - return Promise.resolve(response); + async checkItemStatus(dispatch, {itemId, versionId}) { + const response = await ItemsHelper.fetchVersion({itemId, versionId}); + let state = response && response.state || {}; + const {baseId, description, id, name, status} = response; + const item = await ItemsHelper.fetchItem(itemId); + dispatch({ + type: onboardingActionTypes.UPDATE_ITEM_STATUS, + itemState: state, + itemStatus: response.status, + archivedStatus: item.status, + updatedVersion: {baseId, description, id, name, status} }); + return Promise.resolve({...response, archivedStatus: item.status}); }, + + fetchItem(itemId) { + return restToggle({restFunction: () => RestAPIUtil.fetch(`${baseUrl()}/${itemId}`), featureName: featureToggleNames.ARCHIVE_ITEM, mockResult: {}}); + }, + + archiveItem(itemId) { + return RestAPIUtil.put(`${baseUrl()}/${itemId}/actions`, { + action: archiveActions.ARCHIVE + }); + }, + restoreItem(itemId) { + return RestAPIUtil.put(`${baseUrl()}/${itemId}/actions`, { + action: archiveActions.RESTORE + }); + } }; export default ItemsHelper; diff --git a/openecomp-ui/src/sdc-app/common/helpers/ScreensHelper.js b/openecomp-ui/src/sdc-app/common/helpers/ScreensHelper.js index ecee47d8b0..7c05f8456b 100644 --- a/openecomp-ui/src/sdc-app/common/helpers/ScreensHelper.js +++ b/openecomp-ui/src/sdc-app/common/helpers/ScreensHelper.js @@ -8,16 +8,17 @@ import i18n from 'nfvo-utils/i18n/i18n.js'; import {actionTypes as modalActionTypes} from 'nfvo-components/modal/GlobalModalConstants.js'; const ScreensHelper = { - loadScreen(dispatch, {screen, screenType, props}) { + async loadScreen(dispatch, {screen, screenType, props}) { if(screen === enums.SCREEN.ONBOARDING_CATALOG) { OnboardingActionHelper.navigateToOnboardingCatalog(dispatch); return; } - + screenType = !screenType ? this.getScreenType(screen) : screenType; if(screenType === screenTypes.LICENSE_MODEL) { const {licenseModelId, version, licenseModel, usersList} = props; + const item = await ItemsHelper.fetchItem(licenseModelId); let itemStatusPromise = version && screen ? ItemsHelper.checkItemStatus(dispatch, {itemId: licenseModelId, versionId: version.id}) : Promise.resolve(); @@ -34,24 +35,25 @@ const ScreensHelper = { versionPageActionHelper.fetchVersions(dispatch, {itemType: itemTypes.LICENSE_MODEL, itemId: licenseModelId}); } let newVersion = updatedVersion ? updatedVersion : version; + const screenProps = {licenseModelId, version: newVersion, status: item.status}; switch (screen) { case enums.SCREEN.LICENSE_MODEL_OVERVIEW: - OnboardingActionHelper.navigateToLicenseModelOverview(dispatch, {licenseModelId, version: newVersion}); + OnboardingActionHelper.navigateToLicenseModelOverview(dispatch, screenProps); break; case enums.SCREEN.LICENSE_AGREEMENTS: - OnboardingActionHelper.navigateToLicenseAgreements(dispatch, {licenseModelId, version: newVersion}); + OnboardingActionHelper.navigateToLicenseAgreements(dispatch, screenProps); break; case enums.SCREEN.FEATURE_GROUPS: - OnboardingActionHelper.navigateToFeatureGroups(dispatch, {licenseModelId, version: newVersion}); + OnboardingActionHelper.navigateToFeatureGroups(dispatch, screenProps); break; case enums.SCREEN.ENTITLEMENT_POOLS: - OnboardingActionHelper.navigateToEntitlementPools(dispatch, {licenseModelId, version: newVersion}); + OnboardingActionHelper.navigateToEntitlementPools(dispatch, screenProps); break; case enums.SCREEN.LICENSE_KEY_GROUPS: - OnboardingActionHelper.navigateToLicenseKeyGroups(dispatch, {licenseModelId, version: newVersion}); + OnboardingActionHelper.navigateToLicenseKeyGroups(dispatch, screenProps); break; case enums.SCREEN.ACTIVITY_LOG: - OnboardingActionHelper.navigateToLicenseModelActivityLog(dispatch, {licenseModelId, version: newVersion}); + OnboardingActionHelper.navigateToLicenseModelActivityLog(dispatch, screenProps); break; case enums.SCREEN.VERSIONS_PAGE: default: @@ -68,6 +70,7 @@ const ScreensHelper = { else if(screenType === screenTypes.SOFTWARE_PRODUCT) { const {softwareProductId, componentId, version, softwareProduct, usersList} = props; + const item = await ItemsHelper.fetchItem(softwareProductId); let itemStatusPromise = version && screen ? ItemsHelper.checkItemStatus(dispatch, {itemId: softwareProductId, versionId: version.id}) : Promise.resolve(); @@ -85,162 +88,94 @@ const ScreensHelper = { } let newVersion = updatedVersion ? updatedVersion : version; + + const props = { + softwareProductId, + componentId, + version: newVersion, + status: item.status + }; if (screen === screenTypes.SOFTWARE_PRODUCT_COMPONENT_DEFAULT_GENERAL) { - OnboardingActionHelper.navigateToSoftwareProductComponentGeneralAndUpdateLeftPanel(dispatch, { - softwareProductId, - componentId, - version: newVersion - }); + OnboardingActionHelper.navigateToSoftwareProductComponentGeneralAndUpdateLeftPanel(dispatch, props); } - if (componentId) { - switch (screen) { - case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENTS: - OnboardingActionHelper.navigateToSoftwareProductComponentGeneralAndUpdateLeftPanel(dispatch, { - softwareProductId, - componentId, - version: newVersion - }); - break; - case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_GENERAL: - OnboardingActionHelper.navigateToSoftwareProductComponentGeneral(dispatch, { - softwareProductId, - componentId, - version: newVersion - }); - break; - case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_COMPUTE: - OnboardingActionHelper.navigateToComponentCompute(dispatch, { - softwareProductId, - componentId, - version: newVersion - }); - break; - case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_LOAD_BALANCING: - OnboardingActionHelper.navigateToComponentLoadBalancing(dispatch, { - softwareProductId, - componentId, - version: newVersion - }); - break; - case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_NETWORK: - OnboardingActionHelper.navigateToComponentNetwork(dispatch, { - softwareProductId, - componentId, - version: newVersion - }); - break; - case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_STORAGE: - OnboardingActionHelper.navigateToComponentStorage(dispatch, { - softwareProductId, - componentId, - version: newVersion - }); - break; - case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_PROCESSES: - OnboardingActionHelper.navigateToSoftwareProductComponentProcesses(dispatch, { - softwareProductId, - componentId, - version: newVersion - }); - break; - case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_MONITORING: - OnboardingActionHelper.navigateToSoftwareProductComponentMonitoring(dispatch, { - softwareProductId, - componentId, - version: newVersion - }); - break; - case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_IMAGES: - OnboardingActionHelper.navigateToComponentImages(dispatch, { - softwareProductId, - componentId, - version: newVersion - }); - break; - } - } - else { - switch (screen) { - case enums.SCREEN.SOFTWARE_PRODUCT_LANDING_PAGE: - OnboardingActionHelper.navigateToSoftwareProductLandingPage(dispatch, { - softwareProductId, - version: newVersion - }); - break; - case enums.SCREEN.SOFTWARE_PRODUCT_DETAILS: - OnboardingActionHelper.navigateToSoftwareProductDetails(dispatch, { - softwareProductId, - version: newVersion - }); - break; - case enums.SCREEN.SOFTWARE_PRODUCT_ATTACHMENTS_SETUP: - OnboardingActionHelper.navigateToSoftwareProductAttachmentsSetupTab(dispatch, { - softwareProductId, - version - }); - break; - case enums.SCREEN.SOFTWARE_PRODUCT_ATTACHMENTS_VALIDATION: - OnboardingActionHelper.navigateToSoftwareProductAttachmentsValidationTab(dispatch, { - softwareProductId, - version - }); - break; - case enums.SCREEN.SOFTWARE_PRODUCT_PROCESSES: - OnboardingActionHelper.navigateToSoftwareProductProcesses(dispatch, { - softwareProductId, - version: newVersion - }); - break; - case enums.SCREEN.SOFTWARE_PRODUCT_DEPLOYMENT: - OnboardingActionHelper.navigateToSoftwareProductDeployment(dispatch, { - softwareProductId, - version: newVersion - }); - break; - case enums.SCREEN.SOFTWARE_PRODUCT_NETWORKS: - OnboardingActionHelper.navigateToSoftwareProductNetworks(dispatch, { - softwareProductId, - version: newVersion - }); - break; - case enums.SCREEN.SOFTWARE_PRODUCT_DEPENDENCIES: - OnboardingActionHelper.navigateToSoftwareProductDependencies(dispatch, { - softwareProductId, - version: newVersion - }); - break; - case enums.SCREEN.SOFTWARE_PRODUCT_ACTIVITY_LOG: - OnboardingActionHelper.navigateToSoftwareProductActivityLog(dispatch, { - softwareProductId, - version: newVersion - }); - break; - case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENTS: - OnboardingActionHelper.navigateToSoftwareProductComponents(dispatch, { - softwareProductId, - version: newVersion - }); - dispatch({ - type: SoftwareProductActionTypes.TOGGLE_NAVIGATION_ITEM, - mapOfExpandedIds: { - [enums.SCREEN.SOFTWARE_PRODUCT_COMPONENTS]: true - } - }); - break; - case enums.SCREEN.SOFTWARE_PRODUCT_VERSIONS_PAGE: - default: - OnboardingActionHelper.navigateToVersionsPage(dispatch, { - itemId: softwareProductId, - itemType: itemTypes.SOFTWARE_PRODUCT, - itemName: softwareProduct.name, - users: usersList, - additionalProps: { - licenseModelId: softwareProduct.vendorId, - licensingVersion: softwareProduct.licensingVersion - } - }); - break; - } + + switch (screen) { + case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENTS: + OnboardingActionHelper.navigateToSoftwareProductComponentGeneralAndUpdateLeftPanel(dispatch, props); + break; + case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_GENERAL: + OnboardingActionHelper.navigateToSoftwareProductComponentGeneral(dispatch, props); + break; + case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_COMPUTE: + OnboardingActionHelper.navigateToComponentCompute(dispatch, props); + break; + case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_LOAD_BALANCING: + OnboardingActionHelper.navigateToComponentLoadBalancing(dispatch, props); + break; + case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_NETWORK: + OnboardingActionHelper.navigateToComponentNetwork(dispatch, props); + break; + case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_STORAGE: + OnboardingActionHelper.navigateToComponentStorage(dispatch, props); + break; + case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_PROCESSES: + OnboardingActionHelper.navigateToSoftwareProductComponentProcesses(dispatch, props); + break; + case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_MONITORING: + OnboardingActionHelper.navigateToSoftwareProductComponentMonitoring(dispatch, props); + break; + case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_IMAGES: + OnboardingActionHelper.navigateToComponentImages(dispatch, props); + break; + case enums.SCREEN.SOFTWARE_PRODUCT_LANDING_PAGE: + OnboardingActionHelper.navigateToSoftwareProductLandingPage(dispatch, props); + break; + case enums.SCREEN.SOFTWARE_PRODUCT_DETAILS: + OnboardingActionHelper.navigateToSoftwareProductDetails(dispatch, props); + break; + case enums.SCREEN.SOFTWARE_PRODUCT_ATTACHMENTS_SETUP: + OnboardingActionHelper.navigateToSoftwareProductAttachmentsSetupTab(dispatch, props); + break; + case enums.SCREEN.SOFTWARE_PRODUCT_ATTACHMENTS_VALIDATION: + OnboardingActionHelper.navigateToSoftwareProductAttachmentsValidationTab(dispatch, props); + break; + case enums.SCREEN.SOFTWARE_PRODUCT_PROCESSES: + OnboardingActionHelper.navigateToSoftwareProductProcesses(dispatch, props); + break; + case enums.SCREEN.SOFTWARE_PRODUCT_DEPLOYMENT: + OnboardingActionHelper.navigateToSoftwareProductDeployment(dispatch, props); + break; + case enums.SCREEN.SOFTWARE_PRODUCT_NETWORKS: + OnboardingActionHelper.navigateToSoftwareProductNetworks(dispatch, props); + break; + case enums.SCREEN.SOFTWARE_PRODUCT_DEPENDENCIES: + OnboardingActionHelper.navigateToSoftwareProductDependencies(dispatch, props); + break; + case enums.SCREEN.SOFTWARE_PRODUCT_ACTIVITY_LOG: + OnboardingActionHelper.navigateToSoftwareProductActivityLog(dispatch, props); + break; + case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENTS: + OnboardingActionHelper.navigateToSoftwareProductComponents(dispatch, props); + dispatch({ + type: SoftwareProductActionTypes.TOGGLE_NAVIGATION_ITEM, + mapOfExpandedIds: { + [enums.SCREEN.SOFTWARE_PRODUCT_COMPONENTS]: true + } + }); + break; + case enums.SCREEN.SOFTWARE_PRODUCT_VERSIONS_PAGE: + default: + OnboardingActionHelper.navigateToVersionsPage(dispatch, { + itemId: softwareProductId, + itemType: itemTypes.SOFTWARE_PRODUCT, + itemName: softwareProduct.name, + users: usersList, + additionalProps: { + licenseModelId: softwareProduct.vendorId, + licensingVersion: softwareProduct.licensingVersion + } + }); + break; } }); } diff --git a/openecomp-ui/src/sdc-app/common/modal/ModalContentMapper.js b/openecomp-ui/src/sdc-app/common/modal/ModalContentMapper.js index 487ada0d88..b17536f446 100644 --- a/openecomp-ui/src/sdc-app/common/modal/ModalContentMapper.js +++ b/openecomp-ui/src/sdc-app/common/modal/ModalContentMapper.js @@ -29,6 +29,7 @@ import CommitCommentModal from 'nfvo-components/panel/versionController/componen import Tree from 'nfvo-components/tree/Tree.jsx'; import MergeEditor from 'sdc-app/common/merge/MergeEditor.js'; import Revisions from 'sdc-app/onboarding/revisions/Revisions.js'; +import VendorSelector from 'sdc-app/onboarding/softwareProduct/details/SoftwareProductDetailsVendorSelector.jsx'; export const modalContentMapper = { SOFTWARE_PRODUCT_CREATION: 'SOFTWARE_PRODUCT_CREATION', @@ -45,7 +46,9 @@ export const modalContentMapper = { COMMIT_COMMENT: 'COMMIT_COMMENT', VERSION_TREE: 'VERSION_TREE', MERGE_EDITOR: 'MERGE_EDITOR', - REVISIONS_LIST: 'REVISIONS_LIST' + REVISIONS_LIST: 'REVISIONS_LIST', + VENDOR_SELECTOR: 'VENDOR_SELECTOR' + }; export const modalContentComponents = { @@ -63,5 +66,6 @@ export const modalContentComponents = { COMMIT_COMMENT: CommitCommentModal, VERSION_TREE: Tree, MERGE_EDITOR: MergeEditor, - REVISIONS_LIST: Revisions + REVISIONS_LIST: Revisions, + VENDOR_SELECTOR: VendorSelector }; diff --git a/openecomp-ui/src/sdc-app/features/FeaturesConstants.js b/openecomp-ui/src/sdc-app/features/FeaturesConstants.js index fe3d4a474e..f962d243d5 100644 --- a/openecomp-ui/src/sdc-app/features/FeaturesConstants.js +++ b/openecomp-ui/src/sdc-app/features/FeaturesConstants.js @@ -17,4 +17,9 @@ import keyMirror from 'nfvo-utils/KeyMirror.js'; export const actionTypes = keyMirror({ FEATURES_LIST_LOADED: null -}); \ No newline at end of file +}); + +export const featureToggleNames = { + ARCHIVE_ITEM: 'ARCHIVE_ITEM', + FILTER: 'FILTER' +}; \ No newline at end of file diff --git a/openecomp-ui/src/sdc-app/features/featureToggle.js b/openecomp-ui/src/sdc-app/features/featureToggle.js index ffdd19aabf..5e0df1448f 100644 --- a/openecomp-ui/src/sdc-app/features/featureToggle.js +++ b/openecomp-ui/src/sdc-app/features/featureToggle.js @@ -37,8 +37,13 @@ import React from 'react'; import PropTypes from 'prop-types'; import {connect} from 'react-redux'; -export const FeatureComponent = ({features = [], featureName, InnerComponent}) => { - return !!features.find(el => el.name === featureName && el.active) ? : null; +export const FeatureComponent = (props) => { + const {features = [], featureName, InnerComponent, ...otherProps} = props; + const AComp = InnerComponent.AComp ? InnerComponent.AComp : InnerComponent; + + return !!features.find(el => el.name === featureName && el.active) ? + + : InnerComponent.BComp ? : null; }; FeatureComponent.propTypes = { diff --git a/openecomp-ui/src/sdc-app/features/restToggle.js b/openecomp-ui/src/sdc-app/features/restToggle.js new file mode 100644 index 0000000000..c90521dd7e --- /dev/null +++ b/openecomp-ui/src/sdc-app/features/restToggle.js @@ -0,0 +1,24 @@ +/*! + * 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ + +import store from 'sdc-app/AppStore.js'; + + +export default ({featureName, restFunction, mockResult}) => { + const {features} = store.getState(); + return !!features.find(el => el.name === featureName && el.active) ? + restFunction() : Promise.resolve(mockResult); +}; \ No newline at end of file diff --git a/openecomp-ui/src/sdc-app/onboarding/OnboardingActionHelper.js b/openecomp-ui/src/sdc-app/onboarding/OnboardingActionHelper.js index 4c4c709a7b..d75c234caf 100644 --- a/openecomp-ui/src/sdc-app/onboarding/OnboardingActionHelper.js +++ b/openecomp-ui/src/sdc-app/onboarding/OnboardingActionHelper.js @@ -66,8 +66,10 @@ const OnboardingActionHelper = { loadItemsLists(dispatch) { LicenseModelActionHelper.fetchLicenseModels(dispatch); LicenseModelActionHelper.fetchFinalizedLicenseModels(dispatch); + LicenseModelActionHelper.fetchArchivedLicenseModels(dispatch); SoftwareProductActionHelper.fetchSoftwareProductList(dispatch); SoftwareProductActionHelper.fetchFinalizedSoftwareProductList(dispatch); + SoftwareProductActionHelper.fetchArchivedSoftwareProductList(dispatch); }, navigateToOnboardingCatalog(dispatch) { @@ -95,7 +97,7 @@ const OnboardingActionHelper = { return Promise.resolve(); }, - navigateToLicenseModelOverview(dispatch, {licenseModelId, version}) { + navigateToLicenseModelOverview(dispatch, {licenseModelId, version, status}) { /** * TODO change to specific rest @@ -103,39 +105,39 @@ const OnboardingActionHelper = { LicenseModelActionHelper.fetchLicenseModelById(dispatch, {licenseModelId, version}).then(() => { LicenseModelActionHelper.fetchLicenseModelItems(dispatch, {licenseModelId, version}).then(() => { - setCurrentScreen(dispatch, enums.SCREEN.LICENSE_MODEL_OVERVIEW, {licenseModelId, version}); + setCurrentScreen(dispatch, enums.SCREEN.LICENSE_MODEL_OVERVIEW, {licenseModelId, version, status}); }); licenseModelOverviewActionHelper.selectVLMListView(dispatch, {buttonTab: null}); }); }, - navigateToLicenseAgreements(dispatch, {licenseModelId, version}) { + navigateToLicenseAgreements(dispatch, {licenseModelId, version, status}) { LicenseAgreementActionHelper.fetchLicenseAgreementList(dispatch, {licenseModelId, version}); LicenseModelActionHelper.fetchLicenseModelById(dispatch, {licenseModelId, version}).then(() => { - setCurrentScreen(dispatch, enums.SCREEN.LICENSE_AGREEMENTS, {licenseModelId, version}); + setCurrentScreen(dispatch, enums.SCREEN.LICENSE_AGREEMENTS, {licenseModelId, version, status}); }); }, - navigateToFeatureGroups(dispatch, {licenseModelId, version}) { + navigateToFeatureGroups(dispatch, {licenseModelId, version, status}) { FeatureGroupsActionHelper.fetchFeatureGroupsList(dispatch, {licenseModelId, version}); - setCurrentScreen(dispatch, enums.SCREEN.FEATURE_GROUPS, {licenseModelId, version}); + setCurrentScreen(dispatch, enums.SCREEN.FEATURE_GROUPS, {licenseModelId, version, status}); }, - navigateToEntitlementPools(dispatch, {licenseModelId, version}) { + navigateToEntitlementPools(dispatch, {licenseModelId, version, status}) { EntitlementPoolsActionHelper.fetchEntitlementPoolsList(dispatch, {licenseModelId, version}); - setCurrentScreen(dispatch, enums.SCREEN.ENTITLEMENT_POOLS, {licenseModelId, version}); + setCurrentScreen(dispatch, enums.SCREEN.ENTITLEMENT_POOLS, {licenseModelId, version, status}); }, - navigateToLicenseKeyGroups(dispatch, {licenseModelId, version}) { + navigateToLicenseKeyGroups(dispatch, {licenseModelId, version, status}) { LicenseKeyGroupsActionHelper.fetchLicenseKeyGroupsList(dispatch, {licenseModelId, version}); - setCurrentScreen(dispatch, enums.SCREEN.LICENSE_KEY_GROUPS, {licenseModelId, version}); + setCurrentScreen(dispatch, enums.SCREEN.LICENSE_KEY_GROUPS, {licenseModelId, version, status}); }, - navigateToLicenseModelActivityLog(dispatch, {licenseModelId, version}){ + navigateToLicenseModelActivityLog(dispatch, {licenseModelId, version, status}){ ActivityLogActionHelper.fetchActivityLog(dispatch, {itemId: licenseModelId, versionId: version.id}); - setCurrentScreen(dispatch, enums.SCREEN.ACTIVITY_LOG, {licenseModelId, version}); + setCurrentScreen(dispatch, enums.SCREEN.ACTIVITY_LOG, {licenseModelId, version, status}); }, - navigateToSoftwareProductLandingPage(dispatch, {softwareProductId, version}) { + navigateToSoftwareProductLandingPage(dispatch, {softwareProductId, version, status}) { SoftwareProductComponentsActionHelper.clearComponentsStore(dispatch); SoftwareProductActionHelper.fetchSoftwareProduct(dispatch, {softwareProductId, version}).then(response => { let {vendorId: licenseModelId, licensingVersion} = response[0]; @@ -144,112 +146,112 @@ const OnboardingActionHelper = { if(response[0].onboardingOrigin === onboardingOriginTypes.ZIP) { SoftwareProductActionHelper.loadSoftwareProductHeatCandidate(dispatch, {softwareProductId, version: version}); } - setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_LANDING_PAGE, {softwareProductId, licenseModelId, version}); + setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_LANDING_PAGE, {softwareProductId, licenseModelId, version, status}); }); }, - navigateToSoftwareProductDetails(dispatch, {softwareProductId, version}) { + navigateToSoftwareProductDetails(dispatch, {softwareProductId, version, status}) { SoftwareProductActionHelper.fetchSoftwareProduct(dispatch, {softwareProductId, version}).then(response => { let {vendorId: licenseModelId, licensingVersion} = response[0]; SoftwareProductActionHelper.loadLicensingVersionsList(dispatch, {licenseModelId}); SoftwareProductActionHelper.loadSoftwareProductDetailsData(dispatch, {licenseModelId, licensingVersion}); - setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_DETAILS, {softwareProductId, version}); + setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_DETAILS, {softwareProductId, version, status}); }); }, - navigateToSoftwareProductAttachmentsSetupTab(dispatch, {softwareProductId, version}) { + navigateToSoftwareProductAttachmentsSetupTab(dispatch, {softwareProductId, version, status}) { SoftwareProductActionHelper.loadSoftwareProductHeatCandidate(dispatch, {softwareProductId, version}); SoftwareProductAttachmentsActionHelper.setActiveTab(dispatch, {activeTab: attachmentsTabsMapping.SETUP}); - setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_ATTACHMENTS, {softwareProductId, version}); + setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_ATTACHMENTS, {softwareProductId, version, status}); }, - navigateToSoftwareProductAttachmentsValidationTab(dispatch, {softwareProductId, version}) { + navigateToSoftwareProductAttachmentsValidationTab(dispatch, {softwareProductId, version, status}) { SoftwareProductActionHelper.processAndValidateHeatCandidate(dispatch, {softwareProductId, version}).then(() => { SoftwareProductAttachmentsActionHelper.setActiveTab(dispatch, {activeTab: attachmentsTabsMapping.VALIDATION}); - setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_ATTACHMENTS, {softwareProductId, version}); + setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_ATTACHMENTS, {softwareProductId, version, status}); }); }, - navigateToSoftwareProductProcesses(dispatch, {softwareProductId, version}) { + navigateToSoftwareProductProcesses(dispatch, {softwareProductId, version, status}) { if (softwareProductId) { SoftwareProductProcessesActionHelper.fetchProcessesList(dispatch, {softwareProductId, version}); } - setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_PROCESSES, {softwareProductId, version}); + setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_PROCESSES, {softwareProductId, version, status}); }, - navigateToSoftwareProductNetworks(dispatch, {softwareProductId, version}) { + navigateToSoftwareProductNetworks(dispatch, {softwareProductId, version, status}) { if (softwareProductId) { SoftwareProductNetworksActionHelper.fetchNetworksList(dispatch, {softwareProductId, version}); } - setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_NETWORKS, {softwareProductId, version}); + setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_NETWORKS, {softwareProductId, version, status}); }, - navigateToSoftwareProductDependencies(dispatch, {softwareProductId, version}) { + navigateToSoftwareProductDependencies(dispatch, {softwareProductId, version, status}) { SoftwareProductComponentsActionHelper.fetchSoftwareProductComponents(dispatch, {softwareProductId, version}).then(result => { if(result.listCount >= 2) { SoftwareProductDependenciesActionHelper.fetchDependencies(dispatch, {softwareProductId, version}); - setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_DEPENDENCIES, {softwareProductId, version}); + setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_DEPENDENCIES, {softwareProductId, version, status}); } else { - this.navigateToSoftwareProductLandingPage(dispatch, {softwareProductId, version}); + this.navigateToSoftwareProductLandingPage(dispatch, {softwareProductId, version, status}); } }); }, - navigateToSoftwareProductComponents(dispatch, {softwareProductId, version}) { + navigateToSoftwareProductComponents(dispatch, {softwareProductId, version, status}) { SoftwareProductComponentsActionHelper.fetchSoftwareProductComponents(dispatch, {softwareProductId, version}); - setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_COMPONENTS, {softwareProductId, version}); + setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_COMPONENTS, {softwareProductId, version, status}); }, - navigateToSoftwareProductDeployment(dispatch, {softwareProductId, version}) { + navigateToSoftwareProductDeployment(dispatch, {softwareProductId, version, status}) { SoftwareProductDeploymentActionHelper.fetchDeploymentFlavorsList(dispatch, {softwareProductId, version}); ComputeFlavorActionHelper.fetchComputesListForVSP(dispatch, {softwareProductId, version}); - setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_DEPLOYMENT, {softwareProductId, version}); + setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_DEPLOYMENT, {softwareProductId, version, status}); }, - navigateToSoftwareProductActivityLog(dispatch, {softwareProductId, version}){ + navigateToSoftwareProductActivityLog(dispatch, {softwareProductId, version, status}){ ActivityLogActionHelper.fetchActivityLog(dispatch, {itemId: softwareProductId, versionId: version.id}); - setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_ACTIVITY_LOG, {softwareProductId, version}); + setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_ACTIVITY_LOG, {softwareProductId, version, status}); }, - navigateToSoftwareProductComponentProcesses(dispatch, {softwareProductId, componentId, version}) { + navigateToSoftwareProductComponentProcesses(dispatch, {softwareProductId, componentId, version, status}) { if (componentId && softwareProductId) { SoftwareProductComponentProcessesActionHelper.fetchProcessesList(dispatch, {componentId, softwareProductId, version}); } - setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_PROCESSES, {softwareProductId, componentId, version}); + setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_PROCESSES, {softwareProductId, componentId, version, status}); }, - navigateToSoftwareProductComponentMonitoring(dispatch, {softwareProductId, version, componentId}){ + navigateToSoftwareProductComponentMonitoring(dispatch, {softwareProductId, version, componentId, status}){ if (componentId && softwareProductId && version) { SoftwareProductComponentsMonitoringAction.fetchExistingFiles(dispatch, {componentId, softwareProductId, version}); } - setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_MONITORING, {softwareProductId, componentId, version}); + setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_MONITORING, {softwareProductId, componentId, version, status}); }, - navigateToComponentStorage(dispatch, {softwareProductId, componentId, version}) { + navigateToComponentStorage(dispatch, {softwareProductId, componentId, version, status}) { SoftwareProductComponentsActionHelper.fetchSoftwareProductComponent(dispatch, {softwareProductId, vspComponentId: componentId, version}); - setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_STORAGE, {softwareProductId, version, componentId}); + setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_STORAGE, {softwareProductId, version, componentId, status}); }, - navigateToComponentCompute(dispatch, {softwareProductId, componentId, version}) { + navigateToComponentCompute(dispatch, {softwareProductId, componentId, version, status}) { SoftwareProductComponentsActionHelper.fetchSoftwareProductComponent(dispatch, {softwareProductId, vspComponentId: componentId, version}); if (componentId && softwareProductId) { ComputeFlavorActionHelper.fetchComputesList(dispatch, {softwareProductId, componentId, version}); } - setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_COMPUTE, {softwareProductId, version, componentId}); + setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_COMPUTE, {softwareProductId, version, componentId, status}); }, - navigateToComponentNetwork(dispatch, {softwareProductId, componentId, version}) { + navigateToComponentNetwork(dispatch, {softwareProductId, componentId, version, status}) { SoftwareProductComponentsNetworkActionHelper.fetchNICsList(dispatch, {softwareProductId, componentId, version}); - setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_NETWORK, {softwareProductId, version, componentId}); + setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_NETWORK, {softwareProductId, version, componentId, status}); }, - navigateToSoftwareProductComponentGeneral(dispatch, {softwareProductId, componentId, version}) { + navigateToSoftwareProductComponentGeneral(dispatch, {softwareProductId, componentId, version, status}) { if (componentId && softwareProductId) { SoftwareProductComponentsActionHelper.fetchSoftwareProductComponent(dispatch, {softwareProductId, vspComponentId: componentId, version}); } - setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_GENERAL, {softwareProductId, version, componentId}); + setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_GENERAL, {softwareProductId, version, componentId, status}); }, - navigateToSoftwareProductComponentGeneralAndUpdateLeftPanel(dispatch, {softwareProductId, componentId, version}) { - this.navigateToSoftwareProductComponentGeneral(dispatch, {softwareProductId, componentId, version}); + navigateToSoftwareProductComponentGeneralAndUpdateLeftPanel(dispatch, {softwareProductId, componentId, version, status}) { + this.navigateToSoftwareProductComponentGeneral(dispatch, {softwareProductId, componentId, version, status}); dispatch({ type: SoftwareProductActionTypes.TOGGLE_NAVIGATION_ITEM, mapOfExpandedIds: { @@ -259,26 +261,30 @@ const OnboardingActionHelper = { }); }, - navigateToComponentLoadBalancing(dispatch, {softwareProductId, componentId, version}) { + navigateToComponentLoadBalancing(dispatch, {softwareProductId, componentId, version, status}) { SoftwareProductComponentsActionHelper.fetchSoftwareProductComponent(dispatch, {softwareProductId, vspComponentId: componentId, version}); - setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_LOAD_BALANCING, {softwareProductId, version, componentId}); + setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_LOAD_BALANCING, {softwareProductId, version, componentId, status}); }, - navigateToComponentImages(dispatch, {softwareProductId, componentId, version}) { + navigateToComponentImages(dispatch, {softwareProductId, componentId, version, status}) { SoftwareProductComponentsImageActionHelper.fetchImagesList(dispatch, { softwareProductId, componentId, version }); - setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_IMAGES, {softwareProductId, version, componentId}); + setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_IMAGES, {softwareProductId, version, componentId, status}); }, navigateToVersionsPage(dispatch, {itemType, itemId, itemName, additionalProps, users}) { PermissionsActionHelper.fetchItemUsers(dispatch, {itemId, allUsers: users}); VersionsPageActionHelper.selectNone(dispatch); VersionsPageActionHelper.fetchVersions(dispatch, {itemType, itemId}).then(() => { - setCurrentScreen(dispatch, enums.SCREEN.VERSIONS_PAGE, {itemType, itemId, itemName, additionalProps}); + ItemsHelper.fetchItem(itemId).then(result => { + setCurrentScreen(dispatch, enums.SCREEN.VERSIONS_PAGE, {status: result.status, itemType, itemId, itemName, additionalProps}); + }); + }); + }, checkMergeStatus(dispatch, {itemId, versionId, version}) { diff --git a/openecomp-ui/src/sdc-app/onboarding/OnboardingConstants.js b/openecomp-ui/src/sdc-app/onboarding/OnboardingConstants.js index 5b33fc2099..699fe9e357 100644 --- a/openecomp-ui/src/sdc-app/onboarding/OnboardingConstants.js +++ b/openecomp-ui/src/sdc-app/onboarding/OnboardingConstants.js @@ -1,17 +1,17 @@ -/*! - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. +/* + * 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. * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + * + * http://www.apache.org/licenses/LICENSE-2.0 + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing - * permissions and limitations under the License. + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ import keyMirror from 'nfvo-utils/KeyMirror.js'; diff --git a/openecomp-ui/src/sdc-app/onboarding/OnboardingPunchOut.jsx b/openecomp-ui/src/sdc-app/onboarding/OnboardingPunchOut.jsx index fbb12022c1..e04f9b7309 100644 --- a/openecomp-ui/src/sdc-app/onboarding/OnboardingPunchOut.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/OnboardingPunchOut.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. @@ -80,7 +80,6 @@ export default class OnboardingPunchOut { }); } this.rendered = true; - } } @@ -96,9 +95,9 @@ export default class OnboardingPunchOut { let dispatch = action => store.dispatch(action); let {currentScreen, users: {usersList}, softwareProductList, finalizedSoftwareProductList, licenseModelList, finalizedLicenseModelList, softwareProduct: {softwareProductEditor: {data: vspData = {}}, - softwareProductComponents = {}, softwareProductQuestionnaire = {}}} = store.getState(); + softwareProductComponents = {}, softwareProductQuestionnaire = {}}, archivedLicenseModelList} = store.getState(); const wholeSoftwareProductList = [...softwareProductList, ...finalizedSoftwareProductList]; - const wholeLicenseModelList = [...licenseModelList, ...finalizedLicenseModelList]; + const wholeLicenseModelList = [...licenseModelList, ...finalizedLicenseModelList, ...archivedLicenseModelList]; let {props: {version, isReadOnlyMode}, screen} = currentScreen; let {componentEditor: {data: componentData = {}, qdata: componentQData = {}}} = softwareProductComponents; @@ -200,9 +199,9 @@ export default class OnboardingPunchOut { let {currentScreen, licenseModelList, finalizedLicenseModelList, softwareProductList, finalizedSoftwareProductList, versionsPage: {versionsList: {itemType, itemId}}, softwareProduct: {softwareProductEditor: {data: currentSoftwareProduct = {onboardingMethod: ''}}, - softwareProductComponents: {componentsList}}} = store.getState(); - const wholeSoftwareProductList = lodashUnionBy(softwareProductList, finalizedSoftwareProductList, 'id'); - const wholeLicenseModelList = lodashUnionBy(licenseModelList, finalizedLicenseModelList, 'id'); + softwareProductComponents: {componentsList}}, archivedLicenseModelList, archivedSoftwareProductList} = store.getState(); + const wholeSoftwareProductList = lodashUnionBy(softwareProductList, [...finalizedSoftwareProductList, ...archivedSoftwareProductList], 'id'); + const wholeLicenseModelList = lodashUnionBy(licenseModelList, [...finalizedLicenseModelList, ...archivedLicenseModelList], 'id'); let breadcrumbsData = {itemType, itemId, currentScreen, wholeLicenseModelList, wholeSoftwareProductList, currentSoftwareProduct, componentsList}; if (currentScreen.forceBreadCrumbsUpdate || !isEqual(breadcrumbsData, this.prevBreadcrumbsData) || this.breadcrumbsPrefixSelected) { diff --git a/openecomp-ui/src/sdc-app/onboarding/OnboardingReducers.js b/openecomp-ui/src/sdc-app/onboarding/OnboardingReducers.js index 2eb455f9dd..16c0e61491 100644 --- a/openecomp-ui/src/sdc-app/onboarding/OnboardingReducers.js +++ b/openecomp-ui/src/sdc-app/onboarding/OnboardingReducers.js @@ -23,7 +23,7 @@ import {SyncStates} from 'sdc-app/common/merge/MergeEditorConstants.js'; import {catalogItemStatuses} from './onboard/onboardingCatalog/OnboardingCatalogConstants.js'; import Configuration from 'sdc-app/config/Configuration.js'; -const checkReadOnly = ({isCollaborator = true, inMerge = false, isCertified = false}) => !isCollaborator || inMerge || isCertified; +const checkReadOnly = ({isCollaborator = true, inMerge = false, isCertified = false, isArchived = false}) => !isCollaborator || inMerge || isCertified || isArchived; const currentScreen = (state = { forceBreadCrumbsUpdate: false, @@ -37,6 +37,7 @@ const currentScreen = (state = { case actionTypes.SET_CURRENT_SCREEN: { let itemPermission = {...state.itemPermission}; let {currentScreen} = action; + itemPermission.isArchived = currentScreen.props.status === catalogItemStatuses.ARCHIVED; if (currentScreen.props.version) { let {status} = currentScreen.props.version; @@ -70,7 +71,7 @@ const currentScreen = (state = { props: { ...state.props, version: action.version, - isReadOnlyMode: checkReadOnly(state.itemPermission) + isReadOnlyMode: checkReadOnly({...state.itemPermission,itemStatus: state.props.status}) } }; @@ -114,12 +115,13 @@ const currentScreen = (state = { } case actionTypes.UPDATE_ITEM_STATUS: { - const {itemState: {synchronizationState, dirty}, itemStatus, updatedVersion} = action; + const {itemState: {synchronizationState, dirty}, itemStatus, updatedVersion, archivedStatus} = action; const inMerge = synchronizationState === SyncStates.MERGE; const isOutOfSync = synchronizationState === SyncStates.OUT_OF_SYNC; const isUpToDate = synchronizationState === SyncStates.UP_TO_DATE; const isCertified = itemStatus === catalogItemStatuses.CERTIFIED; - const itemPermission = {...state.itemPermission, inMerge, isDirty: dirty, isOutOfSync, isUpToDate, isCertified}; + const isArchived = archivedStatus === catalogItemStatuses.ARCHIVED; + const itemPermission = {...state.itemPermission, inMerge, isDirty: dirty, isOutOfSync, isUpToDate, isCertified, isArchived}; const isReadOnlyMode = checkReadOnly(itemPermission); const props = {...state.props, isReadOnlyMode, version: {...state.props.version, ...updatedVersion}}; diff --git a/openecomp-ui/src/sdc-app/onboarding/OnboardingReducersMap.js b/openecomp-ui/src/sdc-app/onboarding/OnboardingReducersMap.js index 12304fcbce..5b678b1d43 100644 --- a/openecomp-ui/src/sdc-app/onboarding/OnboardingReducersMap.js +++ b/openecomp-ui/src/sdc-app/onboarding/OnboardingReducersMap.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. @@ -16,10 +16,12 @@ import currentScreenReducer from './OnboardingReducers.js'; import licenseModelListReducer from './licenseModel/LicenseModelListReducer.js'; import finalizedLicenseModelListReducer from './licenseModel/FinalizedLicenseModelListReducer.js'; +import archivedLicenseModelListReducer from './licenseModel/ArchivedLicenseModelListReducer.js'; import licenseModelReducer from './licenseModel/LicenseModelReducer.js'; import softwareProductReducer from './softwareProduct/SoftwareProductReducer.js'; import softwareProductListReducer from './softwareProduct/SoftwareProductListReducer.js'; import finalizedSoftwareProductReducer from './softwareProduct/FinalizedSoftwareProductReducer.js'; +import archivedSoftwareProductListReducer from './softwareProduct/ArchivedSoftwareProductReducer.js'; import onboardReducer from './onboard/OnboardReducer.js'; import versionsPageReducer from './versionsPage/VersionsPageReducer.js'; import usersReducer from './users/UsersReducers.js'; @@ -31,6 +33,8 @@ export default { currentScreen: currentScreenReducer, licenseModel: licenseModelReducer, licenseModelList: licenseModelListReducer, + archivedLicenseModelList: archivedLicenseModelListReducer, + archivedSoftwareProductList: archivedSoftwareProductListReducer, finalizedLicenseModelList: finalizedLicenseModelListReducer, finalizedSoftwareProductList: finalizedSoftwareProductReducer, mergeEditor: mergeEditorReducer, diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/ArchivedLicenseModelListReducer.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/ArchivedLicenseModelListReducer.js new file mode 100644 index 0000000000..8e4750e666 --- /dev/null +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/ArchivedLicenseModelListReducer.js @@ -0,0 +1,25 @@ +/* + * 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import {actionTypes} from './LicenseModelConstants.js'; + +export default (state = [], action) => { + switch (action.type) { + case actionTypes.ARCHIVED_LICENSE_MODELS_LIST_LOADED: + return [...action.response.results]; + default: + return state; + } +}; diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/LicenseModel.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/LicenseModel.js index 73027c7e36..c390ecc9b0 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/LicenseModel.js +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/LicenseModel.js @@ -1,17 +1,17 @@ -/*! - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. +/* + * 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. * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + * + * http://www.apache.org/licenses/LICENSE-2.0 + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing - * permissions and limitations under the License. + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ import {connect} from 'react-redux'; @@ -28,7 +28,6 @@ import {actionTypes as modalActionTypes} from 'nfvo-components/modal/GlobalModal import {modalContentMapper} from 'sdc-app/common/modal/ModalContentMapper.js'; import {CommitModalType} from 'nfvo-components/panel/versionController/components/CommitCommentModal.jsx'; - const buildNavigationBarProps = (licenseModel, screen) => { const {id, vendorName, version} = licenseModel; const meta = {version}; @@ -83,6 +82,7 @@ const buildVersionControllerProps = ({ userInfo, usersList, permissions, + isArchived, itemPermission, isReadOnlyMode }) => { @@ -94,6 +94,7 @@ const buildVersionControllerProps = ({ permissions, userInfo, usersList, + isArchived, itemName: licenseModelEditor.data.vendorName, itemPermission, isReadOnlyMode @@ -116,6 +117,7 @@ const mapStateToProps = ({ userInfo, permissions, usersList, + isArchived: itemPermission.isArchived, itemPermission, isReadOnlyMode }), diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/LicenseModelActionHelper.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/LicenseModelActionHelper.js index ff264b3003..d1d3a77d92 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/LicenseModelActionHelper.js +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/LicenseModelActionHelper.js @@ -1,17 +1,17 @@ -/*! - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. +/* + * 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. * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + * + * http://www.apache.org/licenses/LICENSE-2.0 + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing - * permissions and limitations under the License. + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ import RestAPIUtil from 'nfvo-utils/RestAPIUtil.js'; import Configuration from 'sdc-app/config/Configuration.js'; @@ -23,7 +23,7 @@ import LicenseAgreementActionHelper from './licenseAgreement/LicenseAgreementAct import FeatureGroupsActionHelper from './featureGroups/FeatureGroupsActionHelper.js'; import EntitlementPoolsActionHelper from './entitlementPools/EntitlementPoolsActionHelper.js'; import LicenseKeyGroupsActionHelper from './licenseKeyGroups/LicenseKeyGroupsActionHelper.js'; -import ItemsHelper from '../../common/helpers/ItemsHelper.js'; +import {default as ItemsHelper} from 'sdc-app/common/helpers/ItemsHelper.js'; import MergeEditorActionHelper from 'sdc-app/common/merge/MergeEditorActionHelper.js'; import {modalContentMapper} from 'sdc-app/common/modal/ModalContentMapper.js'; import {CommitModalType} from 'nfvo-components/panel/versionController/components/CommitCommentModal.jsx'; @@ -38,13 +38,15 @@ function baseUrl() { } function fetchLicenseModels() { - return RestAPIUtil.fetch(`${baseUrl()}?versionFilter=Draft`); + return RestAPIUtil.fetch(`${baseUrl()}?versionFilter=${catalogItemStatuses.DRAFT}`); } function fetchFinalizedLicenseModels() { - return RestAPIUtil.fetch(`${baseUrl()}?versionFilter=Certified`); + return RestAPIUtil.fetch(`${baseUrl()}?versionFilter=${catalogItemStatuses.CERTIFIED}`); +} +function fetchArchivedLicenseModels() { + return RestAPIUtil.fetch(`${baseUrl()}?Status=${catalogItemStatuses.ARCHIVED}`); } - function fetchLicenseModelById(licenseModelId, version) { const {id: versionId} = version; return RestAPIUtil.fetch(`${baseUrl()}${licenseModelId}/versions/${versionId}`); @@ -83,6 +85,14 @@ const LicenseModelActionHelper = { }, + fetchArchivedLicenseModels(dispatch) { + return fetchArchivedLicenseModels().then(response => dispatch({ + type: actionTypes.ARCHIVED_LICENSE_MODELS_LIST_LOADED, + response + })); + + }, + fetchLicenseModelById(dispatch, {licenseModelId, version}) { return fetchLicenseModelById(licenseModelId, version).then(response => { @@ -145,14 +155,15 @@ const LicenseModelActionHelper = { performVCAction(dispatch, {licenseModelId, action, version, comment}) { return MergeEditorActionHelper.analyzeSyncResult(dispatch, {itemId: licenseModelId, version}).then(({inMerge, isDirty, updatedVersion}) => { - if (updatedVersion.status === catalogItemStatuses.CERTIFIED && + if ( (updatedVersion.status === catalogItemStatuses.CERTIFIED || updatedVersion.archivedStatus === catalogItemStatuses.ARCHIVED) && (action === VersionControllerActionsEnum.COMMIT || action === VersionControllerActionsEnum.SYNC)) { versionPageActionHelper.fetchVersions(dispatch, {itemType: itemTypes.LICENSE_MODEL, itemId: licenseModelId}); + const msg = updatedVersion.archivedStatus === catalogItemStatuses.ARCHIVED ? i18n('Item was Archived') : i18n('Item version already Certified'); dispatch({ type: modalActionTypes.GLOBAL_MODAL_WARNING, data: { title: i18n('Commit error'), - msg: i18n('Item version already Certified'), + msg, cancelButtonText: i18n('Cancel') } }); diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/LicenseModelConstants.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/LicenseModelConstants.js index 283cb23168..08009ee305 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/LicenseModelConstants.js +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/LicenseModelConstants.js @@ -1,17 +1,17 @@ -/*! - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. +/* + * 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. * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + * + * http://www.apache.org/licenses/LICENSE-2.0 + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing - * permissions and limitations under the License. + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ import keyMirror from 'nfvo-utils/KeyMirror.js'; import i18n from 'nfvo-utils/i18n/i18n.js'; @@ -20,6 +20,7 @@ export const actionTypes = keyMirror({ LICENSE_MODEL_LOADED: null, LICENSE_MODELS_LIST_LOADED: null, FINALIZED_LICENSE_MODELS_LIST_LOADED: null, + ARCHIVED_LICENSE_MODELS_LIST_LOADED: null, EDIT_LICENSE_MODEL: null }); diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/creation/LicenseModelCreation.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/creation/LicenseModelCreation.js index 71f41710db..bcd6e7fe5b 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/creation/LicenseModelCreation.js +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/creation/LicenseModelCreation.js @@ -1,17 +1,17 @@ -/*! - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. +/* + * 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. * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + * + * http://www.apache.org/licenses/LICENSE-2.0 + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing - * permissions and limitations under the License. + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ import {connect} from 'react-redux'; import LicenseModelCreationActionHelper from './LicenseModelCreationActionHelper.js'; @@ -24,14 +24,15 @@ import ScreensHelper from 'sdc-app/common/helpers/ScreensHelper.js'; import {enums, screenTypes} from 'sdc-app/onboarding/OnboardingConstants.js'; import PermissionsActionHelper from 'sdc-app/onboarding/permissions/PermissionsActionHelper.js'; -export const mapStateToProps = ({users: {usersList}, licenseModelList, licenseModel: {licenseModelCreation}}) => { +export const mapStateToProps = ({users: {usersList}, licenseModelList, finalizedLicenseModelList, archivedLicenseModelList, licenseModel: {licenseModelCreation}}) => { let {genericFieldInfo} = licenseModelCreation; let isFormValid = ValidationHelper.checkFormValid(genericFieldInfo); - let VLMNames = {}; - for (let i = 0; i < licenseModelList.length; i++) { - VLMNames[licenseModelList[i].name.toLowerCase()] = licenseModelList[i].id; - } + + const allVlmList = [...licenseModelList, ...finalizedLicenseModelList,...archivedLicenseModelList]; + allVlmList.map((item) => { + VLMNames[item.name.toLowerCase()] = item.id; + }); return {...licenseModelCreation, isFormValid: isFormValid, VLMNames, usersList}; }; diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsActionHelper.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsActionHelper.js index 09a6e8228c..84bdac804c 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsActionHelper.js +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsActionHelper.js @@ -124,7 +124,7 @@ export default { type: entitlementPoolsActionTypes.DELETE_ENTITLEMENT_POOL, entitlementPoolId }); - ItemsHelper.checkItemStatus(dispatch, {itemId: licenseModelId, versionId: version.id}); + return ItemsHelper.checkItemStatus(dispatch, {itemId: licenseModelId, versionId: version.id}); }); }, @@ -148,7 +148,7 @@ export default { type: entitlementPoolsActionTypes.EDIT_ENTITLEMENT_POOL, entitlementPool }); - ItemsHelper.checkItemStatus(dispatch, {itemId: licenseModelId, versionId: version.id}); + return ItemsHelper.checkItemStatus(dispatch, {itemId: licenseModelId, versionId: version.id}); }); } else { @@ -161,7 +161,7 @@ export default { id: response.value } }); - ItemsHelper.checkItemStatus(dispatch, {itemId: licenseModelId, versionId: version.id}); + return ItemsHelper.checkItemStatus(dispatch, {itemId: licenseModelId, versionId: version.id}); }); } }, @@ -198,14 +198,14 @@ export default { type: limitEditorActions.CLOSE }); this.fetchLimits(dispatch, {licenseModelId, version, entitlementPool}); - ItemsHelper.checkItemStatus(dispatch, {itemId: licenseModelId, versionId: version.id}); + return ItemsHelper.checkItemStatus(dispatch, {itemId: licenseModelId, versionId: version.id}); }); }, deleteLimit(dispatch, {licenseModelId, version, entitlementPool, limit}) { return deleteLimit(licenseModelId,entitlementPool.id, version, limit.id).then(() => { this.fetchLimits(dispatch, {licenseModelId, version, entitlementPool}); - ItemsHelper.checkItemStatus(dispatch, {itemId: licenseModelId, versionId: version.id}); + return ItemsHelper.checkItemStatus(dispatch, {itemId: licenseModelId, versionId: version.id}); }); } }; diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupsActionHelper.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupsActionHelper.js index aadf8e0301..9e7fe8e0dd 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupsActionHelper.js +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupsActionHelper.js @@ -86,7 +86,7 @@ export default { type: featureGroupsActionConstants.DELETE_FEATURE_GROUPS, featureGroupId }); - ItemsHelper.checkItemStatus(dispatch, {itemId: licenseModelId, versionId: version.id}); + return ItemsHelper.checkItemStatus(dispatch, {itemId: licenseModelId, versionId: version.id}); }); }, @@ -99,7 +99,7 @@ export default { }); EntitlementPoolsActionHelper.fetchEntitlementPoolsList(dispatch, {licenseModelId, version}); LicenseKeyGroupsActionHelper.fetchLicenseKeyGroupsList(dispatch, {licenseModelId, version}); - ItemsHelper.checkItemStatus(dispatch, {itemId: licenseModelId, versionId: version.id}); + return ItemsHelper.checkItemStatus(dispatch, {itemId: licenseModelId, versionId: version.id}); }); } else { @@ -114,7 +114,7 @@ export default { }); EntitlementPoolsActionHelper.fetchEntitlementPoolsList(dispatch, {licenseModelId, version}); LicenseKeyGroupsActionHelper.fetchLicenseKeyGroupsList(dispatch, {licenseModelId, version}); - ItemsHelper.checkItemStatus(dispatch, {itemId: licenseModelId, versionId: version.id}); + return ItemsHelper.checkItemStatus(dispatch, {itemId: licenseModelId, versionId: version.id}); }); } }, diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseAgreement/LicenseAgreementActionHelper.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseAgreement/LicenseAgreementActionHelper.js index b4f03a68cd..b1b4ee8fdd 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseAgreement/LicenseAgreementActionHelper.js +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseAgreement/LicenseAgreementActionHelper.js @@ -92,14 +92,14 @@ export default { if (previousLicenseAgreement) { return putLicenseAgreement(licenseModelId, previousLicenseAgreement, licenseAgreement, version).then(() => { this.fetchLicenseAgreementList(dispatch, {licenseModelId, version}); - ItemsHelper.checkItemStatus(dispatch, {itemId: licenseModelId, versionId: version.id}); + return ItemsHelper.checkItemStatus(dispatch, {itemId: licenseModelId, versionId: version.id}); }); } else { return postLicenseAgreement(licenseModelId, licenseAgreement, version).then(() => { this.fetchLicenseAgreementList(dispatch, {licenseModelId, version}); FeatureGroupsActionHelper.fetchFeatureGroupsList(dispatch, {licenseModelId, version}); - ItemsHelper.checkItemStatus(dispatch, {itemId: licenseModelId, versionId: version.id}); + return ItemsHelper.checkItemStatus(dispatch, {itemId: licenseModelId, versionId: version.id}); }); } }, @@ -110,7 +110,7 @@ export default { type: licenseAgreementActionTypes.DELETE_LICENSE_AGREEMENT, licenseAgreementId }); - ItemsHelper.checkItemStatus(dispatch, {itemId: licenseModelId, versionId: version.id}); + return ItemsHelper.checkItemStatus(dispatch, {itemId: licenseModelId, versionId: version.id}); }); }, diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsActionHelper.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsActionHelper.js index 4d86815276..674c329515 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsActionHelper.js +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsActionHelper.js @@ -128,7 +128,7 @@ export default { type: licenseKeyGroupsConstants.EDIT_LICENSE_KEY_GROUP, licenseKeyGroup }); - ItemsHelper.checkItemStatus(dispatch, {itemId: licenseModelId, versionId: version.id}); + return ItemsHelper.checkItemStatus(dispatch, {itemId: licenseModelId, versionId: version.id}); }); } else { @@ -141,7 +141,7 @@ export default { id: response.value } }); - ItemsHelper.checkItemStatus(dispatch, {itemId: licenseModelId, versionId: version.id}); + return ItemsHelper.checkItemStatus(dispatch, {itemId: licenseModelId, versionId: version.id}); }); } @@ -154,7 +154,7 @@ export default { type: licenseKeyGroupsConstants.DELETE_LICENSE_KEY_GROUP, licenseKeyGroupId }); - ItemsHelper.checkItemStatus(dispatch, {itemId: licenseModelId, versionId: version.id}); + return ItemsHelper.checkItemStatus(dispatch, {itemId: licenseModelId, versionId: version.id}); }); }, @@ -190,14 +190,14 @@ export default { type: limitEditorActions.CLOSE }); this.fetchLimits(dispatch, {licenseModelId, version, licenseKeyGroup}); - ItemsHelper.checkItemStatus(dispatch, {itemId: licenseModelId, versionId: version.id}); + return ItemsHelper.checkItemStatus(dispatch, {itemId: licenseModelId, versionId: version.id}); }); }, deleteLimit(dispatch, {licenseModelId, version, licenseKeyGroup, limit}) { return deleteLimit(licenseModelId,licenseKeyGroup.id, version, limit.id).then(() => { this.fetchLimits(dispatch, {licenseModelId, version, licenseKeyGroup}); - ItemsHelper.checkItemStatus(dispatch, {itemId: licenseModelId, versionId: version.id}); + return ItemsHelper.checkItemStatus(dispatch, {itemId: licenseModelId, versionId: version.id}); }); } diff --git a/openecomp-ui/src/sdc-app/onboarding/onboard/CatalogList.jsx b/openecomp-ui/src/sdc-app/onboarding/onboard/CatalogList.jsx index 03efa19533..10d855c862 100644 --- a/openecomp-ui/src/sdc-app/onboarding/onboard/CatalogList.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/onboard/CatalogList.jsx @@ -1,17 +1,17 @@ -/*! - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. +/* + * 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. * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + * + * http://www.apache.org/licenses/LICENSE-2.0 + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing - * permissions and limitations under the License. + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ import React from 'react'; import i18n from 'nfvo-utils/i18n/i18n.js'; @@ -29,10 +29,12 @@ const CatalogList = ({children, onAddVLM, onAddVSP, vendorPageOptions}) => (
{vendorPageOptions && }
-
- {onAddVLM && } - {onAddVSP && onAddVSP()} dataTestId={'catalog-add-new-vsp'} className='vsp-type' title={i18n('CREATE NEW VSP')}/>} -
+ { (onAddVLM || onAddVSP) && +
+ {onAddVLM && } + {onAddVSP && onAddVSP()} dataTestId={'catalog-add-new-vsp'} className='vsp-type' title={i18n('CREATE NEW VSP')}/>} +
+ } {children}
diff --git a/openecomp-ui/src/sdc-app/onboarding/onboard/DetailsCatalogView.jsx b/openecomp-ui/src/sdc-app/onboarding/onboard/DetailsCatalogView.jsx index 887517238b..ea6cf5e9bc 100644 --- a/openecomp-ui/src/sdc-app/onboarding/onboard/DetailsCatalogView.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/onboard/DetailsCatalogView.jsx @@ -1,5 +1,5 @@ /*! - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * 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. @@ -27,8 +27,8 @@ class DetailsCatalogView extends React.Component{ VSPList: PropTypes.array, onSelectVLM: PropTypes.func.isRequired, onSelectVSP: PropTypes.func.isRequired, - onAddVLM: PropTypes.func.isRequired, - onAddVSP: PropTypes.func.isRequired, + onAddVLM: PropTypes.func, + onAddVSP: PropTypes.func, filter: PropTypes.string.isRequired }; diff --git a/openecomp-ui/src/sdc-app/onboarding/onboard/Onboard.js b/openecomp-ui/src/sdc-app/onboarding/onboard/Onboard.js index a308e1ec5e..9535147a46 100644 --- a/openecomp-ui/src/sdc-app/onboarding/onboard/Onboard.js +++ b/openecomp-ui/src/sdc-app/onboarding/onboard/Onboard.js @@ -1,17 +1,17 @@ -/*! - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. +/* + * 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. * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + * + * http://www.apache.org/licenses/LICENSE-2.0 + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing - * permissions and limitations under the License. + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ import {connect} from 'react-redux'; @@ -21,16 +21,20 @@ import OnboardActionHelper from './OnboardActionHelper.js'; import LicenseModelCreationActionHelper from '../licenseModel/creation/LicenseModelCreationActionHelper.js'; import SoftwareProductCreationActionHelper from '../softwareProduct/creation/SoftwareProductCreationActionHelper.js'; import sortByStringProperty from 'nfvo-utils/sortByStringProperty.js'; - +import {tabsMapping} from './onboardingCatalog/OnboardingCatalogConstants.js'; +import {itemsType} from './filter/FilterConstants.js'; export const mapStateToProps = ({ onboard: { onboardingCatalog, activeTab, - searchValue + searchValue, + filter }, licenseModelList, users, + archivedLicenseModelList, + archivedSoftwareProductList, finalizedLicenseModelList, softwareProductList, finalizedSoftwareProductList @@ -69,12 +73,20 @@ export const mapStateToProps = ({ ).concat(finalizedLicenseModelList); let {activeTab: catalogActiveTab, vendorCatalog: {vspOverlay, selectedVendor}} = onboardingCatalog; + if (filter.byVendorView) { + catalogActiveTab = tabsMapping.BY_VENDOR; + } + else if (filter.itemsType && filter.itemsType === itemsType.ARCHIVED) { + catalogActiveTab = tabsMapping.ARCHIVE; + } return { finalizedLicenseModelList, finalizedSoftwareProductList, licenseModelList, softwareProductList, + archivedLicenseModelList, + archivedSoftwareProductList, fullLicenseModelList, activeTab, catalogActiveTab, @@ -105,7 +117,6 @@ const mapActionsToProps = (dispatch) => { onVendorSelect: (vendor) => OnboardingCatalogActionHelper.onVendorSelect(dispatch, {vendor}), onMigrate: ({softwareProduct}) => OnboardingCatalogActionHelper.onMigrate(dispatch, softwareProduct) }; - }; export default connect(mapStateToProps, mapActionsToProps)(OnboardView); diff --git a/openecomp-ui/src/sdc-app/onboarding/onboard/OnboardView.jsx b/openecomp-ui/src/sdc-app/onboarding/onboard/OnboardView.jsx index f64c1e55fa..c045a3739a 100644 --- a/openecomp-ui/src/sdc-app/onboarding/onboard/OnboardView.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/onboard/OnboardView.jsx @@ -60,6 +60,8 @@ class OnboardView extends React.Component { softwareProductList: PropTypes.array, finalizedLicenseModelList: PropTypes.array, finalizedSoftwareProductList: PropTypes.array, + archivedSoftwareProductList: PropTypes.array, + archivedLicenseModelList: PropTypes.array, modalToShow: PropTypes.oneOf(objectValues(catalogItemTypes)), onSelectLicenseModel: PropTypes.func.isRequired, onSelectSoftwareProduct: PropTypes.func.isRequired, @@ -80,8 +82,9 @@ class OnboardView extends React.Component { case tabsMapping.WORKSPACE: return ; case tabsMapping.CATALOG: - default: return ; + default: + return ; } } @@ -93,7 +96,7 @@ class OnboardView extends React.Component {
onSearch(value)}/> {this.renderViewByTab(activeTab)} -
+ ); } diff --git a/openecomp-ui/src/sdc-app/onboarding/onboard/filter/Filter.jsx b/openecomp-ui/src/sdc-app/onboarding/onboard/filter/Filter.jsx index bf1927d2c5..d8d04f242b 100644 --- a/openecomp-ui/src/sdc-app/onboarding/onboard/filter/Filter.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/onboard/filter/Filter.jsx @@ -22,10 +22,14 @@ import Input from 'nfvo-components/input/validation/Input.jsx'; import Accordion from 'nfvo-components/accordion/Accordion.jsx'; import {actionTypes} from './FilterConstants.js'; import featureToggle from 'sdc-app/features/featureToggle.js'; +import {featureToggleNames} from 'sdc-app/features/FeaturesConstants.js'; +import {tabsMapping as onboardTabsMapping} from '../OnboardConstants.js'; +import {itemsType as itemsTypeConstants} from './FilterConstants.js'; -const mapStateToProps = ({onboard: {filter}}) => { +const mapStateToProps = ({onboard: {filter, activeTab}}) => { return { - data: filter + data: filter, + activeTab }; }; @@ -40,9 +44,27 @@ const mapActionsToProps = (dispatch) => { }; const Filter = ({onDataChanged, data: {entityTypeVsp, entityTypeVlm, roleOwner, roleContributor, roleViewer, - procedureNetwork, procedureManual, recentlyUpdated}}) => ( -
- ( +
+ {activeTab === onboardTabsMapping.CATALOG && onDataChanged({itemsType: e.target.value})}> + + + } + {activeTab === onboardTabsMapping.CATALOG && onDataChanged({byVendorView})} + data-test-id='filter-by-vendor-view' value='' /> + } + onDataChanged({recentlyUpdated})} data-test-id='filter-recently-updated' value='' /> @@ -71,4 +93,4 @@ Filter.PropTypes = { data: PropTypes.object }; -export default featureToggle('ONBOARDING_FILTER')(connect(mapStateToProps, mapActionsToProps)(Filter)); +export default featureToggle(featureToggleNames.FILTER)(connect(mapStateToProps, mapActionsToProps)(Filter)); diff --git a/openecomp-ui/src/sdc-app/onboarding/onboard/filter/FilterConstants.js b/openecomp-ui/src/sdc-app/onboarding/onboard/filter/FilterConstants.js index 36a415cd4f..d944cb02fb 100644 --- a/openecomp-ui/src/sdc-app/onboarding/onboard/filter/FilterConstants.js +++ b/openecomp-ui/src/sdc-app/onboarding/onboard/filter/FilterConstants.js @@ -19,3 +19,8 @@ import keyMirror from 'nfvo-utils/KeyMirror.js'; export const actionTypes = keyMirror({ FILTER_DATA_CHANGED: null }); + +export const itemsType = { + ACTIVE: '1', + ARCHIVED: '2' +}; \ No newline at end of file diff --git a/openecomp-ui/src/sdc-app/onboarding/onboard/onboardingCatalog/OnboardingCatalogConstants.js b/openecomp-ui/src/sdc-app/onboarding/onboard/onboardingCatalog/OnboardingCatalogConstants.js index a1bf1b1fc8..239ae4545f 100644 --- a/openecomp-ui/src/sdc-app/onboarding/onboard/onboardingCatalog/OnboardingCatalogConstants.js +++ b/openecomp-ui/src/sdc-app/onboarding/onboard/onboardingCatalog/OnboardingCatalogConstants.js @@ -1,17 +1,17 @@ -/*! - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. +/* + * 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. * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + * + * http://www.apache.org/licenses/LICENSE-2.0 + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing - * permissions and limitations under the License. + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ import keyMirror from 'nfvo-utils/KeyMirror.js'; @@ -28,7 +28,8 @@ export const catalogItemTypeClasses = { export const catalogItemStatuses = { DRAFT: 'Draft', - CERTIFIED: 'Certified' + CERTIFIED: 'Certified', + ARCHIVED: 'ARCHIVED' }; export const modalMapper = { @@ -38,7 +39,8 @@ export const modalMapper = { export const tabsMapping = { 'BY_VENDOR': 1, - 'ALL': 2 + 'ACTIVE': 2, + 'ARCHIVE': 3 }; export const migrationStatusMapper = { diff --git a/openecomp-ui/src/sdc-app/onboarding/onboard/onboardingCatalog/OnboardingCatalogReducer.js b/openecomp-ui/src/sdc-app/onboarding/onboard/onboardingCatalog/OnboardingCatalogReducer.js index d7d9d0bd6c..3f8a833074 100644 --- a/openecomp-ui/src/sdc-app/onboarding/onboard/onboardingCatalog/OnboardingCatalogReducer.js +++ b/openecomp-ui/src/sdc-app/onboarding/onboard/onboardingCatalog/OnboardingCatalogReducer.js @@ -1,17 +1,17 @@ -/*! - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. +/* + * 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. * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + * + * http://www.apache.org/licenses/LICENSE-2.0 + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing - * permissions and limitations under the License. + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ import {actionTypes, tabsMapping} from './OnboardingCatalogConstants.js'; import {combineReducers} from 'redux'; @@ -19,7 +19,7 @@ import vendorCatalogReducer from './VendorCatalogReducer.js'; const onboardingCatalogReducer = combineReducers({ vendorCatalog: vendorCatalogReducer, - activeTab: (state = tabsMapping.ALL, action) => action.type === actionTypes.CHANGE_ACTIVE_CATALOG_TAB ? action.activeTab : state + activeTab: (state = tabsMapping.ACTIVE, action) => action.type === actionTypes.CHANGE_ACTIVE_CATALOG_TAB ? action.activeTab : state }); export default (state, action) => { diff --git a/openecomp-ui/src/sdc-app/onboarding/onboard/onboardingCatalog/OnboardingCatalogView.jsx b/openecomp-ui/src/sdc-app/onboarding/onboard/onboardingCatalog/OnboardingCatalogView.jsx index 60a5aaeef0..8ae8549688 100644 --- a/openecomp-ui/src/sdc-app/onboarding/onboard/onboardingCatalog/OnboardingCatalogView.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/onboard/onboardingCatalog/OnboardingCatalogView.jsx @@ -1,17 +1,17 @@ -/*! - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. +/* + * 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. * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + * + * http://www.apache.org/licenses/LICENSE-2.0 + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing - * permissions and limitations under the License. + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ import React from 'react'; import i18n from 'nfvo-utils/i18n/i18n.js'; @@ -20,22 +20,32 @@ import DetailsCatalogView from 'sdc-app/onboarding/onboard/DetailsCatalogView.js import VendorCatalogView from './VendorCatalogView.jsx'; import { tabsMapping} from './OnboardingCatalogConstants.js'; import {tabsMapping as WCTabsMapping} from 'sdc-app/onboarding/onboard/OnboardConstants.js'; +import featureToggle from 'sdc-app/features/featureToggle.js'; +import {featureToggleNames} from 'sdc-app/features/FeaturesConstants.js'; + +const Separator = () => ( +
+); -const CatalogHeaderTabs = ({onTabPress, activeTab}) => ( +const Tab = ({onTabPress, title, dataTestId, activeTab, tabMapping}) => ( +
onTabPress(tabMapping)} + data-test-id={dataTestId}> + {title} +
+); + +const ArchiveTab = featureToggle(featureToggleNames.ARCHIVE_ITEM)(Tab); +const ArchiveTabSeparator = featureToggle(featureToggleNames.ARCHIVE_ITEM)(Separator); + +const CatalogHeaderTabs = (props) => (
-
onTabPress(tabsMapping.ALL)} - data-test-id='catalog-all-tab'> - {i18n('ALL')} -
-
-
onTabPress(tabsMapping.BY_VENDOR)} - data-test-id='catalog-by-vendor-tab'> - {i18n('BY VENDOR')} -
+ + + + +
); @@ -45,13 +55,38 @@ const CatalogHeader = ({activeTab, onTabPress}) => (
); +const FilterCatalogHeader = () => ( +
+
+
+ {i18n('ONBOARD CATALOG')} +
+
+
+); + + +const FeaturedCatalogHeader = featureToggle(featureToggleNames.FILTER)({AComp: FilterCatalogHeader, BComp: CatalogHeader}); + class OnboardingCatalogView extends React.Component { renderViewByTab(activeTab){ const {finalizedLicenseModelList: licenseModelList, fullLicenseModelList, users, vspOverlay, finalizedSoftwareProductList: softwareProductList, onSelectLicenseModel, onSelectSoftwareProduct, - onAddLicenseModelClick, onAddSoftwareProductClick, onVspOverlayChange, onVendorSelect, selectedVendor, searchValue, onMigrate} = this.props; + onAddLicenseModelClick, onAddSoftwareProductClick, onVspOverlayChange, onVendorSelect, selectedVendor, searchValue, onMigrate, + archivedSoftwareProductList, archivedLicenseModelList} = this.props; switch (activeTab){ - case tabsMapping.ALL: + case tabsMapping.ARCHIVE: + return ( + onSelectLicenseModel(item, users, WCTabsMapping.CATALOG)} + onSelectVSP={(item, users) => onSelectSoftwareProduct(item, users, WCTabsMapping.CATALOG)} + filter={searchValue} + onMigrate={onMigrate}/> + ); + case tabsMapping.ACTIVE: return ( - {!selectedVendor && onSearch(event.target.value)} activeTab={activeTab} onTabPress={tab => onCatalogTabClick(tab)} diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/ArchivedSoftwareProductReducer.js b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/ArchivedSoftwareProductReducer.js new file mode 100644 index 0000000000..b484f5e0a0 --- /dev/null +++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/ArchivedSoftwareProductReducer.js @@ -0,0 +1,25 @@ +/*! + * 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ +import {actionTypes} from './SoftwareProductConstants.js'; + +export default (state = [], action) => { + switch (action.type) { + case actionTypes.ARCHIVED_SOFTWARE_PRODUCT_LIST_LOADED: + return [...action.response.results]; + default: + return state; + } +}; diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProduct.js b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProduct.js index 683dd4f682..e3ea7e1907 100644 --- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProduct.js +++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProduct.js @@ -20,7 +20,6 @@ import ScreensHelper from 'sdc-app/common/helpers/ScreensHelper.js'; import TabulatedEditor from 'src/nfvo-components/editor/TabulatedEditor.jsx'; import {enums, screenTypes} from 'sdc-app/onboarding/OnboardingConstants.js'; - import {onboardingMethod as onboardingMethodTypes, onboardingOriginTypes} from './SoftwareProductConstants.js'; import SoftwareProductActionHelper from './SoftwareProductActionHelper.js'; import SoftwareProductComponentsActionHelper from './components/SoftwareProductComponentsActionHelper.js'; @@ -163,7 +162,7 @@ const buildNavigationBarProps = ({softwareProduct, meta, screen, componentId, co }; }; -const buildVersionControllerProps = ({softwareProduct, versions, currentVersion, permissions, userInfo, usersList, itemPermission, isReadOnlyMode}) => { +const buildVersionControllerProps = ({softwareProduct, versions, currentVersion, permissions, userInfo, isArchived, usersList, itemPermission, isReadOnlyMode}) => { const {softwareProductEditor = {data: {}}} = softwareProduct; const {isValidityData = true, data: {name, onboardingMethod, candidateOnboardingOrigin}} = softwareProductEditor; @@ -175,6 +174,7 @@ const buildVersionControllerProps = ({softwareProduct, versions, currentVersion, itemName: name, itemPermission, isReadOnlyMode, + isArchived, userInfo, usersList, isManual: onboardingMethod === onboardingMethodType.MANUAL, @@ -220,6 +220,7 @@ const mapStateToProps = ( currentVersion, userInfo, usersList, + isArchived: itemPermission.isArchived, permissions, itemPermission: {...itemPermission, isDirty: true}, isReadOnlyMode @@ -355,7 +356,6 @@ const mapActionsToProps = (dispatch, {currentScreen: {screen, props: {softwarePr if((action === versionControllerActions.SYNC && !inMerge) || ((action === versionControllerActions.COMMIT || action === versionControllerActions.SYNC) && updatedVersion.status === catalogItemStatuses.CERTIFIED)) { ScreensHelper.loadLandingScreen(dispatch, {previousScreenName: screen, props: {softwareProductId, version: updatedVersion}}); - } else { ScreensHelper.loadScreen(dispatch, {screen, screenType: screenTypes.SOFTWARE_PRODUCT, props: {softwareProductId, version: updatedVersion, componentId: currentComponentId}}); diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductActionHelper.js b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductActionHelper.js index 9ed6005397..42786bf752 100644 --- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductActionHelper.js +++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductActionHelper.js @@ -32,7 +32,7 @@ import {actionTypes as componentActionTypes} from './components/SoftwareProductC import ValidationHelper from 'sdc-app/common/helpers/ValidationHelper.js'; import {actionTypes as modalActionTypes} from 'nfvo-components/modal/GlobalModalConstants.js'; import {modalContentMapper} from 'sdc-app/common/modal/ModalContentMapper.js'; -import ItemsHelper from 'sdc-app/common/helpers/ItemsHelper.js'; +import {default as ItemsHelper} from 'sdc-app/common/helpers/ItemsHelper.js'; import ScreensHelper from 'sdc-app/common/helpers/ScreensHelper.js'; import {enums, screenTypes} from 'sdc-app/onboarding/OnboardingConstants.js'; import MergeEditorActionHelper from 'sdc-app/common/merge/MergeEditorActionHelper.js'; @@ -90,11 +90,15 @@ function putSoftwareProductAction(id, action, version) { } function fetchSoftwareProductList() { - return RestAPIUtil.fetch(`${baseUrl()}?versionFilter=Draft`); + return RestAPIUtil.fetch(`${baseUrl()}?versionFilter=${catalogItemStatuses.DRAFT}`); +} + +function fetchArchivedSoftwareProductList() { + return RestAPIUtil.fetch(`${baseUrl()}?Status=${catalogItemStatuses.ARCHIVED}`); } function fetchFinalizedSoftwareProductList() { - return RestAPIUtil.fetch(`${baseUrl()}?versionFilter=Certified`); + return RestAPIUtil.fetch(`${baseUrl()}?versionFilter=${catalogItemStatuses.CERTIFIED}`); } function fetchSoftwareProduct(vspId, version) { @@ -202,6 +206,13 @@ const SoftwareProductActionHelper = { })); }, + fetchArchivedSoftwareProductList(dispatch) { + return fetchArchivedSoftwareProductList().then(response => dispatch({ + type: actionTypes.ARCHIVED_SOFTWARE_PRODUCT_LIST_LOADED, + response + })); + }, + loadSoftwareProductAssociatedData(dispatch) { fetchSoftwareProductCategories(dispatch); LicenseModelActionHelper.fetchFinalizedLicenseModels(dispatch); @@ -473,14 +484,15 @@ const SoftwareProductActionHelper = { performVCAction(dispatch, {softwareProductId, action, version, comment}) { return MergeEditorActionHelper.analyzeSyncResult(dispatch, {itemId: softwareProductId, version}).then(({inMerge, isDirty, updatedVersion}) => { - if (updatedVersion.status === catalogItemStatuses.CERTIFIED && + if ((updatedVersion.status === catalogItemStatuses.CERTIFIED || updatedVersion.archivedStatus === catalogItemStatuses.ARCHIVED) && (action === VersionControllerActionsEnum.COMMIT || action === VersionControllerActionsEnum.SYNC)) { versionPageActionHelper.fetchVersions(dispatch, {itemType: itemTypes.SOFTWARE_PRODUCT, itemId: softwareProductId}); + const msg = updatedVersion.archivedStatus === catalogItemStatuses.ARCHIVED ? i18n('Item was Archived') : i18n('Item version already Certified'); dispatch({ type: modalActionTypes.GLOBAL_MODAL_WARNING, data: { title: i18n('Commit error'), - msg: i18n('Item version already Certified'), + msg, cancelButtonText: i18n('Cancel') } }); diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductConstants.js b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductConstants.js index c82483740f..d33eb822cf 100644 --- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductConstants.js +++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductConstants.js @@ -18,6 +18,7 @@ import keyMirror from 'nfvo-utils/KeyMirror.js'; export const actionTypes = keyMirror({ SOFTWARE_PRODUCT_LOADED: null, SOFTWARE_PRODUCT_LIST_LOADED: null, + ARCHIVED_SOFTWARE_PRODUCT_LIST_LOADED: null, FINALIZED_SOFTWARE_PRODUCT_LIST_LOADED: null, SOFTWARE_PRODUCT_LIST_EDIT: null, SOFTWARE_PRODUCT_CATEGORIES_LOADED: null, diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsView.jsx b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsView.jsx index 4ced98f314..2a849f376e 100644 --- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsView.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsView.jsx @@ -31,8 +31,8 @@ class HeatScreenView extends Component { setActiveTab: PropTypes.func }; - componentDidMount() { - if (!this.props.goToOverview && this.props.candidateInProcess) { + componentDidMount() { + if (!this.props.goToOverview && this.props.candidateInProcess) { this.props.setActiveTab({activeTab: tabsMapping.VALIDATION}); } } @@ -49,9 +49,9 @@ class HeatScreenView extends Component { data-test-id='proceed-to-validation-btn' disabled={!isValidationAvailable} className='proceed-to-validation-btn' - onClick={()=>this.validate()}>{i18n('PROCEED TO VALIDATION')} - } - {candidateInProcess && this.validate()}>{i18n('PROCEED TO VALIDATION')} + } + {candidateInProcess && - } - + } {(activeTab === tabsMapping.VALIDATION && softwareProductId) && } -
+
onDownload({heatCandidate: heatSetup, isReadOnlyMode: isReadOnlyMode || !candidateInProcess, version}) : undefined} data-test-id='download-heat'/> - this.refs.hiddenImportFileInput.click(evt)} @@ -144,7 +142,6 @@ class HeatScreenView extends Component { ); } save() { - return this.props.onboardingOrigin === onboardingOriginTypes.ZIP ? this.props.onSave(this.props.heatSetup, this.props.version) : Promise.resolve(); diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/creation/SoftwareProductCreation.js b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/creation/SoftwareProductCreation.js index 0136048bf7..569b33f999 100644 --- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/creation/SoftwareProductCreation.js +++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/creation/SoftwareProductCreation.js @@ -1,5 +1,5 @@ /*! - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * 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. @@ -25,14 +25,17 @@ import ScreensHelper from 'sdc-app/common/helpers/ScreensHelper.js'; import {enums, screenTypes} from 'sdc-app/onboarding/OnboardingConstants.js'; import PermissionsActionHelper from 'sdc-app/onboarding/permissions/PermissionsActionHelper.js'; -export const mapStateToProps = ({finalizedLicenseModelList, users: {usersList}, softwareProductList, softwareProduct: {softwareProductCreation, softwareProductCategories} }) => { +export const mapStateToProps = ({finalizedLicenseModelList, users: {usersList}, archivedSoftwareProductList, + softwareProductList, finalizedSoftwareProductList, softwareProduct: {softwareProductCreation, softwareProductCategories} }) => { let {genericFieldInfo} = softwareProductCreation; let isFormValid = ValidationHelper.checkFormValid(genericFieldInfo); let VSPNames = {}; - for (let i = 0; i < softwareProductList.length; i++) { - VSPNames[softwareProductList[i].name.toLowerCase()] = softwareProductList[i].id; - } + const allVspList = [...softwareProductList, ...finalizedSoftwareProductList, ...archivedSoftwareProductList]; + allVspList.map(item => { + VSPNames[item.name.toLowerCase()] = item.id; + }); + return { data: softwareProductCreation.data, diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/details/SoftwareProductDetails.js b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/details/SoftwareProductDetails.js index b7ddf134bb..0973537d43 100644 --- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/details/SoftwareProductDetails.js +++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/details/SoftwareProductDetails.js @@ -1,5 +1,5 @@ /*! - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * 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. @@ -14,15 +14,18 @@ * permissions and limitations under the License. */ import {connect} from 'react-redux'; - +import i18n from 'nfvo-utils/i18n/i18n.js'; import SoftwareProductActionHelper from 'sdc-app/onboarding/softwareProduct/SoftwareProductActionHelper.js'; import SoftwareProductDetailsView from './SoftwareProductDetailsView.jsx'; import ValidationHelper from 'sdc-app/common/helpers/ValidationHelper.js'; import {PRODUCT_QUESTIONNAIRE} from 'sdc-app/onboarding/softwareProduct/SoftwareProductConstants.js'; - +import {actionTypes as modalActionTypes, modalSizes} from 'nfvo-components/modal/GlobalModalConstants.js'; +import {modalContentMapper} from 'sdc-app/common/modal/ModalContentMapper.js'; +import {forms} from 'sdc-app/onboarding/softwareProduct/SoftwareProductConstants.js'; export const mapStateToProps = ({ finalizedLicenseModelList, + archivedLicenseModelList, softwareProduct, licenseModel: {licenseAgreement, featureGroup} }) => { @@ -44,7 +47,7 @@ export const mapStateToProps = ({ let {qdata, qgenericFieldInfo : qGenericFieldInfo, dataMap} = softwareProductQuestionnaire; let isFormValid = ValidationHelper.checkFormValid(genericFieldInfo); - + const isVendorArchived = archivedLicenseModelList.find(item => item.id === currentSoftwareProduct.vendorId); return { currentSoftwareProduct, softwareProductCategories, @@ -56,7 +59,8 @@ export const mapStateToProps = ({ isFormValid, genericFieldInfo, qGenericFieldInfo, - dataMap + dataMap, + isVendorArchived: !!isVendorArchived }; }; @@ -67,7 +71,21 @@ export const mapActionsToProps = (dispatch, {version}) => { onVendorParamChanged: (deltaData, formName) => SoftwareProductActionHelper.softwareProductEditorVendorChanged(dispatch, {deltaData, formName}), onQDataChanged: (deltaData) => ValidationHelper.qDataChanged(dispatch, {deltaData, qName: PRODUCT_QUESTIONNAIRE}), onValidityChanged: isValidityData => SoftwareProductActionHelper.setIsValidityData(dispatch, {isValidityData}), - onSubmit: (softwareProduct, qdata) => SoftwareProductActionHelper.updateSoftwareProduct(dispatch, {softwareProduct, qdata, version}) + onSubmit: (softwareProduct, qdata) => SoftwareProductActionHelper.updateSoftwareProduct(dispatch, {softwareProduct, qdata, version}), + onArchivedVendorRemove: ({onVendorParamChanged, finalizedLicenseModelList, vendorName}) => dispatch({ + type: modalActionTypes.GLOBAL_MODAL_SHOW, + data:{ + title: i18n('Change Archived VLM'), + modalComponentName: modalContentMapper.VENDOR_SELECTOR, + modalComponentProps: { + size: modalSizes.MEDIUM, + finalizedLicenseModelList, + vendorName, + onClose: () => dispatch({type: modalActionTypes.GLOBAL_MODAL_CLOSE}), + onConfirm: (vendorId) => onVendorParamChanged({vendorId}, forms.VENDOR_SOFTWARE_PRODUCT_DETAILS) + } + } + }) }; }; diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/details/SoftwareProductDetailsVendorSelector.jsx b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/details/SoftwareProductDetailsVendorSelector.jsx new file mode 100644 index 0000000000..c2a3e0bd02 --- /dev/null +++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/details/SoftwareProductDetailsVendorSelector.jsx @@ -0,0 +1,78 @@ +/*! + * 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ + +import React from 'react'; +import PropTypes from 'prop-types'; +import i18n from 'nfvo-utils/i18n/i18n.js'; +import Form from 'nfvo-components/input/validation/Form.jsx'; +import Input from 'nfvo-components/input/validation/Input.jsx'; +import sortByStringProperty from 'nfvo-utils/sortByStringProperty.js'; + +class VendorSelector extends React.Component { + static propTypes = { + finalizedLicenseModelList: PropTypes.array, + vendorName: PropTypes.string, + onClose: PropTypes.func.isRequired, + onConfirm: PropTypes.func.isRequired + } + constructor(props){ + super(props); + const selectedValue = props.finalizedLicenseModelList.length ? props.finalizedLicenseModelList[0].id : ''; + this.state = { + selectedValue + }; + } + submit() { + const vendor = this.props.finalizedLicenseModelList.find(item => item.id === this.state.selectedValue); + this.props.onConfirm(vendor.id); + this.props.onClose(); + } + render() { + const {finalizedLicenseModelList, vendorName, onClose} = this.props; + const {selectedValue} = this.state; + return ( +
+
this.submit()} + onReset={() => onClose()} + isValid = {!!selectedValue} + submitButtonText={i18n('Save')} + hasButtons={true}> +
{`${i18n('The VLM')} '${vendorName}' ${i18n('assigned to this VSP is archived')}.`}
+
{i18n('If you select a different VLM you will not be able to reselect the archived VLM.')}
+ {this.setState({ + selectedValue: e.target.options[e.target.selectedIndex].value + });}} + value={selectedValue}> + + {sortByStringProperty( + finalizedLicenseModelList, + 'name' + ).map(lm => ) + } + +
+
+ ); + } +} + +export default VendorSelector; + diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/details/SoftwareProductDetailsView.jsx b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/details/SoftwareProductDetailsView.jsx index f6199ec83e..24aa319c24 100644 --- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/details/SoftwareProductDetailsView.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/details/SoftwareProductDetailsView.jsx @@ -1,5 +1,5 @@ /*! - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * 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. @@ -26,6 +26,22 @@ import GridItem from 'nfvo-components/grid/GridItem.jsx'; import SoftwareProductCategoriesHelper from 'sdc-app/onboarding/softwareProduct/SoftwareProductCategoriesHelper.js'; import {forms} from 'sdc-app/onboarding/softwareProduct/SoftwareProductConstants.js'; +const DeprecatedVlmInfo = ({vendorName, onVendorRemove}) => { + return ( +
+ onVendorRemove()} + label={i18n('Vendor')} + type='select' + value={`${vendorName} (Archived)`}> + + +
+ ); +}; + class GeneralSection extends React.Component { static propTypes = { vendorId: PropTypes.string, @@ -36,7 +52,9 @@ class GeneralSection extends React.Component { finalizedLicenseModelList: PropTypes.array, onDataChanged: PropTypes.func.isRequired, onVendorParamChanged: PropTypes.func.isRequired, - onSelectSubCategory: PropTypes.func.isRequired + onSelectSubCategory: PropTypes.func.isRequired, + isVendorArchived: PropTypes.bool, + onArchivedVendorRemove: PropTypes.func }; onVendorParamChanged(e) { @@ -51,6 +69,10 @@ class GeneralSection extends React.Component { const subCategory = e.target.options[selectedIndex].value; this.props.onSelectSubCategory(subCategory); } + onVendorRemove() { + const {finalizedLicenseModelList, vendorName, onVendorParamChanged} = this.props; + this.props.onArchivedVendorRemove({finalizedLicenseModelList, onVendorParamChanged, vendorName}); + } render (){ let {genericFieldInfo} = this.props; @@ -67,18 +89,21 @@ class GeneralSection extends React.Component { errorText={genericFieldInfo.name.errorText} isValid={genericFieldInfo.name.isValid} onChange={name => name.length <= 25 && this.props.onDataChanged({name}, forms.VENDOR_SOFTWARE_PRODUCT_DETAILS)}/> - this.onVendorParamChanged(e)}> - {sortByStringProperty( - this.props.finalizedLicenseModelList, - 'name' - ).map(lm => ) - } - + {this.props.isVendorArchived ? + this.onVendorRemove()} vendorName={this.props.vendorName} /> : + this.onVendorParamChanged(e)}> + {sortByStringProperty( + this.props.finalizedLicenseModelList, + 'name' + ).map(lm => ) + } + + } this.onVendorParamChanged(e)} value={this.props.licensingVersion || ''} label={i18n('Licensing Version')} + disabled={this.props.isVendorArchived} type='select'> {this.props.licensingVersionsList.map(version => @@ -178,6 +206,7 @@ class LicensesSection extends React.Component { type='select' isMultiSelect={true} onInputChange={()=>{}} + disabled={this.props.isVendorArchived} onEnumChange={featureGroups => this.props.onFeatureGroupsChanged({featureGroups})} multiSelectedEnum={this.props.licensingData.featureGroups} name='feature-groups' @@ -295,8 +324,8 @@ class SoftwareProductDetails extends Component { }; prepareDataForGeneralSection(){ - let {softwareProductCategories, finalizedLicenseModelList, onDataChanged, currentSoftwareProduct, genericFieldInfo} = this.props; - let {name, description, vendorId, subCategory} = currentSoftwareProduct; + let {softwareProductCategories, finalizedLicenseModelList, onDataChanged, currentSoftwareProduct, genericFieldInfo, isVendorArchived, onArchivedVendorRemove} = this.props; + let {name, description, vendorId, subCategory, vendorName} = currentSoftwareProduct; return { name, description, @@ -307,13 +336,16 @@ class SoftwareProductDetails extends Component { onDataChanged, onVendorParamChanged: args => this.onVendorParamChanged(args), onSelectSubCategory: args => this.onSelectSubCategory(args), - genericFieldInfo + genericFieldInfo, + vendorName, + isVendorArchived, + onArchivedVendorRemove }; } prepareDataForLicensesSection(){ - let { featureGroupsList, licenseAgreementList, currentSoftwareProduct } = this.props; + let { featureGroupsList, licenseAgreementList, currentSoftwareProduct, isVendorArchived} = this.props; let {vendorId, licensingVersion, licensingData = {}} = currentSoftwareProduct; return { onVendorParamChanged: args => this.onVendorParamChanged(args), @@ -325,6 +357,7 @@ class SoftwareProductDetails extends Component { onLicensingDataChanged: args => this.onLicensingDataChanged(args), featureGroupsList, licenseAgreementList, + isVendorArchived }; } @@ -356,11 +389,17 @@ class SoftwareProductDetails extends Component { } onVendorParamChanged({vendorId, licensingVersion}) { + let {finalizedLicenseModelList, onVendorParamChanged} = this.props; if(!licensingVersion) { const licensingVersionsList = this.buildLicensingVersionsListItems(); licensingVersion = licensingVersionsList[0].enum; } + + if (!vendorId) { + vendorId = finalizedLicenseModelList[0].id; + } + let vendorName = finalizedLicenseModelList.find(licenseModelItem => licenseModelItem.id === vendorId).name || ''; let deltaData = { vendorId, diff --git a/openecomp-ui/src/sdc-app/onboarding/userNotifications/UserNotifications.jsx b/openecomp-ui/src/sdc-app/onboarding/userNotifications/UserNotifications.jsx index 635dfa701f..fd5c04db92 100644 --- a/openecomp-ui/src/sdc-app/onboarding/userNotifications/UserNotifications.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/userNotifications/UserNotifications.jsx @@ -54,7 +54,10 @@ const Notification = ({notification, users, onActionClicked, getNotificationType
onActionClicked(notification)}> - {eventType === notificationType.PERMISSION_CHANGED ? i18n('OK') : i18n('Sync')} + {eventType === notificationType.PERMISSION_CHANGED + || eventType === notificationType.ITEM_DELETED + || eventType === notificationType.ITEM_ARCHIVED + || eventType === notificationType.ITEM_RESTORED ? i18n('OK') : i18n('Sync')}
@@ -64,11 +67,18 @@ const Notification = ({notification, users, onActionClicked, getNotificationType function getNotificationTypeDesc(eventType, permission, granted) { switch (eventType) { case notificationType.PERMISSION_CHANGED: - return i18n('Permission {granted}: {permission}', {granted: granted ? 'Granted' : 'Taken', permission: permission}); + const grantedStr = granted ? i18n('Granted') : i18n('Taken'); + return `${i18n('Permission')} ${grantedStr}: ${permission}`; case notificationType.ITEM_CHANGED.COMMIT: return i18n('Your Copy Is Out Of Sync'); case notificationType.ITEM_CHANGED.SUBMIT: return i18n('Version Submitted'); + case notificationType.ITEM_DELETED: + return i18n('Item was deleted'); + case notificationType.ITEM_ARCHIVED: + return i18n('Item was archived'); + case notificationType.ITEM_RESTORED: + return i18n('Item was restored from archive'); } } @@ -106,8 +116,11 @@ class UserNotifications extends React.Component { onActionClicked(notification) { const {onSync, updateNotification, currentScreen, onLoadItemsLists} = this.props; - const {eventType, eventAttributes: {itemId, itemName, versionId, versionName}} = notification; - if(eventType !== notificationType.PERMISSION_CHANGED) { + const {eventType, eventAttributes: {itemId, itemName, versionId, versionName}} = notification; + if(eventType !== notificationType.PERMISSION_CHANGED && + eventType !== notificationType.ITEM_DELETED && + eventType !== notificationType.ITEM_ARCHIVED && + eventType !== notificationType.ITEM_RESTORED) { onSync({itemId, itemName, versionId, versionName, currentScreen}); } else { diff --git a/openecomp-ui/src/sdc-app/onboarding/userNotifications/UserNotificationsConstants.js b/openecomp-ui/src/sdc-app/onboarding/userNotifications/UserNotificationsConstants.js index f006b5ae1b..a8e92e29fd 100644 --- a/openecomp-ui/src/sdc-app/onboarding/userNotifications/UserNotificationsConstants.js +++ b/openecomp-ui/src/sdc-app/onboarding/userNotifications/UserNotificationsConstants.js @@ -15,5 +15,8 @@ export const notificationType = keyMirror({ ITEM_CHANGED: { COMMIT: 'commit', SUBMIT: 'submit' - } + }, + ITEM_DELETED: 'delete', + ITEM_ARCHIVED: 'archive', + ITEM_RESTORED: 'restore' }); \ No newline at end of file diff --git a/openecomp-ui/src/sdc-app/onboarding/versionsPage/VersionsPage.js b/openecomp-ui/src/sdc-app/onboarding/versionsPage/VersionsPage.js index 7b6f27307d..0fd0eabd86 100644 --- a/openecomp-ui/src/sdc-app/onboarding/versionsPage/VersionsPage.js +++ b/openecomp-ui/src/sdc-app/onboarding/versionsPage/VersionsPage.js @@ -1,5 +1,5 @@ /*! - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * 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. @@ -24,11 +24,11 @@ import VersionsPageView from './VersionsPage.jsx'; export const mapStateToProps = ({ users: {userInfo}, versionsPage: {permissions, versionsList}, - currentScreen: {itemPermission: {isCollaborator}, props: {itemId}}, + currentScreen: {itemPermission: {isCollaborator, isArchived}, props: {itemId}}, softwareProductList = [] }) => { - let {versions, selectedVersion} = versionsList; + let {versions = [], selectedVersion} = versionsList; let {owner, contributors, viewers} = permissions; // sorting the version list @@ -40,8 +40,7 @@ export const mapStateToProps = ({ return statusCompare; } - }); - + }); const curentSoftwareProduct = softwareProductList.find(item => item.id === itemId); return { versions, @@ -51,7 +50,8 @@ export const mapStateToProps = ({ currentUser: userInfo, selectedVersion, isCollaborator, - isManual: curentSoftwareProduct && curentSoftwareProduct.onboardingMethod === onboardingMethodType.MANUAL + isManual: curentSoftwareProduct && curentSoftwareProduct.onboardingMethod === onboardingMethodType.MANUAL, + isArchived }; }; @@ -80,7 +80,9 @@ export const mapActionsToProps = (dispatch, {itemType, itemId, additionalProps}) onModalNodeClick({version}) { VersionsPageActionHelper.selectVersionFromModal(dispatch, {version}); - } + }, + onArchive: () => VersionsPageActionHelper.archiveItem(dispatch, itemId), + onRestore: () => VersionsPageActionHelper.restoreItemFromArchive(dispatch, itemId) }; }; diff --git a/openecomp-ui/src/sdc-app/onboarding/versionsPage/VersionsPage.jsx b/openecomp-ui/src/sdc-app/onboarding/versionsPage/VersionsPage.jsx index 69a34e0a1c..f8417fafbf 100644 --- a/openecomp-ui/src/sdc-app/onboarding/versionsPage/VersionsPage.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/versionsPage/VersionsPage.jsx @@ -1,5 +1,5 @@ /*! - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * 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. @@ -18,7 +18,26 @@ import VersionList from './components/VersionList.jsx'; import PermissionsView from './components/PermissionsView.jsx'; import Tree from 'nfvo-components/tree/Tree.jsx'; import SVGIcon from 'sdc-ui/lib/react/SVGIcon.js'; +import Button from 'sdc-ui/lib/react/Button.js'; import i18n from 'nfvo-utils/i18n/i18n.js'; +import featureToggle from 'sdc-app/features/featureToggle.js'; + +const DepricateButton = ({depricateAction, title}) => ( +
+ +
+); + +const FeatureDepricatedButton = featureToggle('ARCHIVE_ITEM')(DepricateButton); + +const VersionPageTitle = ({itemName, depricatedTitle, isArchived, onRestore, onArchive}) => { + return ( +
+
{`${i18n('Available Versions')} - ${itemName} ${depricatedTitle}`}
+ onRestore() : () => onArchive() } title={i18n(isArchived ? 'RESTORE' : 'ARCHIVE')}/> +
+ ); +}; class VersionsPage extends React.Component { state = { @@ -26,10 +45,16 @@ class VersionsPage extends React.Component { } render() { let { versions, owner, contributors, currentUser, isCollaborator, itemName = '', viewers, onSelectVersion, onNavigateToVersion, - onTreeFullScreen, onManagePermissions, onCreateVersion, selectedVersion, onModalNodeClick, isManual} = this.props; + onTreeFullScreen, onManagePermissions, onCreateVersion, selectedVersion, onModalNodeClick, isManual, isArchived, onArchive, onRestore} = this.props; + const depricatedTitle = isArchived ? i18n('(Archived)') : ''; return (
-
{i18n('Available Versions - {itemName}', {itemName: itemName})}
+
diff --git a/openecomp-ui/src/sdc-app/onboarding/versionsPage/VersionsPageActionHelper.js b/openecomp-ui/src/sdc-app/onboarding/versionsPage/VersionsPageActionHelper.js index edf30fe4ef..d475c03c31 100644 --- a/openecomp-ui/src/sdc-app/onboarding/versionsPage/VersionsPageActionHelper.js +++ b/openecomp-ui/src/sdc-app/onboarding/versionsPage/VersionsPageActionHelper.js @@ -1,5 +1,5 @@ /*! - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * 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. @@ -85,6 +85,22 @@ const VersionsPageActionHelper = { type: modalActionTypes.GLOBAL_MODAL_CLOSE }); this.selectVersion(dispatch, {version}); + }, + + archiveItem(dispatch, itemId) { + ItemsHelper.archiveItem(itemId).then(() => { + ScreensHelper.loadScreen(dispatch, { + screen: enums.SCREEN.ONBOARDING_CATALOG + }); + }); + }, + + restoreItemFromArchive(dispatch, itemId) { + ItemsHelper.restoreItem(itemId).then(() => { + ScreensHelper.loadScreen(dispatch, { + screen: enums.SCREEN.ONBOARDING_CATALOG + }); + }); } }; diff --git a/openecomp-ui/src/sdc-app/onboarding/versionsPage/components/VersionList.jsx b/openecomp-ui/src/sdc-app/onboarding/versionsPage/components/VersionList.jsx index f209d80125..47255eb9dc 100644 --- a/openecomp-ui/src/sdc-app/onboarding/versionsPage/components/VersionList.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/versionsPage/components/VersionList.jsx @@ -1,5 +1,5 @@ /*! - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * 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. @@ -87,20 +87,18 @@ const VersionListItem = ({ data, onSelectVersion, onNavigateToVersion, onCreateV labelPosition='right' />
- {!isHeader && isCollaborator && additionalInfo.OptionalCreationMethods.length > 0 && + {!isHeader && isCollaborator && additionalInfo.OptionalCreationMethods.length > 0 && onCreateVersion && { e.stopPropagation(); onCreateVersion(); }} label={i18n('Create New Version')} labelPosition='right' - disabled={!isCollaborator} /> + disabled={!isCollaborator || !onCreateVersion} /> }
} - - ); @@ -118,7 +116,7 @@ const VersionList = ({ versions, onSelectVersion, onNavigateToVersion, onCreateV data={version} onSelectVersion={() => onSelectVersion({version})} onNavigateToVersion={() => onNavigateToVersion({version})} - onCreateVersion={() => onCreateVersion({version})} + onCreateVersion={onCreateVersion ? () => onCreateVersion({version}) : false} isSelected={selectedVersion === version.id} isCollaborator={isCollaborator} /> )} -- cgit 1.2.3-korg