2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
6 * Copyright © 2017 Amdocs
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END=========================================================
21 * ECOMP is a trademark and service mark of AT&T Intellectual Property.
23 import {connect} from 'react-redux';
24 import React, {Component} from 'react';
25 import Table from 'react-bootstrap/lib/Table';
26 import i18n from 'utils/i18n/i18n';
30 SELECTED_NODE_TABLE_COLUMN_NAMES
31 } from 'app/tierSupport/selectedNodeDetails/SelectedNodeDetailsConstants.js';
33 let mapStateToProps = ({tierSupport: {selectedNodeDetails}}) => {
34 let {nodeData = {}, nodeType = '', uid = ''} = selectedNodeDetails;
43 class SelectedNodeDetails extends Component {
45 nodeData: React.PropTypes.object,
46 nodeType: React.PropTypes.string,
47 uid: React.PropTypes.string
51 const {nodeData, nodeType, uid} = this.props;
53 let tableClass = 'ts-selected-node-table';
54 let noSelectionMessageClass = 'hidden';
55 let tableColumns = [];
58 if (Object.keys(nodeData).length > 0) {
59 let cellClassName = '';
60 for (let i = 1; i <= SELECTED_NODE_TABLE_COLUMN_NAMES.length; i++) {
61 cellClassName = (i % 2 ? 'left-column-cell' : 'right-column-cell');
62 tableColumns.push(<th className={cellClassName} key={i}>
63 {i18n(SELECTED_NODE_TABLE_COLUMN_NAMES[i - 1])}
67 for (var key in nodeData) {
68 let value = nodeData[key];
71 <td className='left-column-cell'>{key}</td>
72 <td className='right-column-cell'>{value}</td>
77 tableClass = 'hidden';
78 noSelectionMessageClass = '';
82 <div className='ts-selected-node-details'>
83 <h1>{i18n(SELECTED_NODE_TITLE)}</h1>
86 <Table bsClass={tableClass}>
96 <p className={noSelectionMessageClass}>{i18n(NO_SELECTION)}</p>
101 export default connect(mapStateToProps)(SelectedNodeDetails);