diff --git a/public/js/components/feature/Feature.jsx b/public/js/components/feature/Feature.jsx index bf05600f4a..9105dc732a 100644 --- a/public/js/components/feature/Feature.jsx +++ b/public/js/components/feature/Feature.jsx @@ -1,13 +1,29 @@ var React = require('react'); var FeatureForm = require('./FeatureForm'); +var LogEntryList = require('../log/LogEntryList'); +var eventStore = require('../../stores/EventStore'); + + var Feature = React.createClass({ getInitialState: function() { return { - editMode: false + editMode: false, + showHistory: false, + events: [] }; }, + handleEventsResponse: function(response) { + this.setState({events: response}); + }, + + toggleHistory: function() { + eventStore.getEventsByName(this.props.feature.name).then(this.handleEventsResponse); + this.setState({showHistory: !this.state.showHistory}); + }, + + toggleEditMode: function() { this.setState({editMode: !this.state.editMode}); }, @@ -34,29 +50,44 @@ var Feature = React.createClass({ renderViewMode: function() { return ( - - - - - - - {this.props.feature.name} - + + + + + + + + {this.props.feature.name} + - - {this.props.feature.description || '\u00a0'} - + + {this.props.feature.description || '\u00a0'} + - - {this.props.feature.strategy} - + + {this.props.feature.strategy} + - - - - + + + + + + {this.state.showHistory ? this.renderHistory() : this.renderEmptyRow()} + ); + }, + + renderEmptyRow: function() { + return (); + }, + + renderHistory: function() { + return ( + + ); } + }); module.exports = Feature; \ No newline at end of file diff --git a/public/js/components/feature/FeatureList.jsx b/public/js/components/feature/FeatureList.jsx index 9f42451e7c..41afe41a0d 100644 --- a/public/js/components/feature/FeatureList.jsx +++ b/public/js/components/feature/FeatureList.jsx @@ -24,9 +24,7 @@ var FeatureList = React.createClass({ - - {featureNodes} - + {featureNodes} ); diff --git a/public/js/components/log/LogEntry.jsx b/public/js/components/log/LogEntry.jsx index 3c802b3abf..3311c19c46 100644 --- a/public/js/components/log/LogEntry.jsx +++ b/public/js/components/log/LogEntry.jsx @@ -7,6 +7,9 @@ var LogEntry = React.createClass({ render: function() { var d = new Date(this.props.event.createdAt); + var localEventData = JSON.parse(JSON.stringify(this.props.event.data)); + delete localEventData.description; + delete localEventData.name; return ( @@ -14,10 +17,10 @@ var LogEntry = React.createClass({ kl. {d.getHours() + "." + d.getMinutes()} - {this.props.event.type} + {this.props.event.data.name}[{this.props.event.type}] - {JSON.stringify(this.props.event.data)} + {JSON.stringify(localEventData)} {this.props.event.createdBy} diff --git a/public/js/stores/EventStore.js b/public/js/stores/EventStore.js index 096a65e8d2..a26ffe135f 100644 --- a/public/js/stores/EventStore.js +++ b/public/js/stores/EventStore.js @@ -10,7 +10,16 @@ var EventStore = { method: 'get', type: TYPE }); + }, + + getEventsByName: function (name) { + return reqwest({ + url: 'events/' + name, + method: 'get', + type: TYPE + }); } + }; module.exports = EventStore;