1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-10-18 20:09:08 +02:00
unleash.unleash/packages/unleash-frontend/public/js/components/log/LogEntryList.jsx

57 lines
1.5 KiB
React
Raw Normal View History

2016-06-18 21:53:18 +02:00
'use strict';
const React = require('react');
const LogEntry = require('./LogEntry');
2014-11-13 15:14:41 +01:00
2016-06-18 21:53:18 +02:00
const LogEntryList = React.createClass({
2014-11-13 15:14:41 +01:00
propTypes: {
2016-06-18 21:55:46 +02:00
events: React.PropTypes.array.isRequired,
2014-11-13 15:14:41 +01:00
},
2016-07-02 11:54:50 +02:00
getInitialState () {
return {
2016-06-18 21:55:46 +02:00
showFullEvents: false,
2015-03-17 20:40:22 +01:00
};
},
2016-07-02 11:54:50 +02:00
render () {
const logEntryNodes = this.props.events.map(evt =>
<LogEntry event={evt} key={evt.id} showFullEvents={this.state.showFullEvents} />);
2014-11-13 15:14:41 +01:00
return (
<div>
2015-03-17 20:40:22 +01:00
<label className="prs fright-ht768 smalltext">
Show full events
<input
type="checkbox"
className="mlm"
value={this.state.fullEvents}
2016-08-25 13:24:14 +02:00
onChange={this.toggleFullEvents} />
</label>
2016-06-18 21:55:46 +02:00
<table className="outerborder zebra-striped">
2014-11-13 15:14:41 +01:00
<thead>
<tr>
2014-11-17 10:10:47 +01:00
<th>When</th>
2014-11-13 15:14:41 +01:00
<th>Action</th>
<th>
2015-03-17 20:40:22 +01:00
Data
</th>
2014-11-13 15:14:41 +01:00
<th>Author</th>
</tr>
</thead>
<tbody>
2014-11-14 07:29:55 +01:00
{logEntryNodes}
2014-11-13 15:14:41 +01:00
</tbody>
</table>
</div>
2015-03-17 20:40:22 +01:00
);
},
2016-07-02 11:54:50 +02:00
toggleFullEvents () {
2016-06-18 21:55:46 +02:00
this.setState({ showFullEvents: !this.state.showFullEvents });
},
2014-11-13 15:14:41 +01:00
});
2015-03-17 20:40:22 +01:00
module.exports = LogEntryList;