summaryrefslogtreecommitdiffstats
path: root/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview
diff options
context:
space:
mode:
authorilanap <ilanap@amdocs.com>2017-11-07 11:54:10 +0200
committerilanap <ilanap@amdocs.com>2017-11-07 11:59:26 +0200
commitc6a41de2f5a2e3217c8364dcd27f297069fc005f (patch)
tree5e83c950a7ff6c384973ef44e6c4246a9d618505 /openecomp-ui/src/sdc-app/onboarding/licenseModel/overview
parentd5fdfc4e67ba9839e680fa685134660659356c68 (diff)
Update VLM Overview tab behavior
Issue-ID: SDC-637 Change-Id: I30211422b9af72a8e2dc4fd58713145878881555 Signed-off-by: ilanap <ilanap@amdocs.com>
Diffstat (limited to 'openecomp-ui/src/sdc-app/onboarding/licenseModel/overview')
-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
3 files changed, 30 insertions, 21 deletions
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' />