react 16 upgrade
[sdc.git] / openecomp-ui / src / sdc-app / onboarding / licenseModel / overview / LicenseModelOverviewView.jsx
1 /*
2  * Copyright © 2016-2018 European Support Limited
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 import React from 'react';
17 import PropTypes from 'prop-types';
18 import classNames from 'classnames';
19
20 import { selectedButton } from './LicenseModelOverviewConstants.js';
21
22 import SummaryView from './SummaryView.jsx';
23 import VLMListView from './VLMListView.jsx';
24 import ListButtons from './summary/ListButtons.jsx';
25
26 class LicenseModelOverviewView extends React.Component {
27     static propTypes = {
28         isDisplayModal: PropTypes.bool,
29         isReadOnlyMode: PropTypes.bool,
30         licenseModelId: PropTypes.string,
31         licensingDataList: PropTypes.array,
32         orphanDataList: PropTypes.array,
33         modalHeader: PropTypes.string,
34         selectedTab: PropTypes.string,
35         onTabSelect: PropTypes.func,
36         onCallVCAction: PropTypes.func,
37         onClose: PropTypes.func
38     };
39
40     render() {
41         let {
42             licensingDataList,
43             selectedTab,
44             onTabSelect,
45             orphanDataList,
46             isReadOnlyMode
47         } = this.props;
48         let selectedInUse = selectedTab !== selectedButton.NOT_IN_USE;
49         let dataList = selectedInUse ? licensingDataList : orphanDataList;
50         return (
51             <div className="license-model-overview">
52                 <SummaryView isReadOnlyMode={isReadOnlyMode} />
53                 <div
54                     className={classNames(
55                         'overview-list-section ',
56                         !selectedInUse ? 'overview-list-orphans' : ''
57                     )}>
58                     <div className="vlm-list-tab-panel">
59                         <ListButtons
60                             onTabSelect={onTabSelect}
61                             selectedTab={selectedTab}
62                             hasOrphans={orphanDataList.length > 0}
63                             hasLicensing={licensingDataList.length > 0}
64                         />
65                     </div>
66                     <VLMListView
67                         licensingDataList={dataList}
68                         showInUse={selectedInUse}
69                     />
70                 </div>
71             </div>
72         );
73     }
74 }
75
76 export default LicenseModelOverviewView;