nci/static/js/app/components/builds/view.js

49 lines
1.0 KiB
JavaScript
Raw Normal View History

2015-05-17 13:48:16 +00:00
'use strict';
define([
'react',
'react-router',
2015-05-17 13:48:16 +00:00
'reflux',
'app/actions/build',
'app/stores/build',
'app/components/terminal/terminal',
'templates/app/components/builds/view',
'app/components/common/index'
2015-05-17 13:48:16 +00:00
], function(
React, Router, Reflux, BuildActions, buildStore, TerminalComponent, template,
CommonComponents
2015-05-17 13:48:16 +00:00
) {
template = template.locals({
DateTime: CommonComponents.DateTime,
Scm: CommonComponents.Scm,
Terminal: TerminalComponent,
Link: Router.Link
2015-05-17 13:48:16 +00:00
});
var Component = React.createClass({
mixins: [Reflux.ListenerMixin],
2015-07-11 18:31:23 +00:00
statics: {
willTransitionTo: function(transition, params, query) {
BuildActions.read(Number(params.id));
}
},
2015-05-17 13:48:16 +00:00
componentDidMount: function() {
this.listenTo(buildStore, this.updateBuild);
},
updateBuild: function(build) {
if (!this.state.build && build) {
BuildActions.readTerminalOutput(build);
}
this.setState({build: build});
},
render: template,
getInitialState: function() {
return {
build: null
};
}
});
return Component;
});