summaryrefslogtreecommitdiffstats
path: root/openecomp-ui
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-ui')
-rw-r--r--openecomp-ui/src/sdc-app/onboarding/OnboardingActionHelper.js3
-rw-r--r--openecomp-ui/src/sdc-app/onboarding/licenseModel/LicenseModelReducer.js4
-rw-r--r--openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/LicenseModelOverview.js25
-rw-r--r--openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/LicenseModelOverviewView.jsx12
-rw-r--r--openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/summary/ListButtons.jsx14
-rw-r--r--openecomp-ui/test/licenseModel/overview/test.js39
-rw-r--r--openecomp-ui/test/licenseModel/overview/views.test.js1
7 files changed, 68 insertions, 30 deletions
diff --git a/openecomp-ui/src/sdc-app/onboarding/OnboardingActionHelper.js b/openecomp-ui/src/sdc-app/onboarding/OnboardingActionHelper.js
index fc65083bff..2788d4db92 100644
--- a/openecomp-ui/src/sdc-app/onboarding/OnboardingActionHelper.js
+++ b/openecomp-ui/src/sdc-app/onboarding/OnboardingActionHelper.js
@@ -35,7 +35,6 @@ import {navigationItems as SoftwareProductNavigationItems, actionTypes as Softwa
import ActivityLogActionHelper from 'sdc-app/common/activity-log/ActivityLogActionHelper.js';
import licenseModelOverviewActionHelper from 'sdc-app/onboarding/licenseModel/overview/licenseModelOverviewActionHelper.js';
import store from 'sdc-app/AppStore.js';
-import {selectedButton as licenseModelOverviewSelectedButton} from 'sdc-app/onboarding/licenseModel/overview/LicenseModelOverviewConstants.js';
import {tabsMapping as attachmentsTabsMapping} from 'sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsConstants.js';
import SoftwareProductAttachmentsActionHelper from 'sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsActionHelper.js';
@@ -99,7 +98,7 @@ export default {
LicenseModelActionHelper.fetchLicenseModelItems(dispatch, {licenseModelId, version}).then(() =>{
setCurrentScreen(dispatch, enums.SCREEN.LICENSE_MODEL_OVERVIEW, {licenseModelId, version});
});
- licenseModelOverviewActionHelper.selectVLMListView(dispatch, {buttonTab: licenseModelOverviewSelectedButton.VLM_LIST_VIEW});
+ licenseModelOverviewActionHelper.selectVLMListView(dispatch, {buttonTab: null});
});
},
navigateToLicenseAgreements(dispatch, {licenseModelId, version}) {
diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/LicenseModelReducer.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/LicenseModelReducer.js
index 80beda22b5..f635532348 100644
--- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/LicenseModelReducer.js
+++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/LicenseModelReducer.js
@@ -34,7 +34,7 @@ import licenseKeyGroupsListReducer from './licenseKeyGroups/LicenseKeyGroupsList
import {createPlainDataReducer} from 'sdc-app/common/reducers/PlainDataReducer.js';
-import {actionTypes as licenseModelOverviewConstants, selectedButton, VLM_DESCRIPTION_FORM} from './overview/LicenseModelOverviewConstants.js';
+import {actionTypes as licenseModelOverviewConstants, VLM_DESCRIPTION_FORM} from './overview/LicenseModelOverviewConstants.js';
import limitEditorReducer from './limits/LimitEditorReducer.js';
export default combineReducers({
@@ -58,7 +58,7 @@ export default combineReducers({
licenseKeyGroupsList: licenseKeyGroupsListReducer
}),
licenseModelOverview: combineReducers({
- selectedTab: (state = selectedButton.VLM_LIST_VIEW, action) => action.type === licenseModelOverviewConstants.LICENSE_MODEL_OVERVIEW_TAB_SELECTED ? action.buttonTab : state,
+ selectedTab: (state = null, action) => action.type === licenseModelOverviewConstants.LICENSE_MODEL_OVERVIEW_TAB_SELECTED ? action.buttonTab : state,
descriptionEditor: createPlainDataReducer(function(state = false, action) {
if (action.type === licenseModelOverviewConstants.LM_DATA_CHANGED) {
return {
diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/LicenseModelOverview.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/LicenseModelOverview.js
index 1ca4f37988..9d714ec62d 100644
--- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/LicenseModelOverview.js
+++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/LicenseModelOverview.js
@@ -128,17 +128,18 @@ export const mapStateToProps = ({licenseModel: {licenseModelEditor, entitlementP
modalHeader = overviewEditorHeaders.LICENSE_KEY_GROUP;
isDisplayModal = true;
}
-
- if (licenseModelOverview.selectedTab === selectedButton.NOT_IN_USE) {
- licensingDataList = [
- ...featureGroup.featureGroupsList.reduce(checkFG, []),
- ...entitlementPool.entitlementPoolsList.reduce(checkEP, []),
- ...licenseKeyGroup.licenseKeyGroupsList.reduce(checkLG, [])
- ];
- }else {
- licensingDataList = licenseAgreement.licenseAgreementList && licenseAgreement.licenseAgreementList.length ? licenseAgreement.licenseAgreementList.map(mapLicenseAgreementData) : [];
+ let orphanDataList = [
+ ...featureGroup.featureGroupsList.reduce(checkFG, []),
+ ...entitlementPool.entitlementPoolsList.reduce(checkEP, []),
+ ...licenseKeyGroup.licenseKeyGroupsList.reduce(checkLG, [])
+ ];
+
+ licensingDataList = licenseAgreement.licenseAgreementList && licenseAgreement.licenseAgreementList.length ? licenseAgreement.licenseAgreementList.map(mapLicenseAgreementData) : [];
+ let selectedTab = licenseModelOverview.selectedTab;
+ // on first entry, we will decide what tab to open depending on data. if there are no connections, we will open the orphans
+ if (selectedTab === null) {
+ selectedTab = (licensingDataList.length) ? selectedButton.VLM_LIST_VIEW : selectedButton.NOT_IN_USE;
}
-
return {
isReadOnlyMode: VersionControllerUtils.isReadOnly(licenseModelEditor.data),
isDisplayModal,
@@ -146,8 +147,8 @@ export const mapStateToProps = ({licenseModel: {licenseModelEditor, entitlementP
licenseModelId: licenseModelEditor.data.id,
version: licenseModelEditor.data.version,
licensingDataList,
- selectedTab: licenseModelOverview.selectedTab
-
+ orphanDataList,
+ selectedTab
};
};
diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/LicenseModelOverviewView.jsx b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/LicenseModelOverviewView.jsx
index 15f6c2d1bb..77289a3e08 100644
--- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/LicenseModelOverviewView.jsx
+++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/LicenseModelOverviewView.jsx
@@ -51,6 +51,7 @@ class LicenseModelOverviewView extends React.Component {
isReadOnlyMode: React.PropTypes.bool,
licenseModelId: React.PropTypes.string,
licensingDataList: React.PropTypes.array,
+ orphanDataList: React.PropTypes.array,
modalHeader: React.PropTypes.string,
selectedTab: React.PropTypes.string,
onTabSelect: React.PropTypes.func,
@@ -59,17 +60,20 @@ class LicenseModelOverviewView extends React.Component {
};
render() {
- let {isDisplayModal, modalHeader, licensingDataList, selectedTab, onTabSelect} = this.props;
+ let {isDisplayModal, modalHeader, licensingDataList, selectedTab, onTabSelect, orphanDataList} = this.props;
let selectedInUse = selectedTab !== selectedButton.NOT_IN_USE;
-
+ let dataList = selectedInUse ? licensingDataList : orphanDataList;
return(
<div className='license-model-overview'>
<SummaryView/>
<div className={classNames('overview-list-section ', !selectedInUse ? 'overview-list-orphans' : '' )}>
<div className='vlm-list-tab-panel'>
- <ListButtons onTabSelect={onTabSelect} selectedTab={selectedTab}/>
+ <ListButtons onTabSelect={onTabSelect}
+ selectedTab={selectedTab}
+ hasOrphans={orphanDataList.length > 0}
+ hasLicensing={licensingDataList.length > 0}/>
</div>
- <VLMListView licensingDataList={licensingDataList} showInUse={selectedInUse}/>
+ <VLMListView licensingDataList={dataList} showInUse={selectedInUse}/>
</div>
{
isDisplayModal &&
diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/summary/ListButtons.jsx b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/summary/ListButtons.jsx
index 3d81aa5d5c..f02c82d205 100644
--- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/summary/ListButtons.jsx
+++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/summary/ListButtons.jsx
@@ -19,18 +19,22 @@ import Tabs from 'sdc-ui/lib/react/Tabs.js';
import Tab from 'sdc-ui/lib/react/Tab.js';
import i18n from 'nfvo-utils/i18n/i18n.js';
-function ListButtons ({onTabSelect, selectedTab}) {
+function ListButtons ({onTabSelect, selectedTab, hasOrphans, hasLicensing}) {
+ // no data, no tabs
+ if (!hasLicensing && !hasOrphans) {
+ return null;
+ }
return (
<Tabs
onTabClick={(tabId) => onTabSelect(tabId)}
- activeTab={selectedTab}
- className='overview-buttons-section'
+ activeTab={selectedTab}
+ className='overview-buttons-section'
type='header' >
- <Tab
+ <Tab
tabId={selectedButton.VLM_LIST_VIEW}
title={i18n('Connections List')}
data-test-id='vlm-overview-vlmlist-tab' />
- <Tab
+ <Tab
tabId={selectedButton.NOT_IN_USE}
title={i18n('Orphans List')}
data-test-id='vlm-overview-orphans-tab' />
diff --git a/openecomp-ui/test/licenseModel/overview/test.js b/openecomp-ui/test/licenseModel/overview/test.js
index c78c3e47b1..cb1a9c34b2 100644
--- a/openecomp-ui/test/licenseModel/overview/test.js
+++ b/openecomp-ui/test/licenseModel/overview/test.js
@@ -29,7 +29,17 @@ describe('License Model Overview: ', function () {
expect(mapStateToProps).toBeTruthy();
});
- const VLM1 = LicenseModelOverviewFactory.build();
+ const VLM1 = LicenseModelOverviewFactory.build({
+ featureGroup: {
+ featureGroupsList: [],
+ },
+ entitlementPool: {
+ entitlementPoolsList: []
+ },
+ licenseKeyGroup: {
+ licenseKeyGroupsList: []
+ }
+ });
it('should mapper return vlm overview basic data', () => {
const state = {
@@ -42,6 +52,7 @@ describe('License Model Overview: ', function () {
expect(props.modalHeader).toEqual(undefined);
expect(props.licenseModelId).toEqual(VLM1.licenseModelEditor.data.id);
expect(props.licensingDataList).toEqual([]);
+ expect(props.orphanDataList).toEqual([]);
expect(props.selectedTab).toEqual(selectedButton.VLM_LIST_VIEW);
});
@@ -51,6 +62,15 @@ describe('License Model Overview: ', function () {
licenseAgreementEditor: {
data: LicenseAgreement.build()
}
+ },
+ featureGroup: {
+ featureGroupsList: [],
+ },
+ entitlementPool: {
+ entitlementPoolsList: []
+ },
+ licenseKeyGroup: {
+ licenseKeyGroupsList: []
}
});
@@ -101,11 +121,18 @@ describe('License Model Overview: ', function () {
});
it('should mapper return overview data for show EP modal', () => {
- const VLM1 = LicenseModelOverviewFactory.build({
+ const VLM1 = LicenseModelOverviewFactory.build( {
+ featureGroup: {
+ featureGroupsList: [],
+ },
entitlementPool: {
+ entitlementPoolsList: [],
entitlementPoolEditor: {
data: EntitlementPool.build()
}
+ },
+ licenseKeyGroup: {
+ licenseKeyGroupsList: []
}
});
@@ -283,7 +310,6 @@ describe('License Model Overview: ', function () {
selectedTab: selectedButton.NOT_IN_USE
}
});
-
const state = {
licenseModel: VLM1
};
@@ -300,7 +326,8 @@ describe('License Model Overview: ', function () {
expect(props.isDisplayModal).toEqual(false);
expect(props.modalHeader).toEqual(undefined);
expect(props.licenseModelId).toEqual(VLM1.licenseModelEditor.data.id);
- expect(props.licensingDataList).toEqual(expectedLicensingDataList);
+ expect(props.licensingDataList).toEqual([]);
+ expect(props.orphanDataList).toEqual(expectedLicensingDataList);
expect(props.selectedTab).toEqual(selectedButton.NOT_IN_USE);
});
@@ -349,7 +376,9 @@ describe('License Model Overview: ', function () {
expect(props.isDisplayModal).toEqual(false);
expect(props.modalHeader).toEqual(undefined);
expect(props.licenseModelId).toEqual(VLM1.licenseModelEditor.data.id);
- expect(props.licensingDataList).toEqual(expectedLicensingDataList);
+ expect(props.licensingDataList).toEqual([]);
+ expect(props.orphanDataList).toEqual(expectedLicensingDataList);
expect(props.selectedTab).toEqual(selectedButton.NOT_IN_USE);
});
+
});
diff --git a/openecomp-ui/test/licenseModel/overview/views.test.js b/openecomp-ui/test/licenseModel/overview/views.test.js
index 4a38afccca..cee34145a8 100644
--- a/openecomp-ui/test/licenseModel/overview/views.test.js
+++ b/openecomp-ui/test/licenseModel/overview/views.test.js
@@ -56,6 +56,7 @@ describe('License Model Overview - View: ', function () {
isDisplayModal: false,
modalHeader: undefined,
licensingDataList: [laData],
+ orphanDataList: [],
selectedTab: selectedButton.VLM_LIST_VIEW,
onTabSelect: () => {}
};