Entitlement Pool - Support Type Field
[sdc.git] / openecomp-ui / src / sdc-app / onboarding / licenseModel / overview / listItems / EntitlementPool.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
13  * or implied. See the License for the specific language governing
14  * permissions and limitations under the License.
15  */
16 import React, { Component } from 'react';
17 import i18n from 'nfvo-utils/i18n/i18n.js';
18 import {
19     extractValue,
20     extractUnits
21 } from 'sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsConstants.js';
22 import ArrowCol from './listItemsComponents/ArrowCol.jsx';
23 import ItemInfo from './listItemsComponents/ItemInfo.jsx';
24 import IconCol from './listItemsComponents/IconCol.jsx';
25 import {
26     AdditionalDataCol,
27     AdditionalDataElement
28 } from './listItemsComponents/AdditionalDataCol.jsx';
29
30 class EntitlementPool extends Component {
31     render() {
32         let {
33             epData: {
34                 name,
35                 description,
36                 type,
37                 thresholdValue,
38                 thresholdUnits,
39                 manufacturerReferenceNumber
40             },
41             isOrphan
42         } = this.props;
43         return (
44             <div
45                 className={`vlm-list-item vlm-list-item-ep ${
46                     isOrphan ? 'orphan-list-item' : ''
47                 }`}
48                 data-test-id="vlm-list-item-ep">
49                 {!isOrphan && <ArrowCol />}
50                 <IconCol className="ep-icon" text="EP" />
51                 <ItemInfo name={name} description={description} />
52                 <AdditionalDataCol>
53                     {type && (
54                         <AdditionalDataElement
55                             className="vlm-list-item-entitlement-metric"
56                             name={i18n('Type')}
57                             value={extractValue(type)}
58                         />
59                     )}
60                     {thresholdValue && (
61                         <AdditionalDataElement
62                             className="vlm-list-item-entitlement-metric"
63                             name={i18n('Entitlement')}
64                             value={`${thresholdValue} ${extractUnits(
65                                 thresholdUnits
66                             )}`}
67                         />
68                     )}
69                     {manufacturerReferenceNumber && (
70                         <AdditionalDataElement
71                             className="vlm-list-item-entitlement-metric"
72                             name={i18n('Manufacturer Reference Number')}
73                             value={manufacturerReferenceNumber}
74                         />
75                     )}
76                 </AdditionalDataCol>
77             </div>
78         );
79     }
80 }
81
82 export default EntitlementPool;