nci/static/js/app/components/builds/item.js
2015-07-21 23:00:09 +03:00

42 lines
1023 B
JavaScript

'use strict';
define([
'react', 'react-router', 'app/actions/project',
'app/actions/build', 'templates/app/components/builds/item',
'app/components/terminal/terminal',
'app/components/common/index'
], function(
React, Router, ProjectActions, BuildActions, template,
TerminalComponent, CommonComponents
) {
template = template.locals({
DateTime: CommonComponents.DateTime,
Duration: CommonComponents.Duration,
Scm: CommonComponents.Scm,
Terminal: TerminalComponent,
Link: Router.Link
});
var Component = React.createClass({
getInitialState: function() {
return {
showTerminal: false
};
},
onRebuildProject: function(projectName) {
console.log('onRebuildProject');
ProjectActions.run(projectName)
},
onShowTerminal: function(build) {
this.setState({showTerminal: !this.state.showTerminal});
BuildActions.readTerminalOutput(this.props.build);
},
onBuildSelect: function(buildId) {
console.log('on build select');
},
render: template
});
return Component;
});