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

42 lines
1023 B
JavaScript
Raw Normal View History

2015-05-07 21:55:40 +00:00
'use strict';
define([
2015-05-17 13:48:16 +00:00
'react', 'react-router', 'app/actions/project',
2015-05-09 21:47:01 +00:00
'app/actions/build', 'templates/app/components/builds/item',
2015-05-10 16:53:33 +00:00
'app/components/terminal/terminal',
2015-05-09 21:36:17 +00:00
'app/components/common/index'
2015-05-10 16:53:33 +00:00
], function(
2015-05-17 13:48:16 +00:00
React, Router, ProjectActions, BuildActions, template,
2015-05-10 16:53:33 +00:00
TerminalComponent, CommonComponents
) {
2015-05-09 21:36:17 +00:00
template = template.locals({
2015-05-10 16:53:33 +00:00
DateTime: CommonComponents.DateTime,
2015-07-21 20:00:09 +00:00
Duration: CommonComponents.Duration,
Scm: CommonComponents.Scm,
2015-05-17 13:48:16 +00:00
Terminal: TerminalComponent,
Link: Router.Link
2015-05-09 21:36:17 +00:00
});
2015-05-07 21:55:40 +00:00
var Component = React.createClass({
2015-05-10 16:53:33 +00:00
getInitialState: function() {
return {
showTerminal: false
};
},
2015-05-09 21:47:01 +00:00
onRebuildProject: function(projectName) {
2015-07-21 20:00:09 +00:00
console.log('onRebuildProject');
2015-05-09 21:47:01 +00:00
ProjectActions.run(projectName)
},
2015-05-10 16:53:33 +00:00
onShowTerminal: function(build) {
this.setState({showTerminal: !this.state.showTerminal});
2015-05-14 20:37:44 +00:00
BuildActions.readTerminalOutput(this.props.build);
2015-05-10 16:53:33 +00:00
},
2015-05-07 21:55:40 +00:00
onBuildSelect: function(buildId) {
console.log('on build select');
},
2015-05-09 21:36:17 +00:00
render: template
2015-05-07 21:55:40 +00:00
});
return Component;
});