5d3f1f2e7fc583b68dd2143ccb88abb795bf8459
[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.oneOfType([
47       React.PropTypes.string,
48       React.PropTypes.number
49     ])
50   };
51
52   render() {
53     let {
54           count
55         } = this.props;
56
57     let visualizationClass = 'visualizations';
58     if (count === null) {
59       visualizationClass = 'visualizations hidden';
60     }
61
62     return (
63       <div id='audit-visualizations' className={visualizationClass}>
64         <div className='visualization-charts'>
65           <div className='visualization-side-by-side-30'>
66             <span>&nbsp;</span>
67             <h3>{i18n(TOTAL_VNF_COUNT.title)}</h3>
68             <div className='total-box-entity-count'>
69               <span>{count}</span>
70             </div>
71           </div>
72         </div>
73       </div>
74     );
75   }
76
77 }
78 export default connect(mapStateToProps)(VnfSearchTotalCountVisualization);