326dae93f851ed190eff7ddea2b5de87083f085a
[aai/sparky-fe.git] / src / app / vnfSearch / VnfSearchTotalCountVisualization.jsx
1 /* eslint-disable max-len,max-len,max-len,max-len,max-len,max-len */
2 /*
3  * ============LICENSE_START===================================================
4  * SPARKY (AAI UI service)
5  * ============================================================================
6  * Copyright © 2017 AT&T Intellectual Property.
7  * Copyright © 2017 Amdocs
8  * All rights reserved.
9  * ============================================================================
10  * Licensed under the Apache License, Version 2.0 (the "License");
11  * you may not use this file except in compliance with the License.
12  * You may obtain a copy of the License at
13  *
14  *      http://www.apache.org/licenses/LICENSE-2.0
15  *
16  * Unless required by applicable law or agreed to in writing, software
17  * distributed under the License is distributed on an "AS IS" BASIS,
18  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19  * See the License for the specific language governing permissions and
20  * limitations under the License.
21  * ============LICENSE_END=====================================================
22  *
23  * ECOMP and OpenECOMP are trademarks
24  * and service marks of AT&T Intellectual Property.
25  */
26
27 import React, {Component} from 'react';
28 import {connect} from 'react-redux';
29
30 import i18n from 'utils/i18n/i18n';
31
32 import {TOTAL_VNF_COUNT} from 'app/vnfSearch/VnfSearchConstants.js';
33
34 let mapStateToProps = ({vnfSearch}) => {
35   let {
36         count = TOTAL_VNF_COUNT.emptyValue
37       } = vnfSearch;
38
39   return {
40     count
41   };
42 };
43
44 class VnfSearchTotalCountVisualization extends Component {
45   static propTypes = {
46     count: React.PropTypes.number
47   };
48
49   render() {
50     let {
51           count
52         } = this.props;
53
54     let visualizationClass = 'visualizations';
55     if (count === null) {
56       visualizationClass = 'visualizations hidden';
57     }
58
59     return (
60       <div id='audit-visualizations' className={visualizationClass}>
61         <div className='visualization-charts'>
62           <div className='visualization-side-by-side-30'>
63             <span>&nbsp;</span>
64             <h3>{i18n(TOTAL_VNF_COUNT.title)}</h3>
65             <div className='total-box-entity-count'>
66               <span>{count}</span>
67             </div>
68           </div>
69         </div>
70       </div>
71     );
72   }
73
74 }
75 export default connect(mapStateToProps)(VnfSearchTotalCountVisualization);