Rift.IO OSM R1 Initial Submission
[osm/UI.git] / skyquake / plugins / launchpad / src / vnfr / vnfrView.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 import React from 'react';
20 import VnfrActions from './vnfrActions.js';
21 import VnfrSource from './vnfrSource.js';
22 import VnfrStore from './vnfrStore.js';
23 import VnfrCard from './vnfrCard.jsx';
24 import Loader from 'widgets/loading-indicator/loadingIndicator.jsx';
25 import ScreenLoader from 'widgets/screen-loader/screenLoader.jsx';
26 let ReactCSSTransitionGroup = require('react-addons-css-transition-group');
27 class VnfrView extends React.Component {
28   constructor(props) {
29     super(props);
30     this.state = VnfrStore.getState();
31     this.state.vnfrs = [];
32   }
33   componentDidMount() {
34     VnfrStore.listen(this.handleUpdate);
35     console.log(VnfrStore)
36     setTimeout(function() {
37       VnfrStore.openVnfrSocket();
38       // VnfrStore.vnfrMock();
39     },100);
40   }
41   handleUpdate = (data) => {
42     this.setState(data);
43   }
44   render() {
45     let self = this;
46     let html;
47     let vnfrCards = [];
48     self.state.vnfrs.map(function(vnfr) {
49                  vnfrCards.push(<VnfrCard data={vnfr}></VnfrCard>)
50     })
51     html = (
52             <ReactCSSTransitionGroup
53             transitionName="loader-animation"
54             component="div"
55             className="dashboardCard_wrapper"
56
57             >
58               {vnfrCards}
59             </ReactCSSTransitionGroup>
60     );
61     return html;
62   }
63 }
64 export default VnfrView;