1856dda7847308d051df97705b39d13b4b405b5a
[osm/UI.git] / skyquake / plugins / launchpad / src / launchpad_card / launchpadCardCloudAccount.jsx
1
2 /*
3  * 
4  *   Copyright 2016 RIFT.IO Inc
5  *
6  *   Licensed under the Apache License, Version 2.0 (the "License");
7  *   you may not use this file except in compliance with the License.
8  *   You may obtain a copy of the License at
9  *
10  *       http://www.apache.org/licenses/LICENSE-2.0
11  *
12  *   Unless required by applicable law or agreed to in writing, software
13  *   distributed under the License is distributed on an "AS IS" BASIS,
14  *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  *   See the License for the specific language governing permissions and
16  *   limitations under the License.
17  *
18  */
19
20 import React from 'react';
21 import Loader from 'widgets/loading-indicator/loadingIndicator.jsx';
22
23 export default class LaunchpadCardCloudAccount extends React.Component {
24   constructor(props) {
25     super(props);
26   }
27   componentWillReceiveProps(nextProps) {
28
29   }
30   render() {
31     let html;
32     let isDisplayed = this.props.display;
33     let status = [];
34     if (this.props.nsr['cloud-account']) {
35       status.push(
36         (<li key="nsr"><h3>NSR: {this.props.nsr['cloud-account']}</h3></li>)
37       )
38     }
39     this.props.nsr['vnfrs'].map(function(v,i) {
40       if(v.hasOwnProperty('cloud-account')) {
41         status.push(
42           (<li key={i}><h3>VNFR {v['short-name']}: {v['cloud-account']}</h3></li>)
43         )
44       }
45     })
46     html = (
47           <ul>
48             {status}
49           </ul>
50       )
51     return (<div className={this.props.className + (isDisplayed ? '_open':'_close')}><h2>VIM Accounts</h2>{html}</div>);
52   }
53 }
54
55 LaunchpadCardCloudAccount.defaultProps = {
56   display: false,
57   nsr: {}
58 }
59
60