2016-06-18 21:53:18 +02:00
|
|
|
'use strict';
|
|
|
|
const React = require('react');
|
|
|
|
const LogEntryList = require('./LogEntryList');
|
|
|
|
const eventStore = require('../../stores/EventStore');
|
|
|
|
const ErrorActions = require('../../stores/ErrorActions');
|
2014-11-13 15:14:41 +01:00
|
|
|
|
2016-06-18 21:53:18 +02:00
|
|
|
const LogEntriesComponent = React.createClass({
|
2016-07-02 11:54:50 +02:00
|
|
|
getInitialState () {
|
2014-11-13 15:14:41 +01:00
|
|
|
return {
|
|
|
|
createView: false,
|
2016-06-18 21:55:46 +02:00
|
|
|
events: [],
|
2014-11-13 15:14:41 +01:00
|
|
|
};
|
|
|
|
},
|
|
|
|
|
2016-07-02 11:54:50 +02:00
|
|
|
componentDidMount () {
|
2016-06-18 21:53:18 +02:00
|
|
|
eventStore.getEvents().then(res => {
|
2016-06-18 21:55:46 +02:00
|
|
|
this.setState({ events: res.events });
|
2016-06-18 21:53:18 +02:00
|
|
|
}, this.initError);
|
2014-11-13 15:14:41 +01:00
|
|
|
},
|
|
|
|
|
2016-07-02 11:54:50 +02:00
|
|
|
initError () {
|
2016-06-18 21:55:46 +02:00
|
|
|
ErrorActions.error('Could not load events from server');
|
2014-11-13 15:14:41 +01:00
|
|
|
},
|
|
|
|
|
2016-07-02 11:54:50 +02:00
|
|
|
render () {
|
2014-11-13 15:14:41 +01:00
|
|
|
return (
|
|
|
|
<div>
|
2015-03-28 09:51:31 +01:00
|
|
|
<h1>Log</h1>
|
2014-11-13 15:14:41 +01:00
|
|
|
<hr />
|
2014-11-14 07:29:55 +01:00
|
|
|
<LogEntryList events={this.state.events} />
|
2014-11-13 15:14:41 +01:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
2015-03-17 20:29:03 +01:00
|
|
|
module.exports = LogEntriesComponent;
|