blob: c2d6f8e4d640a727b233acb4512f4758de259815 [file] [log] [blame]
Einav Weiss Keidar1801b242018-08-13 16:19:46 +03001/*
2 * Copyright © 2016-2018 European Support Limited
AviZi280f8012017-06-09 02:39:56 +03003 *
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 *
Einav Weiss Keidar1801b242018-08-13 16:19:46 +03008 * http://www.apache.org/licenses/LICENSE-2.0
AviZi280f8012017-06-09 02:39:56 +03009 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
Einav Weiss Keidar1801b242018-08-13 16:19:46 +030012 * 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.
AviZi280f8012017-06-09 02:39:56 +030015 */
16import React from 'react';
talig8e9c0652017-12-20 14:30:43 +020017import PropTypes from 'prop-types';
AviZi280f8012017-06-09 02:39:56 +030018import classNames from 'classnames';
19
Einav Weiss Keidar1801b242018-08-13 16:19:46 +030020import { selectedButton } from './LicenseModelOverviewConstants.js';
AviZi280f8012017-06-09 02:39:56 +030021
22import SummaryView from './SummaryView.jsx';
23import VLMListView from './VLMListView.jsx';
24import ListButtons from './summary/ListButtons.jsx';
25
AviZi280f8012017-06-09 02:39:56 +030026class LicenseModelOverviewView extends React.Component {
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020027 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 };
AviZi280f8012017-06-09 02:39:56 +030039
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020040 render() {
41 let {
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020042 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>
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020071 </div>
72 );
73 }
AviZi280f8012017-06-09 02:39:56 +030074}
75
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020076export default LicenseModelOverviewView;