ui support for archive items 99/34699/5
authorsvishnev <shlomo-stanisla.vishnevetskiy@amdocs.com>
Mon, 19 Mar 2018 10:15:19 +0000 (12:15 +0200)
committerVitaly Emporopulo <Vitaliy.Emporopulo@amdocs.com>
Tue, 20 Mar 2018 07:51:05 +0000 (07:51 +0000)
Issue-ID: SDC-1088
Change-Id: I836e4896a8ec6bb065f9d2571f514916ccf6759f
Signed-off-by: svishnev <shlomo-stanisla.vishnevetskiy@amdocs.com>
63 files changed:
openecomp-ui/resources/scss/_components.scss
openecomp-ui/resources/scss/components/_versionController.scss
openecomp-ui/resources/scss/components/_vspDetailsVendorSelect.scss [new file with mode: 0644]
openecomp-ui/resources/scss/modules/_versionsPage.scss
openecomp-ui/resources/scss/modules/onboardingCatalog/_catalogFilter.scss
openecomp-ui/src/nfvo-components/panel/versionController/VersionController.jsx
openecomp-ui/src/nfvo-components/panel/versionController/components/ActionButtons.jsx
openecomp-ui/src/nfvo-utils/i18n/en.json
openecomp-ui/src/sdc-app/common/helpers/ItemsHelper.js
openecomp-ui/src/sdc-app/common/helpers/ScreensHelper.js
openecomp-ui/src/sdc-app/common/modal/ModalContentMapper.js
openecomp-ui/src/sdc-app/features/FeaturesConstants.js
openecomp-ui/src/sdc-app/features/featureToggle.js
openecomp-ui/src/sdc-app/features/restToggle.js [new file with mode: 0644]
openecomp-ui/src/sdc-app/onboarding/OnboardingActionHelper.js
openecomp-ui/src/sdc-app/onboarding/OnboardingConstants.js
openecomp-ui/src/sdc-app/onboarding/OnboardingPunchOut.jsx
openecomp-ui/src/sdc-app/onboarding/OnboardingReducers.js
openecomp-ui/src/sdc-app/onboarding/OnboardingReducersMap.js
openecomp-ui/src/sdc-app/onboarding/licenseModel/ArchivedLicenseModelListReducer.js [new file with mode: 0644]
openecomp-ui/src/sdc-app/onboarding/licenseModel/LicenseModel.js
openecomp-ui/src/sdc-app/onboarding/licenseModel/LicenseModelActionHelper.js
openecomp-ui/src/sdc-app/onboarding/licenseModel/LicenseModelConstants.js
openecomp-ui/src/sdc-app/onboarding/licenseModel/creation/LicenseModelCreation.js
openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsActionHelper.js
openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupsActionHelper.js
openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseAgreement/LicenseAgreementActionHelper.js
openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsActionHelper.js
openecomp-ui/src/sdc-app/onboarding/onboard/CatalogList.jsx
openecomp-ui/src/sdc-app/onboarding/onboard/DetailsCatalogView.jsx
openecomp-ui/src/sdc-app/onboarding/onboard/Onboard.js
openecomp-ui/src/sdc-app/onboarding/onboard/OnboardView.jsx
openecomp-ui/src/sdc-app/onboarding/onboard/filter/Filter.jsx
openecomp-ui/src/sdc-app/onboarding/onboard/filter/FilterConstants.js
openecomp-ui/src/sdc-app/onboarding/onboard/onboardingCatalog/OnboardingCatalogConstants.js
openecomp-ui/src/sdc-app/onboarding/onboard/onboardingCatalog/OnboardingCatalogReducer.js
openecomp-ui/src/sdc-app/onboarding/onboard/onboardingCatalog/OnboardingCatalogView.jsx
openecomp-ui/src/sdc-app/onboarding/softwareProduct/ArchivedSoftwareProductReducer.js [new file with mode: 0644]
openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProduct.js
openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductActionHelper.js
openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductConstants.js
openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsView.jsx
openecomp-ui/src/sdc-app/onboarding/softwareProduct/creation/SoftwareProductCreation.js
openecomp-ui/src/sdc-app/onboarding/softwareProduct/details/SoftwareProductDetails.js
openecomp-ui/src/sdc-app/onboarding/softwareProduct/details/SoftwareProductDetailsVendorSelector.jsx [new file with mode: 0644]
openecomp-ui/src/sdc-app/onboarding/softwareProduct/details/SoftwareProductDetailsView.jsx
openecomp-ui/src/sdc-app/onboarding/userNotifications/UserNotifications.jsx
openecomp-ui/src/sdc-app/onboarding/userNotifications/UserNotificationsConstants.js
openecomp-ui/src/sdc-app/onboarding/versionsPage/VersionsPage.js
openecomp-ui/src/sdc-app/onboarding/versionsPage/VersionsPage.jsx
openecomp-ui/src/sdc-app/onboarding/versionsPage/VersionsPageActionHelper.js
openecomp-ui/src/sdc-app/onboarding/versionsPage/components/VersionList.jsx
openecomp-ui/test-utils/factories/common/CurrentScreenFactory.js
openecomp-ui/test/licenseModel/creation/LicenseModelCreation.test.js
openecomp-ui/test/licenseModel/entitlementPools/test.js
openecomp-ui/test/nfvo-components/panel/VersionController/versionController.test.js
openecomp-ui/test/onboard/onboardingCatalog/test.js
openecomp-ui/test/onboard/onboardingCatalog/views.test.js
openecomp-ui/test/onboard/test.js
openecomp-ui/test/softwareProduct/creation/SoftwareProductCreation.test.js
openecomp-ui/test/softwareProduct/details/detailsView.test.js
openecomp-ui/test/softwareProduct/details/test.js
openecomp-ui/test/versionsPage/VersionsPage.test.js

index 5579762..ce5c732 100644 (file)
@@ -22,6 +22,7 @@
 @import "components/userNotifications";
 @import "components/overlay";
 @import "components/accordion";
+@import "components/vspDetailsVendorSelect";
 
 %noselect {
   -webkit-touch-callout: none;
index 11e5b41..94a8a64 100644 (file)
                                        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 (file)
index 0000000..294fd81
--- /dev/null
@@ -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
index fa1dc11..b5ace35 100644 (file)
        .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();
index 84657b1..cda47c6 100644 (file)
@@ -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
index fdc86d4..57fa86f 100644 (file)
@@ -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 (
                        <div className='version-controller-bar'>
                                <div className={`vc-container ${candidateInProcess ? 'disabled' : ''}`}>
@@ -54,12 +54,13 @@ class VersionController extends React.Component {
                                                        version={version}
                                                        onVersionSwitching={onVersionSwitching}
                                                        onMoreVersionsClick={() => onMoreVersionsClick({itemName, users: usersList})}/>
-                                       </div>
+                                               {isArchived && <div className='depricated-item-status'>{i18n('Archived')}</div>}        
+                                       </div>                                  
                                        <div className='save-submit-cancel-container'>
                                                <ActionButtons onSubmit={callVCAction ? () => 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} />
                                                <div className='vc-separator'></div>
index 88ea9c6..b575081 100644 (file)
@@ -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}}) => (
        <div className='action-buttons'>
@@ -67,7 +67,7 @@ const ActionButtons = ({isReadOnlyMode, onSubmit, onRevert, onSave, isFormDataVa
                                </Overlay>
                        }
                </EnhancedClickOutsideWrapper>
-               {isCollaborator && <div className='collaborator-action-buttons'>
+               {isCollaborator && !isArchived && <div className='collaborator-action-buttons'>
                        <Separator />
                        {onSave && <div className='vc-save-section'>
                                        <VCButton dataTestId='vc-save-btn' onClick={() => onSave()}
@@ -83,7 +83,7 @@ const ActionButtons = ({isReadOnlyMode, onSubmit, onRevert, onSave, isFormDataVa
                                <VCButton dataTestId='vc-revert-btn' onClick={onOpenRevisionsModal}
                                        name='version-controller-revert' tooltipText={i18n('Revert')} disabled={isReadOnlyMode || isOutOfSync} />
                        }
-                       {onSubmit &&
+                       {onSubmit && 
                                <div className='vc-submit-section'>
                                        <Separator />
                                        <SubmitButton onClick={onSubmit}
index ed165f5..347a8ed 100644 (file)
@@ -77,6 +77,8 @@
   "New Software Product": "New Software Product",
   "WORKSPACE": "WORKSPACE",
   "ONBOARD CATALOG": "ONBOARD CATALOG",
+  "ARCHIVE": "ARCHIVE",
+  "RESTORE": "RESTORE",
   "Component Dependencies": "Component Dependencies",
   "This software product successfully submitted": "This software product successfully submitted",
   "Submit Failed": "Submit Failed",
   "Heat": "Heat",
   "Volume": "Volume",
   "Network": "Network",
-  "Artifact": "Artifact",
   "Environment": "Environment",
   "{errorName}:": "{errorName}:",
   "{message}": "{message}",
   "Memory - RAM": "Memory - RAM",
   "Commit error": "Commit error",
   "Item version was certified by Owner": "Item version was certified by Owner",
-
+  "Recently Updated": "Recently Updated",
+  "ENTITY TYPE": "ENTITY TYPE",
+  "ROLE": "ROLE",
+  "Owner": "Owner",
+  "Contributer": "Contributer",
+  "Viewer": "Viewer",
+  "ONBOARDING PROCEDURE": "ONBOARDING PROCEDURE",
+  "Network Package": "Network Package",
+  "Available Versions": "Available Versions",
+  "Archived": "Archived",
+  "Change Archived VLM": "Change Archived VLM",
+  "(Archived)": "(Archived)",
+  "The VLM": "The VLM",
+  "assigned to this VSP is archived": "assigned to this VSP is archived",
+  "If you select a different VLM you will not be able to reselect the archived VLM": "If you select a different VLM you will not be able to reselect the archived VLM",
+  "Item was deleted": "Item was deleted",
+  "Item was archived": "Item was archived",
+  "Item was restored from archive": "Item was restored from archive",
+  "Your Copy Is Out Of Sync": "Your Copy Is Out Of Sync",
+  "Version Submitted": "Version Submitted",
+  "Granted": "Granted",
+  "Taken": "Taken",
+  "Permission": "Permission",
+  
   "VendorSoftwareProduct": "VSP",
   "VendorSoftwareProduct/category": "Category",
   "VendorSoftwareProduct/description": "Description",
index b82bc92..05affe9 100644 (file)
@@ -18,6 +18,19 @@ import Configuration from 'sdc-app/config/Configuration.js';
 import {permissionTypes} from 'sdc-app/onboarding/permissions/PermissionsConstants.js';
 import {actionsEnum as VersionControllerActionsEnum} from 'nfvo-components/panel/versionController/VersionControllerConstants.js';
 import {actionTypes as onboardingActionTypes} from 'sdc-app/onboarding/OnboardingConstants.js';
+import restToggle from 'sdc-app/features/restToggle.js';
+import {featureToggleNames} from 'sdc-app/features/FeaturesConstants.js';
+export const archiveActions = {
+       ARCHIVE: 'ARCHIVE',
+       RESTORE: 'RESTORE'
+};
+
+export const itemStatus = {
+       ARCHIVED: 'ARCHIVED',
+       DRAFT: 'Draft',
+       CERTIFIED: 'Certified'
+};
+
 
 function baseUrl() {
        const restPrefix = Configuration.get('restPrefix');
@@ -58,21 +71,36 @@ const ItemsHelper = {
                return RestAPIUtil.put(`${baseUrl()}/${itemId}/permissions/${permissionTypes.OWNER}`, {removedUsersIds: [], addedUsersIds: [ownerId]});
        },
 
-       checkItemStatus(dispatch, {itemId, versionId}) {
-               return ItemsHelper.fetchVersion({itemId, versionId}).then(response => {
-                       let state = response && response.state || {};
-                       const {baseId, description, id, name, status} = response;
-
-                       dispatch({
-                               type: onboardingActionTypes.UPDATE_ITEM_STATUS,
-                               itemState: state,
-                               itemStatus: response.status,
-                               updatedVersion: {baseId, description, id, name, status}
-                       });
-                       return Promise.resolve(response);
+       async checkItemStatus(dispatch, {itemId, versionId}) {
+               const response = await ItemsHelper.fetchVersion({itemId, versionId});
+               let state = response && response.state || {};
+               const {baseId, description, id, name, status} = response;
+               const item = await ItemsHelper.fetchItem(itemId);
+               dispatch({
+                       type: onboardingActionTypes.UPDATE_ITEM_STATUS,
+                       itemState: state,
+                       itemStatus: response.status,
+                       archivedStatus: item.status,
+                       updatedVersion: {baseId, description, id, name, status}
                });
 
+               return Promise.resolve({...response, archivedStatus: item.status});
        },
+
+       fetchItem(itemId) {
+               return restToggle({restFunction: () => RestAPIUtil.fetch(`${baseUrl()}/${itemId}`), featureName: featureToggleNames.ARCHIVE_ITEM, mockResult: {}});
+       },
+
+       archiveItem(itemId) {
+               return RestAPIUtil.put(`${baseUrl()}/${itemId}/actions`, {
+                       action: archiveActions.ARCHIVE
+               });
+       },
+       restoreItem(itemId) {
+               return RestAPIUtil.put(`${baseUrl()}/${itemId}/actions`, {
+                       action: archiveActions.RESTORE
+               });
+       }
 };
 
 export default ItemsHelper;
index ecee47d..7c05f84 100644 (file)
@@ -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;  
                                }
                        });
                }
index 487ada0..b17536f 100644 (file)
@@ -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
 };
index fe3d4a4..f962d24 100644 (file)
@@ -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
index ffdd19a..5e0df14 100644 (file)
@@ -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) ? <InnerComponent/> : 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) ?
+                <AComp {...otherProps}/> 
+                : InnerComponent.BComp ? <InnerComponent.BComp {...otherProps}/> : 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 (file)
index 0000000..c90521d
--- /dev/null
@@ -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
index 4c4c709..d75c234 100644 (file)
@@ -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}) {
index 5b33fc2..699fe9e 100644 (file)
@@ -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';
 
index fbb1202..e04f9b7 100644 (file)
@@ -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) {
index 2eb455f..16c0e61 100644 (file)
@@ -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}};
 
index 12304fc..5b678b1 100644 (file)
@@ -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.
 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 (file)
index 0000000..8e4750e
--- /dev/null
@@ -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;
+       }
+};
index 73027c7..c390ecc 100644 (file)
@@ -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
                }),
index ff264b3..d1d3a77 100644 (file)
@@ -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')
                                        }
                                });
index 283cb23..08009ee 100644 (file)
@@ -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
 });
 
index 71f4171..bcd6e7f 100644 (file)
@@ -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};
 };
index 09a6e82..84bdac8 100644 (file)
@@ -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});
                });
        }
 };
index aadf8e0..9e7fe8e 100644 (file)
@@ -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});
                        });
                }
        },
index b4f03a6..b1b4ee8 100644 (file)
@@ -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});
                });
        },
 
index 4d86815..674c329 100644 (file)
@@ -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});
                });
        }
 
index 03efa19..10d855c 100644 (file)
@@ -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}) => (
        <div className='catalog-list'>
                {vendorPageOptions && <SoftwareProductListHeader onBack={vendorPageOptions.onBack} selectedVendor={vendorPageOptions.selectedVendor}/>}
                <div className='catalog-items'>
-                       <div className='create-catalog-item-wrapper'>
-                               {onAddVLM && <CreateItemTile onClick={onAddVLM} dataTestId={'catalog-add-new-vlm'} className='vlm-type' title={i18n('CREATE NEW VLM')}/>}
-                               {onAddVSP && <CreateItemTile onClick={() => onAddVSP()} dataTestId={'catalog-add-new-vsp'} className='vsp-type' title={i18n('CREATE NEW VSP')}/>}
-                       </div>
+                       { (onAddVLM || onAddVSP) &&
+                               <div className='create-catalog-item-wrapper'>
+                                       {onAddVLM && <CreateItemTile onClick={onAddVLM} dataTestId={'catalog-add-new-vlm'} className='vlm-type' title={i18n('CREATE NEW VLM')}/>}
+                                       {onAddVSP && <CreateItemTile onClick={() => onAddVSP()} dataTestId={'catalog-add-new-vsp'} className='vsp-type' title={i18n('CREATE NEW VSP')}/>}
+                               </div>
+                       }
                        {children}
                </div>
        </div>
index 8875172..ea6cf5e 100644 (file)
@@ -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
        };
 
index a308e1e..9535147 100644 (file)
@@ -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);
index f64c1e5..c045a37 100644 (file)
@@ -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 <WorkspaceView {...this.props} />;
                        case tabsMapping.CATALOG:
-                       default:
                                return <OnboardingCatalogView {...this.props} />;
+                       default:
+                               return <WorkspaceView {...this.props} />;
                }
        }
 
@@ -93,7 +96,7 @@ class OnboardView extends React.Component {
                                <div className='catalog-parts'>
                                        <OnboardHeader activeTab={activeTab} onTabClick={onTabClick} searchValue={searchValue} onSearch={value => onSearch(value)}/>
                                        {this.renderViewByTab(activeTab)}
-                               </div>                  
+                               </div>
                        </div>
                );
        }
index bf1927d..d8d04f2 100644 (file)
@@ -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}}) => (
-    <div className='catalog-filter'>        
-        <Input label={i18n('Recently Updated')} type='checkbox' checked={recentlyUpdated}
+                procedureNetwork, procedureManual, recentlyUpdated, byVendorView, itemsType}, activeTab}) => (
+    <div className='catalog-filter'>                   
+                {activeTab === onboardTabsMapping.CATALOG && <Input
+                       type='select'
+                       className='catalog-filter-items-type'
+                       data-test-id='catalog-filter-items-type' 
+                       disabled={byVendorView}
+                       value={itemsType}
+                       onChange={e => onDataChanged({itemsType: e.target.value})}>
+                               <option key={itemsTypeConstants.ACTIVE} value={itemsTypeConstants.ACTIVE}>Active Items</option>
+                               <option key={itemsTypeConstants.ARCHIVED} value={itemsTypeConstants.ARCHIVED}>Archived Items</option>
+               </Input>}
+               {activeTab === onboardTabsMapping.CATALOG && <Input 
+                       label={i18n('By Vendor View')}
+                        type='checkbox'
+                        disabled={itemsType === itemsTypeConstants.ARCHIVED} 
+                        checked={byVendorView} 
+                        onChange={byVendorView => onDataChanged({byVendorView})}
+                        data-test-id='filter-by-vendor-view' value='' />
+               }
+        <Input label={i18n('Recently Updated')} type='checkbox' checked={recentlyUpdated} 
        onChange={recentlyUpdated => onDataChanged({recentlyUpdated})}  data-test-id='filter-recently-updated' value='' />
 
                <Accordion title={i18n('ENTITY TYPE')}>
@@ -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));
index 36a415c..d944cb0 100644 (file)
@@ -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
index a1bf1b1..239ae45 100644 (file)
@@ -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 = {
index d7d9d0b..3f8a833 100644 (file)
@@ -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) => {
index 60a5aae..8ae8549 100644 (file)
@@ -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 = () => (
+       <div className='tab-separator'/>
+);
 
-const CatalogHeaderTabs = ({onTabPress, activeTab}) => (
+const Tab = ({onTabPress, title, dataTestId, activeTab, tabMapping}) => (
+       <div
+               className={classnames('catalog-header-tab', {'active': activeTab === tabMapping })}
+               onClick={() => onTabPress(tabMapping)}
+               data-test-id={dataTestId}>
+               {title}
+       </div>
+);
+
+const ArchiveTab = featureToggle(featureToggleNames.ARCHIVE_ITEM)(Tab);
+const ArchiveTabSeparator = featureToggle(featureToggleNames.ARCHIVE_ITEM)(Separator);
+
+const CatalogHeaderTabs = (props) => (
        <div className='catalog-header-tabs'>
-               <div
-                       className={classnames('catalog-header-tab', {'active': activeTab === tabsMapping.ALL })}
-                       onClick={() => onTabPress(tabsMapping.ALL)}
-                       data-test-id='catalog-all-tab'>
-                       {i18n('ALL')}
-               </div>
-               <div className='tab-separator'/>
-               <div
-                       className={classnames('catalog-header-tab', {'active': activeTab === tabsMapping.BY_VENDOR })}
-                       onClick={() => onTabPress(tabsMapping.BY_VENDOR)}
-                       data-test-id='catalog-by-vendor-tab'>
-                       {i18n('BY VENDOR')}
-               </div>
+               <Tab {...props} title={i18n('ACTIVE')}  dataTestId='catalog-all-tab' tabMapping={tabsMapping.ACTIVE}/>
+               <Separator/>
+               <Tab {...props} title={i18n('BY VENDOR')} dataTestId='catalog-header-tab' tabMapping={tabsMapping.BY_VENDOR}/>
+               <ArchiveTabSeparator/>
+               <ArchiveTab {...props} title={i18n('ARCHIVE')} dataTestId='catalog-archive-tab' tabMapping={tabsMapping.ARCHIVE}/>
        </div>
 );
 
@@ -45,13 +55,38 @@ const CatalogHeader = ({activeTab, onTabPress}) => (
        </div>
 );
 
+const FilterCatalogHeader = () => (
+       <div className='catalog-header'>
+               <div className='catalog-header-tabs'>
+                       <div className='catalog-header-tab active'>
+                               {i18n('ONBOARD CATALOG')}
+                       </div>
+               </div>  
+       </div>
+);
+
+
+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 (
+                                       <DetailsCatalogView
+                                               VLMList={archivedLicenseModelList}
+                                               VSPList={archivedSoftwareProductList}
+                                               users={users}                                           
+                                               onSelectVLM={(item, users) => onSelectLicenseModel(item, users, WCTabsMapping.CATALOG)}
+                                               onSelectVSP={(item, users) => onSelectSoftwareProduct(item, users, WCTabsMapping.CATALOG)}
+                                               filter={searchValue}
+                                               onMigrate={onMigrate}/>
+                               );
+                       case tabsMapping.ACTIVE:
                                return (
                                        <DetailsCatalogView
                                                VLMList={licenseModelList}
@@ -88,7 +123,7 @@ class OnboardingCatalogView extends React.Component {
                const {selectedVendor, catalogActiveTab: activeTab, onCatalogTabClick, onSearch, searchValue} = this.props;
                return (
                        <div className='catalog-wrapper'>
-                               {!selectedVendor && <CatalogHeader
+                               {!selectedVendor && <FeaturedCatalogHeader
                                        onSearch={event => 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 (file)
index 0000000..b484f5e
--- /dev/null
@@ -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;
+       }
+};
index 683dd4f..e3ea7e1 100644 (file)
@@ -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}});
index 9ed6005..42786bf 100644 (file)
@@ -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')
                                        }
                                });
index c824837..d33eb82 100644 (file)
@@ -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,
index 4ced98f..2a849f3 100644 (file)
@@ -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')}</Button>                                  
-                                       }               
-                                       {candidateInProcess && <SVGIcon                                                 
+                                                       onClick={()=>this.validate()}>{i18n('PROCEED TO VALIDATION')}</Button>
+                                       }
+                                       {candidateInProcess && <SVGIcon
                                                onClick={onUploadAbort}
                                                name='close'
                                                className='icon-component abort-btn'
@@ -59,26 +59,24 @@ class HeatScreenView extends Component {
                                                labelPosition='right'
                                                color='secondary'
                                                data-test-id='abort-btn'/>
-                                       }       
-                                       
+                                       }
                                        {(activeTab === tabsMapping.VALIDATION && softwareProductId) &&
                                                <Button btnType='outline' 
                                                        data-test-id='go-to-overview'
                                                        disabled={this.props.goToOverview !== true}
                                                        className='go-to-overview-btn'
                                                        onClick={this.props.goToOverview ? () => onGoToOverview({version}) : undefined}>{i18n('GO TO OVERVIEW')}</Button>}                                              
-                                       <div className='separator'></div>               
+                                       <div className='separator'></div>
                                        <SVGIcon
                                                disabled={heatDataExist ? false : true}
                                                name='download'
-                                               className='icon-component'                                                                                                              
+                                               className='icon-component'
                                                color='dark-gray'
                                                onClick={heatDataExist ? () => onDownload({heatCandidate: heatSetup, isReadOnlyMode: isReadOnlyMode || !candidateInProcess, version}) : undefined}
                                                data-test-id='download-heat'/>
-
                                        <SVGIcon
                                                name='upload'
-                                               className='icon-component'                                              
+                                               className='icon-component'
                                                color='dark-gray'
                                                disabled={isReadOnlyMode || candidateInProcess}
                                                onClick={isReadOnlyMode ? undefined : evt => 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();
index 0136048..569b33f 100644 (file)
@@ -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,
index b7ddf13..0973537 100644 (file)
@@ -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.
  * 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 (file)
index 0000000..c2a3e0b
--- /dev/null
@@ -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 (
+                       <div className='vsp-details-vendor-select'>
+                               <Form 
+                                       onSubmit={() => this.submit()}
+                                       onReset={() => onClose()}
+                                       isValid = {!!selectedValue}
+                                       submitButtonText={i18n('Save')}
+                                       hasButtons={true}>
+                                               <div className='vendor-selector-modal-title'>{`${i18n('The VLM')} '${vendorName}' ${i18n('assigned to this VSP is archived')}.`}</div>
+                                               <div className='vendor-selector-modal-additional-text'>{i18n('If you select a different VLM you will not be able to reselect the archived VLM.')}</div>
+                                               <Input
+                                                       data-test-id='vsp-vendor-name-select'
+                                                       label={i18n('Vendor')}
+                                                       type='select'
+                                                       onChange={e => {this.setState({
+                                                               selectedValue: e.target.options[e.target.selectedIndex].value
+                                                       });}} 
+                                                       value={selectedValue}>
+                                                       <option key='emtyVendor' value=''>{i18n('please select...')}</option>
+                                                       {sortByStringProperty(
+                                                               finalizedLicenseModelList,
+                                                               'name'
+                                                       ).map(lm => <option key={lm.id} value={lm.id}>{lm.name}</option>)
+                                                       }
+                                               </Input>
+                               </Form>
+                       </div>
+               );
+       }
+}
+
+export default VendorSelector;
+
index f6199ec..24aa319 100644 (file)
@@ -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 (
+               <div className='depricated-vlm-info'>
+                       <Input
+                               data-test-id='vsp-vendor-name'
+                               isRequired={true}
+                               onClick={() => onVendorRemove()}
+                               label={i18n('Vendor')}
+                               type='select'
+                               value={`${vendorName} (Archived)`}>
+                               <option key={vendorName} value={`${vendorName} (Archived)`}>{`${vendorName} (Archived)`}</option>
+                       </Input>
+               </div>
+       );
+};
+
 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)}/>
-                               <Input
-                                       data-test-id='vsp-vendor-name'
-                                       label={i18n('Vendor')}
-                                       type='select'
-                                       value={this.props.vendorId}
-                                       onChange={e => this.onVendorParamChanged(e)}>
-                                       {sortByStringProperty(
-                                               this.props.finalizedLicenseModelList,
-                                               'name'
-                                       ).map(lm => <option key={lm.id} value={lm.id}>{lm.name}</option>)
-                                       }
-                               </Input>
+                               {this.props.isVendorArchived ? 
+                                       <DeprecatedVlmInfo  onVendorRemove={()=>this.onVendorRemove()} vendorName={this.props.vendorName} /> :  
+                                       <Input
+                                               data-test-id='vsp-vendor-name'
+                                               label={i18n('Vendor')}
+                                               type='select'
+                                               value={this.props.vendorId}
+                                               onChange={e => this.onVendorParamChanged(e)}>
+                                               {sortByStringProperty(
+                                                       this.props.finalizedLicenseModelList,
+                                                       'name'
+                                               ).map(lm => <option key={lm.id} value={lm.id}>{lm.name}</option>)
+                                               }
+                                       </Input>
+                               }
                                <Input
                                        data-test-id='vsp-category-name'
                                        label={i18n('Category')}
@@ -127,7 +152,8 @@ class LicensesSection extends React.Component {
                onFeatureGroupsChanged: PropTypes.func.isRequired,
                onLicensingDataChanged: PropTypes.func.isRequired,
                featureGroupsList: PropTypes.array,
-               licenseAgreementList: PropTypes.array
+               licenseAgreementList: PropTypes.array, 
+               isVendorArchived: PropTypes.bool
        };
 
        onVendorParamChanged(e) {
@@ -151,6 +177,7 @@ class LicensesSection extends React.Component {
                                                onChange={e => this.onVendorParamChanged(e)}
                                                value={this.props.licensingVersion || ''}
                                                label={i18n('Licensing Version')}
+                                               disabled={this.props.isVendorArchived}
                                                type='select'>
                                                {this.props.licensingVersionsList.map(version =>
                                                        <option
@@ -165,6 +192,7 @@ class LicensesSection extends React.Component {
                                                data-test-id='vsp-license-agreement'
                                                label={i18n('License Agreement')}
                                                type='select'
+                                               disabled={this.props.isVendorArchived}
                                                value={this.props.licensingData.licenseAgreement ? this.props.licensingData.licenseAgreement : '' }
                                                onChange={(e) => this.onLicensingDataChanged(e)}>
                                                <option key='placeholder' value=''>{i18n('Select...')}</option>
@@ -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,
index 635dfa7..fd5c04d 100644 (file)
@@ -54,7 +54,10 @@ const Notification = ({notification, users, onActionClicked, getNotificationType
                        </div>
                        <div className='notification-action'>
                                <div className={classnames('action-button', {'hidden': read})} onClick={() => 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')}
                                </div>
                        </div>
                </div>
@@ -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 {
index f006b5a..a8e92e2 100644 (file)
@@ -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
index 7b6f273..0fd0eab 100644 (file)
@@ -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)
        };
 };
 
index 69a34e0..f8417fa 100644 (file)
@@ -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}) => (
+       <div className='depricate-btn-wrapper'>
+               <Button data-test-id='depricate-action-btn'     className='depricate-btn' onClick={depricateAction}>{title}</Button>
+       </div>
+);
+
+const FeatureDepricatedButton = featureToggle('ARCHIVE_ITEM')(DepricateButton);        
+
+const VersionPageTitle = ({itemName, depricatedTitle, isArchived, onRestore, onArchive}) => {
+       return (
+               <div className='version-page-header'>
+                       <div className='versions-page-title'>{`${i18n('Available Versions')} - ${itemName}  ${depricatedTitle}`}</div>                  
+                       <FeatureDepricatedButton depricateAction={isArchived ? () => onRestore() : () => onArchive() }  title={i18n(isArchived ? 'RESTORE' : 'ARCHIVE')}/>
+               </div>
+       );
+};
 
 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 (
                        <div className='versions-page-view'>
-                               <div className='versions-page-title'>{i18n('Available Versions - {itemName}', {itemName: itemName})}</div>
+                               <VersionPageTitle 
+                                       itemName={itemName} 
+                                       depricatedTitle={depricatedTitle}                                       
+                                       onArchive={onArchive}
+                                       isArchived={isArchived}
+                                       onRestore={onRestore}/>
                                <PermissionsView
                                        owner={owner}
                                        contributors={contributors}
@@ -65,7 +90,7 @@ class VersionsPage extends React.Component {
                                                versions={versions}
                                                onSelectVersion={onSelectVersion}
                                                onNavigateToVersion={onNavigateToVersion}
-                                               onCreateVersion={onCreateVersion}
+                                               onCreateVersion={isArchived ? false : onCreateVersion}
                                                selectedVersion={selectedVersion}
                                                isCollaborator={isCollaborator} />
                                </div>
index edf30fe..d475c03 100644 (file)
@@ -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
+                       });
+               });
        }
 };
 
index f209d80..47255eb 100644 (file)
@@ -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' />
                                                        </div>
                                                        <div className='version-item-field item-create'>
-                                                               {!isHeader && isCollaborator && additionalInfo.OptionalCreationMethods.length > 0 &&
+                                                               {!isHeader && isCollaborator && additionalInfo.OptionalCreationMethods.length > 0 && onCreateVersion &&
                                                                        <SVGIcon
                                                                                name='plus-circle'
                                                                                data-test-id='versions-page-create-version'
                                                                                onClick={e => { e.stopPropagation(); onCreateVersion(); }}
                                                                                label={i18n('Create New Version')}
                                                                                labelPosition='right'
-                                                                               disabled={!isCollaborator} />
+                                                                               disabled={!isCollaborator || !onCreateVersion} />
                                                                }
                                                        </div>
                                                </div>
                                }
-
-
                </div>
        );
 
@@ -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} />
                        )}
index 8301a27..ee94ba9 100644 (file)
@@ -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};
index a52d06b..59ac267 100644 (file)
@@ -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'
index 173384d..dc56b11 100644 (file)
@@ -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,
index 3b4f0de..ae24dbf 100644 (file)
@@ -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(<Provider store={store}><VersionController {...propsForArchivedItem} /></Provider>);
+               let saveBtn  = TestUtils.scryRenderedDOMComponentsWithClass(versionController,'collaborator-action-buttons');
+               expect(saveBtn).toBeTruthy();
+               expect(saveBtn.length).toBe(0);
+       });
 });
index cc54e31..4e38675 100644 (file)
@@ -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);
        });
 
index 289826a..63b49aa 100644 (file)
@@ -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(<OnboardingCatalogView
-                       {...params}/>);
+               const store = storeCreator();
+
+               let CatalogView = TestUtils.renderIntoDocument(
+                       <Provider store={store}>
+                               <OnboardingCatalogView
+                                       {...params}/>
+                       </Provider>);
                expect(CatalogView).toBeTruthy();
        });
 
index 18bb042..232c561 100644 (file)
@@ -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);
        });
index 51db931..20ca17d 100644 (file)
@@ -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})
index 33cc36e..46983f5 100644 (file)
@@ -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
index 27cbaa4..6050624 100644 (file)
@@ -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', () => {
index 61e93cb..fd7659e 100644 (file)
 
 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(<VersionsPageView {...props} />);
 
@@ -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(<Provider store={store}><VersionsPageView {...props}/></Provider>);               
+       //      const depricateBtn = wrapper.find('.depricate-btn');
+       //      expect(depricateBtn).toBeTruthy();
+       //      expect(depricateBtn.text()).toBe('ARCHIVE');
+       // });
+
+       
 
 });