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 --- openecomp-ui/resources/scss/_components.scss | 1 + .../scss/components/_versionController.scss | 7 + .../scss/components/_vspDetailsVendorSelect.scss | 13 ++ .../resources/scss/modules/_versionsPage.scss | 23 +- .../modules/onboardingCatalog/_catalogFilter.scss | 5 + .../panel/versionController/VersionController.jsx | 10 +- .../versionController/components/ActionButtons.jsx | 8 +- openecomp-ui/src/nfvo-utils/i18n/en.json | 28 ++- .../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 +- .../factories/common/CurrentScreenFactory.js | 10 +- .../creation/LicenseModelCreation.test.js | 4 + .../test/licenseModel/entitlementPools/test.js | 6 +- .../VersionController/versionController.test.js | 7 + .../test/onboard/onboardingCatalog/test.js | 20 +- .../test/onboard/onboardingCatalog/views.test.js | 12 +- openecomp-ui/test/onboard/test.js | 18 +- .../creation/SoftwareProductCreation.test.js | 8 + .../softwareProduct/details/detailsView.test.js | 22 +- openecomp-ui/test/softwareProduct/details/test.js | 29 ++- .../test/versionsPage/VersionsPage.test.js | 33 ++- 63 files changed, 1022 insertions(+), 528 deletions(-) create mode 100644 openecomp-ui/resources/scss/components/_vspDetailsVendorSelect.scss 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') diff --git a/openecomp-ui/resources/scss/_components.scss b/openecomp-ui/resources/scss/_components.scss index 5579762fd3..ce5c732b3d 100644 --- a/openecomp-ui/resources/scss/_components.scss +++ b/openecomp-ui/resources/scss/_components.scss @@ -22,6 +22,7 @@ @import "components/userNotifications"; @import "components/overlay"; @import "components/accordion"; +@import "components/vspDetailsVendorSelect"; %noselect { -webkit-touch-callout: none; diff --git a/openecomp-ui/resources/scss/components/_versionController.scss b/openecomp-ui/resources/scss/components/_versionController.scss index 11e5b41675..94a8a6498f 100644 --- a/openecomp-ui/resources/scss/components/_versionController.scss +++ b/openecomp-ui/resources/scss/components/_versionController.scss @@ -68,6 +68,13 @@ color: $dark-gray; } } + .depricated-item-status { + color: $white; + background-color: $gray; + margin-left: 10px; + padding: 5px 8px; + border-radius: 5px; + } } .save-submit-cancel-container { diff --git a/openecomp-ui/resources/scss/components/_vspDetailsVendorSelect.scss b/openecomp-ui/resources/scss/components/_vspDetailsVendorSelect.scss new file mode 100644 index 0000000000..294fd817b9 --- /dev/null +++ b/openecomp-ui/resources/scss/components/_vspDetailsVendorSelect.scss @@ -0,0 +1,13 @@ +.vsp-details-vendor-select { + .validation-form-content { + padding-top: 20px; + .vendor-selector-modal-title { + @extend .body-1; + } + .vendor-selector-modal-additional-text { + @extend .body-2; + margin-top: 10px; + margin-bottom: 20px; + } + } +} \ No newline at end of file diff --git a/openecomp-ui/resources/scss/modules/_versionsPage.scss b/openecomp-ui/resources/scss/modules/_versionsPage.scss index fa1dc11ec6..b5ace35c48 100644 --- a/openecomp-ui/resources/scss/modules/_versionsPage.scss +++ b/openecomp-ui/resources/scss/modules/_versionsPage.scss @@ -43,14 +43,21 @@ .svg-icon-wrapper { justify-content: flex-start; } - - .versions-page-title { - @extend .heading-1; - text-transform: uppercase; - margin-bottom: 29px; - color: $blue; - } - + .version-page-header { + display: flex; + justify-content: space-between; + .versions-page-title { + @extend .heading-1; + text-transform: uppercase; + margin-bottom: 29px; + color: $blue; + } + .depricate-btn-wrapper { + display: flex; + justify-content: flex-end; + margin-bottom: 10px; + } + } .versions-page-permissions-view-wrapper { @extend .body-1-semibold; @include version-page-box-shadow(); diff --git a/openecomp-ui/resources/scss/modules/onboardingCatalog/_catalogFilter.scss b/openecomp-ui/resources/scss/modules/onboardingCatalog/_catalogFilter.scss index 84657b1317..cda47c6340 100644 --- a/openecomp-ui/resources/scss/modules/onboardingCatalog/_catalogFilter.scss +++ b/openecomp-ui/resources/scss/modules/onboardingCatalog/_catalogFilter.scss @@ -8,4 +8,9 @@ .form-group { margin-bottom: 10px; } + .catalog-filter-items-type { + width: 100%; + background-color: $gray; + color: $white; + } } \ No newline at end of file diff --git a/openecomp-ui/src/nfvo-components/panel/versionController/VersionController.jsx b/openecomp-ui/src/nfvo-components/panel/versionController/VersionController.jsx index fdc86d417d..57fa86f561 100644 --- a/openecomp-ui/src/nfvo-components/panel/versionController/VersionController.jsx +++ b/openecomp-ui/src/nfvo-components/panel/versionController/VersionController.jsx @@ -43,8 +43,8 @@ class VersionController extends React.Component { render() { let {version = {}, viewableVersions = [], onVersionSwitching, onMoreVersionsClick, callVCAction, onSave, isReadOnlyMode, itemPermission, - isFormDataValid, onClose, onManagePermissions, permissions = {}, userInfo, usersList, itemName, - onOpenCommentCommitModal, onOpenRevisionsModal, isManual, candidateInProcess} = this.props; + isFormDataValid, onClose, onManagePermissions, permissions = {}, userInfo, usersList, itemName, + onOpenCommentCommitModal, onOpenRevisionsModal, isManual, candidateInProcess, isArchived} = this.props; return (
@@ -54,12 +54,13 @@ class VersionController extends React.Component { version={version} onVersionSwitching={onVersionSwitching} onMoreVersionsClick={() => onMoreVersionsClick({itemName, users: usersList})}/> -
+ {isArchived &&
{i18n('Archived')}
} +
this.submit(callVCAction, version) : undefined} onRevert={callVCAction ? () => this.revert(callVCAction, version) : undefined} onOpenRevisionsModal={onOpenRevisionsModal} - onSave={onSave ? () => onSave() : undefined} + onSave={onSave ? () => onSave() : undefined} permissions={permissions} userInfo={userInfo} onManagePermissions={onManagePermissions} @@ -71,6 +72,7 @@ class VersionController extends React.Component { onCommit={callVCAction ? (comment) => this.commit(callVCAction, version, comment) : undefined} isFormDataValid={isFormDataValid} itemPermissions={itemPermission} + isArchived={isArchived} isReadOnlyMode={isReadOnlyMode || candidateInProcess} isManual={isManual} />
diff --git a/openecomp-ui/src/nfvo-components/panel/versionController/components/ActionButtons.jsx b/openecomp-ui/src/nfvo-components/panel/versionController/components/ActionButtons.jsx index 88ea9c6e3a..b5750817ba 100644 --- a/openecomp-ui/src/nfvo-components/panel/versionController/components/ActionButtons.jsx +++ b/openecomp-ui/src/nfvo-components/panel/versionController/components/ActionButtons.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. @@ -54,7 +54,7 @@ const SubmitButton = ({onClick, disabled}) => ( ); -const ActionButtons = ({isReadOnlyMode, onSubmit, onRevert, onSave, isFormDataValid, onClickPermissions, onSync, onCommit, +const ActionButtons = ({isReadOnlyMode, onSubmit, onRevert, onSave, isFormDataValid, onClickPermissions, onSync, onCommit, isArchived, onOpenCommentCommitModal, showPermissions, onClosePermissions, permissions, onManagePermissions, userInfo, onOpenRevisionsModal, isManual, itemPermissions: {isCertified, isCollaborator, isDirty, isOutOfSync, isUpToDate}}) => (
@@ -67,7 +67,7 @@ const ActionButtons = ({isReadOnlyMode, onSubmit, onRevert, onSave, isFormDataVa } - {isCollaborator &&
+ {isCollaborator && !isArchived &&
{onSave &&
onSave()} @@ -83,7 +83,7 @@ const ActionButtons = ({isReadOnlyMode, onSubmit, onRevert, onSave, isFormDataVa } - {onSubmit && + {onSubmit &&
{ - 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} /> )} diff --git a/openecomp-ui/test-utils/factories/common/CurrentScreenFactory.js b/openecomp-ui/test-utils/factories/common/CurrentScreenFactory.js index 8301a277cf..ee94ba988d 100644 --- a/openecomp-ui/test-utils/factories/common/CurrentScreenFactory.js +++ b/openecomp-ui/test-utils/factories/common/CurrentScreenFactory.js @@ -29,6 +29,7 @@ export const ItemPermissionFactory = new Factory() .attrs({ 'isDirty': false, 'isOutOfSync': false, + 'isArchived': false, 'isUpToDate': true }); @@ -52,7 +53,8 @@ Factory.define('InitializedCurrentScreenFactory') .option('isCertified', false) .option('inMerge', false) .option('isCollaborator', true) - .option('isReadOnlyMode', ['isCertified', 'inMerge', 'isCollaborator'], (isCertified, inMerge, isCollaborator) => + .option('isArchived', false) + .option('isReadOnlyMode', ['isCertified', 'inMerge', 'isCollaborator', 'isArchived'], (isCertified, inMerge, isCollaborator, isArchived) => isCertified || inMerge || !isCollaborator ) .attr('itemPermission', ['isCertified', 'inMerge', 'isCollaborator'], (isCertified, inMerge, isCollaborator) => @@ -71,9 +73,9 @@ Factory.define('CurrentScreenFactory') .option('isUpToDate', true) .option('version', ['isCertified'], (isCertified) => VersionFactory.build({isCertified})) .attr('itemPermission', [ - 'isCertified', 'inMerge', 'isCollaborator', 'isDirty', 'isOutOfSync', 'isUpToDate' - ], (isCertified, inMerge, isCollaborator, isDirty, isOutOfSync, isUpToDate) => - ItemPermissionFactory.build({isCollaborator, isCertified, inMerge, isDirty, isOutOfSync, isUpToDate}) + 'isCertified', 'inMerge', 'isCollaborator', 'isDirty', 'isOutOfSync', 'isUpToDate', 'isArchived' + ], (isCertified, inMerge, isCollaborator, isDirty, isOutOfSync, isUpToDate, isArchived) => + ItemPermissionFactory.build({isCollaborator, isCertified, inMerge, isDirty, isOutOfSync, isUpToDate, isArchived}) ) .attr('props', ['isReadOnlyMode', 'version'], (isReadOnlyMode, version) => { return {isReadOnlyMode, version}; diff --git a/openecomp-ui/test/licenseModel/creation/LicenseModelCreation.test.js b/openecomp-ui/test/licenseModel/creation/LicenseModelCreation.test.js index a52d06baa3..59ac267b04 100644 --- a/openecomp-ui/test/licenseModel/creation/LicenseModelCreation.test.js +++ b/openecomp-ui/test/licenseModel/creation/LicenseModelCreation.test.js @@ -28,6 +28,8 @@ describe('License Model Creation Module Tests', function() { it ('should return empty data', () => { let state = { licenseModelList: [], + archivedLicenseModelList: [], + finalizedLicenseModelList: [], licenseModel: { licenseModelCreation: { data: {} @@ -43,6 +45,8 @@ describe('License Model Creation Module Tests', function() { it ('should return vlm names list', () => { let state = { + archivedLicenseModelList: [], + finalizedLicenseModelList: [], licenseModelList: [{ name: 'vlm1', id: 'vlm1_id' diff --git a/openecomp-ui/test/licenseModel/entitlementPools/test.js b/openecomp-ui/test/licenseModel/entitlementPools/test.js index 173384dc02..dc56b11f1b 100644 --- a/openecomp-ui/test/licenseModel/entitlementPools/test.js +++ b/openecomp-ui/test/licenseModel/entitlementPools/test.js @@ -88,14 +88,14 @@ describe('Entitlement Pools Module Tests', function () { } }; }); - + mockRest.addHandler('fetch', ({data, options, baseUrl}) => { expect(baseUrl).toEqual(`/onboarding-api/v1.0/items/${LICENSE_MODEL_ID}/versions/${version.id}`); expect(data).toEqual(undefined); expect(options).toEqual(undefined); return {...returnedVersionFields, state: {synchronizationState: SyncStates.UP_TO_DATE, dirty: true}}; }); - + return EntitlementPoolsActionHelper.deleteEntitlementPool(store.dispatch, { licenseModelId: LICENSE_MODEL_ID, version, @@ -148,6 +148,8 @@ describe('Entitlement Pools Module Tests', function () { return {...returnedVersionFields, state: {synchronizationState: SyncStates.UP_TO_DATE, dirty: true}}; }); + + return EntitlementPoolsActionHelper.saveEntitlementPool(store.dispatch, { licenseModelId: LICENSE_MODEL_ID, diff --git a/openecomp-ui/test/nfvo-components/panel/VersionController/versionController.test.js b/openecomp-ui/test/nfvo-components/panel/VersionController/versionController.test.js index 3b4f0de893..ae24dbf9cd 100644 --- a/openecomp-ui/test/nfvo-components/panel/VersionController/versionController.test.js +++ b/openecomp-ui/test/nfvo-components/panel/VersionController/versionController.test.js @@ -135,4 +135,11 @@ describe('versionController UI Component', () => { expect(elem.length).toBe(1); }); + it ('Do not show action buttons in case of archived item', () =>{ + let propsForArchivedItem = {...props, isArchived: true}; + let versionController = TestUtils.renderIntoDocument(); + let saveBtn = TestUtils.scryRenderedDOMComponentsWithClass(versionController,'collaborator-action-buttons'); + expect(saveBtn).toBeTruthy(); + expect(saveBtn.length).toBe(0); + }); }); diff --git a/openecomp-ui/test/onboard/onboardingCatalog/test.js b/openecomp-ui/test/onboard/onboardingCatalog/test.js index cc54e3199e..4e38675fb7 100644 --- a/openecomp-ui/test/onboard/onboardingCatalog/test.js +++ b/openecomp-ui/test/onboard/onboardingCatalog/test.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 {storeCreator} from 'sdc-app/AppStore.js'; import {OnboardingCatalogStoreFactory} from 'test-utils/factories/onboard/OnboardingCatalogFactories.js'; @@ -29,8 +29,8 @@ describe('Onboarding Catalog Module Tests', () => { it('should change active tab to All', () => { const store = storeCreator(); - const expectedStore = OnboardingCatalogStoreFactory.build({activeTab: tabsMapping.ALL}); - OnboardingCatalogActionHelper.changeActiveTab(store.dispatch, tabsMapping.ALL); + const expectedStore = OnboardingCatalogStoreFactory.build({activeTab: tabsMapping.ACTIVE}); + OnboardingCatalogActionHelper.changeActiveTab(store.dispatch, tabsMapping.ACTIVE); expect(store.getState().onboard.onboardingCatalog).toEqual(expectedStore); }); diff --git a/openecomp-ui/test/onboard/onboardingCatalog/views.test.js b/openecomp-ui/test/onboard/onboardingCatalog/views.test.js index 289826ad84..63b49aafab 100644 --- a/openecomp-ui/test/onboard/onboardingCatalog/views.test.js +++ b/openecomp-ui/test/onboard/onboardingCatalog/views.test.js @@ -15,6 +15,9 @@ */ import React from 'react'; +import {Provider} from 'react-redux'; +import {storeCreator} from 'sdc-app/AppStore.js'; + import TestUtils from 'react-dom/test-utils'; import {defaultStoreFactory} from 'test-utils/factories/onboard/OnboardingCatalogFactories.js'; import {FinalizedLicenseModelFactory} from 'test-utils/factories/licenseModel/LicenseModelFactories.js'; @@ -80,8 +83,13 @@ describe('OnBoarding Catalog test - View: ', function () { }; let params = {...func, ...mapStateToProps(data)}; - let CatalogView = TestUtils.renderIntoDocument(); + const store = storeCreator(); + + let CatalogView = TestUtils.renderIntoDocument( + + + ); expect(CatalogView).toBeTruthy(); }); diff --git a/openecomp-ui/test/onboard/test.js b/openecomp-ui/test/onboard/test.js index 18bb042aea..232c5615c9 100644 --- a/openecomp-ui/test/onboard/test.js +++ b/openecomp-ui/test/onboard/test.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 {storeCreator} from 'sdc-app/AppStore.js'; import {OnboardStoreFactory} from 'test-utils/factories/onboard/OnboardFactories.js'; @@ -54,7 +54,7 @@ describe('Onboard Module Tests', () => { const expectedStore = OnboardStoreFactory.build(); OnboardActionHelper.changeSearchValue(store.dispatch, 'hello'); OnboardActionHelper.changeActiveTab(store.dispatch, onboardTabsMapping.CATALOG); - OnboardingCatalogActionHelper.changeActiveTab(store.dispatch, onboardCatalogTabsMapping.ALL); + OnboardingCatalogActionHelper.changeActiveTab(store.dispatch, onboardCatalogTabsMapping.ACTIVE); OnboardActionHelper.resetOnboardStore(store.dispatch, 'hello'); expect(store.getState().onboard).toEqual(expectedStore); }); diff --git a/openecomp-ui/test/softwareProduct/creation/SoftwareProductCreation.test.js b/openecomp-ui/test/softwareProduct/creation/SoftwareProductCreation.test.js index 51db931a9a..20ca17d3d0 100644 --- a/openecomp-ui/test/softwareProduct/creation/SoftwareProductCreation.test.js +++ b/openecomp-ui/test/softwareProduct/creation/SoftwareProductCreation.test.js @@ -31,6 +31,8 @@ describe('Software Product Creation Module Tests', function() { it ('should return empty data', () => { let state = { softwareProductList: [], + finalizedSoftwareProductList: [], + archivedSoftwareProductList: [], softwareProduct: { softwareProductCreation: { data: {} @@ -46,6 +48,8 @@ describe('Software Product Creation Module Tests', function() { it ('should return vsp names list', () => { let state = { + finalizedSoftwareProductList: [], + archivedSoftwareProductList: [], softwareProductList: [{ name: 'vsp1', id: 'vsp1_id' @@ -73,6 +77,8 @@ describe('Software Product Creation Module Tests', function() { let state = { softwareProductList: [], + finalizedSoftwareProductList: [], + archivedSoftwareProductList: [], softwareProduct: { softwareProductCreation: SoftwareProductCreationFactory.build(), softwareProductCategories: CategoryWithSubFactory.buildList({}, {quantity: 2}) @@ -97,6 +103,8 @@ describe('Software Product Creation Module Tests', function() { let finalizedLicenseModelList = FinalizedLicenseModelFactory.buildList(3); let state = { softwareProductList: [], + finalizedSoftwareProductList: [], + archivedSoftwareProductList: [], softwareProduct: { softwareProductCreation: SoftwareProductCreationFactoryWithSelectedVendor.build({selectedVendorId: finalizedLicenseModelList[0].id}), softwareProductCategories: CategoryWithSubFactory.buildList({}, {quantity: 2}) diff --git a/openecomp-ui/test/softwareProduct/details/detailsView.test.js b/openecomp-ui/test/softwareProduct/details/detailsView.test.js index 33cc36ed59..46983f5d80 100644 --- a/openecomp-ui/test/softwareProduct/details/detailsView.test.js +++ b/openecomp-ui/test/softwareProduct/details/detailsView.test.js @@ -1,7 +1,7 @@ /* * Copyright © 2016-2018 European Support Limited * - * Licensed under the Apache License, Version 2.0 (the "License"); + * 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 * @@ -25,7 +25,6 @@ import {FeatureGroupStoreFactory} from 'test-utils/factories/licenseModel/Featu import {SchemaGenericFieldInfoFactory} from 'test-utils/factories/softwareProduct/SoftwareProductQSchemaFactory.js'; import {default as VspQdataFactory, VspDataMapFactory} from 'test-utils/factories/softwareProduct/VspQdataFactory.js'; import {FinalizedLicenseModelFactory} from 'test-utils/factories/licenseModel/LicenseModelFactories.js'; -import VersionFactory from 'test-utils/factories/common/VersionFactory.js'; import CurrentScreenFactory from 'test-utils/factories/common/CurrentScreenFactory.js'; describe('Software Product Details: ', function () { @@ -46,9 +45,14 @@ describe('Software Product Details: ', function () { licenseAgreementList = LicenseAgreementStoreFactory.buildList(2); licensingVersionsList = [ { - "id":"0127b419e9574a11aab8e031a78fc534", - "name":"1.0","description":"Initial version", - "baseId":"","status":"Certified","creationTime":1506409288390,"modificationTime":1506409288390,"additionalInfo":{"OptionalCreationMethods":["minor"]}},{"id":"ea159ffedd9a4f9a8a56d53ba66b7314","name":"2.0","description":"ggggg","baseId":"0127b419e9574a11aab8e031a78fc534","status":"Draft","creationTime":1508839019802,"modificationTime":1508839019802,"additionalInfo":{"OptionalCreationMethods":[]}} + 'id':'0127b419e9574a11aab8e031a78fc534', + 'name':'1.0','description':'Initial version', + 'baseId':'','status':'Certified','creationTime':1506409288390, + 'modificationTime':1506409288390,'additionalInfo':{'OptionalCreationMethods':['minor']}}, + {'id':'ea159ffedd9a4f9a8a56d53ba66b7314','name':'2.0','description':'ggggg', + 'baseId':'0127b419e9574a11aab8e031a78fc534','status':'Draft','creationTime':1508839019802, + 'modificationTime':1508839019802,'additionalInfo':{'OptionalCreationMethods':[]} + } ]; featureGroupsList = FeatureGroupStoreFactory.buildList(2, {referencingLicenseAgreements: [licenseAgreementList[0].id]}); qdata = VspQdataFactory.build(); @@ -109,7 +113,9 @@ describe('Software Product Details: ', function () { featureGroup: { featureGroupsList: [] } - } + }, + archivedLicenseModelList: [], + archivedSoftwareProductList: [] }; var result = mapStateToProps(obj); @@ -145,7 +151,9 @@ describe('Software Product Details: ', function () { dataMap } }, - finalizedLicenseModelList: finalizedLicenseModelList, + finalizedLicenseModelList: finalizedLicenseModelList, + archivedLicenseModelList: [], + archivedSoftwareProductList: [], licenseModel: { licenseAgreement: { licenseAgreementList: licenseAgreementList diff --git a/openecomp-ui/test/softwareProduct/details/test.js b/openecomp-ui/test/softwareProduct/details/test.js index 27cbaa40ef..60506243ff 100644 --- a/openecomp-ui/test/softwareProduct/details/test.js +++ b/openecomp-ui/test/softwareProduct/details/test.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 deepFreeze from 'deep-freeze'; import mockRest from 'test-utils/MockRest.js'; @@ -35,7 +35,7 @@ import VersionFactory from 'test-utils/factories/common/VersionFactory.js'; import {InitializedCurrentScreenFactory} from 'test-utils/factories/common/CurrentScreenFactory.js'; describe('Software Product Details Module Tests', function () { - it('Get Software Products List', () => { + it('Get Software Products List', async () => { const store = storeCreator(); deepFreeze(store.getState()); const softwareProductList = VSPEditorFactory.buildList(2); @@ -57,11 +57,18 @@ describe('Software Product Details Module Tests', function () { return {results: []}; }); - return SoftwareProductActionHelper.fetchSoftwareProductList(store.dispatch).then(() => { - return SoftwareProductActionHelper.fetchFinalizedSoftwareProductList(store.dispatch); - }).then(() => { - expect(store.getState()).toEqual(expectedStore); + mockRest.addHandler('fetch', ({options, data, baseUrl}) => { + expect(baseUrl).toEqual('/onboarding-api/v1.0/vendor-software-products/?Status=ARCHIVED'); + expect(data).toEqual(undefined); + expect(options).toEqual(undefined); + return {results: []}; }); + + await SoftwareProductActionHelper.fetchSoftwareProductList(store.dispatch); + await SoftwareProductActionHelper.fetchFinalizedSoftwareProductList(store.dispatch); + await SoftwareProductActionHelper.fetchArchivedSoftwareProductList(store.dispatch); + + expect(store.getState()).toEqual(expectedStore); }); it('Add Software Product', () => { diff --git a/openecomp-ui/test/versionsPage/VersionsPage.test.js b/openecomp-ui/test/versionsPage/VersionsPage.test.js index 61e93cb9d2..fd7659e70e 100644 --- a/openecomp-ui/test/versionsPage/VersionsPage.test.js +++ b/openecomp-ui/test/versionsPage/VersionsPage.test.js @@ -16,11 +16,12 @@ import React from 'react'; import ShallowRenderer from 'react-test-renderer/shallow'; +import {mount} from 'enzyme'; +import {Provider} from 'react-redux'; import deepFreeze from 'deep-freeze'; import mockRest from 'test-utils/MockRest.js'; import Configuration from 'sdc-app/config/Configuration.js'; import {storeCreator} from 'sdc-app/AppStore.js'; - import {mapStateToProps, mapActionsToProps} from 'sdc-app/onboarding/versionsPage/VersionsPage.js'; import VersionsPageView from 'sdc-app/onboarding/versionsPage/VersionsPage.jsx'; import VersionsPageActionHelper from 'sdc-app/onboarding/versionsPage/VersionsPageActionHelper.js'; @@ -29,6 +30,7 @@ import {itemTypes as versionPageItemTypes} from 'sdc-app/onboarding/versionsPage import VersionFactory from 'test-utils/factories/common/VersionFactory.js'; import {VersionsPageCreationFactory} from 'test-utils/factories/versionsPage/VersionsPageCreationFactories.js'; import {VersionsPageAdditionalPropsFactory} from 'test-utils/factories/versionsPage/VersionsPageFactories.js'; +import {cloneAndSet} from 'test-utils/Util.js'; describe('Versions Page Module Tests', () => { @@ -45,7 +47,15 @@ describe('Versions Page Module Tests', () => { userInfo: 'user123' }, versionsPage: { - permissions: {}, + permissions: { + contributors: [], + owner: { + userId: 'fgfgfg', + permission: 'Owner', + fullName: 'Test User', + role: 'Test ROLE' + } + }, versionsList: {versions: []}, versionCreation: {} } @@ -71,7 +81,7 @@ describe('Versions Page Module Tests', () => { const additionalProps = VersionsPageAdditionalPropsFactory.build(); - const props = Object.assign({}, mapStateToProps(state), mapActionsToProps(dispatch, additionalProps)); + const props = {...mapStateToProps(state), ...mapActionsToProps(dispatch, additionalProps)}; const renderer = new ShallowRenderer(); renderer.render(); @@ -79,6 +89,23 @@ describe('Versions Page Module Tests', () => { expect(renderedOutput).toBeTruthy(); }); + /** + * turn on when ARCHIVE_ITEM feature toggle will be removed in VersionPage.jsx + */ + // it('archive btn test', () => { + + // const store = storeCreator(); + // const dispatch = store.dispatch; + + // const additionalProps = VersionsPageAdditionalPropsFactory.build(); + // const props = {...mapStateToProps(state), ...mapActionsToProps(dispatch, additionalProps)}; + // const wrapper = mount(); + // const depricateBtn = wrapper.find('.depricate-btn'); + // expect(depricateBtn).toBeTruthy(); + // expect(depricateBtn.text()).toBe('ARCHIVE'); + // }); + + }); -- cgit 1.2.3-korg