Revert "BUG-410 -- update RIFT platform"
[osm/UI.git] / skyquake / plugins / logging / src / logging.jsx
1 /*
2  * 
3  *   Copyright 2016 RIFT.IO Inc
4  *
5  *   Licensed under the Apache License, Version 2.0 (the "License");
6  *   you may not use this file except in compliance with the License.
7  *   You may obtain a copy of the License at
8  *
9  *       http://www.apache.org/licenses/LICENSE-2.0
10  *
11  *   Unless required by applicable law or agreed to in writing, software
12  *   distributed under the License is distributed on an "AS IS" BASIS,
13  *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  *   See the License for the specific language governing permissions and
15  *   limitations under the License.
16  *
17  */
18  import React from 'react';
19  import './logging.scss';
20  import AppHeader from 'widgets/header/header.jsx';
21  import LoggingActions from './loggingActions.js';
22  import LoggingStore from './loggingStore.js';
23
24  export default class Logging extends React.Component {
25         constructor(props) {
26                 super(props);
27                 console.log("Logging.constructor called");
28                 
29
30                 this.state = LoggingStore.getState();
31                 console.log("Logging.constructor: state=", this.state);
32                 LoggingStore.listen(this.storeListener);
33                 // LoggingStore.get();
34         }
35
36         storeListener = (state) => {
37                 console.log("Logging.storeListener called");
38                 this.setState(state);
39         }
40
41         //handleUpdate(data)
42         // Lifecycle methods
43         // https://facebook.github.io/react/docs/component-specs.html
44
45         componentWillMount() {
46                 console.log("Logging.componentWillMount called");
47         }
48         componentDidMount() {
49                 console.log("Logging.componentDidMount called");
50                 //LoggingStore.getSysLogViewerURL();
51                 LoggingStore.getLoggingConfig();
52                 //LoggingStore.getLoggingOperational();
53         }
54
55         // Invoked when a component is receiving new props. This method is not called for the intial render.
56         // use this as an opportunity to react to a prop transition before render() is called
57         componentWillReceiveProps(nextProps) {
58                 console.log("Logging.componentWillReceiveProps called");
59                 // this.setState({ key: nextProps.value});
60         }
61
62         // shouldComonentUpdate(nextProps, nextState) {}
63         // Invoked immediately before rendering when new props or state are being received
64         // componentWillUpdate(nextProps, nextState) {}
65
66
67         // Invoked immediately after the component's updates are flushed to the DOM.
68         // This method is not called for the initial render.
69         // Use this as an opportunity to operate on the DOM when the component has been updated.
70         componentDidUpdate(prevPros, prevState) {
71
72         }
73         componentWillUnmount() {
74                 console.log("Logging.componentWillUnmount called");
75                 //LoggingStore.unlisten(this.storeListener);
76         }
77         render() {
78                 console.log("Logging.render called");
79                 console.log("Logging.state=", JSON.stringify(this.state));
80                 var html=(<div><h1>Hello Logging page</h1></div>);
81                 if (this.state != null) {
82                         html = (
83                                 <div>
84                                         <p>Placeholder for logging page</p>
85                                         <p>alpha</p>
86                                 </div>
87                         );
88                 }
89                 return (
90                         <div className="logging-container">
91                                 {html}
92                         </div>
93                 );
94         }
95
96  }