2015-07-09 20:12:24 +00:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
define([
|
|
|
|
'react', 'reflux',
|
|
|
|
'app/actions/project',
|
|
|
|
'app/actions/build',
|
|
|
|
'app/stores/project',
|
|
|
|
'app/components/builds/list',
|
2015-07-11 15:15:18 +00:00
|
|
|
'app/components/common/scm/index',
|
2015-07-12 20:24:09 +00:00
|
|
|
'templates/app/components/projects/view/index',
|
2015-07-21 20:00:09 +00:00
|
|
|
'app/components/common/index',
|
|
|
|
'bootstrap/dropdown'
|
2015-07-09 20:12:24 +00:00
|
|
|
], function(React, Reflux, ProjectActions, BuildActions,
|
2015-07-12 20:24:09 +00:00
|
|
|
projectStore, Builds, Scm, template, CommonComponents
|
2015-07-09 20:12:24 +00:00
|
|
|
) {
|
|
|
|
template = template.locals({
|
2015-07-11 15:15:18 +00:00
|
|
|
Builds: Builds,
|
2015-07-12 20:24:09 +00:00
|
|
|
Scm: Scm,
|
|
|
|
DateTime: CommonComponents.DateTime
|
2015-07-09 20:12:24 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
return React.createClass({
|
|
|
|
mixins: [Reflux.ListenerMixin],
|
2015-07-11 18:31:23 +00:00
|
|
|
statics: {
|
|
|
|
willTransitionTo: function(transition, params, query) {
|
|
|
|
ProjectActions.read({name: params.name});
|
|
|
|
BuildActions.readAll({projectName: params.name});
|
|
|
|
}
|
|
|
|
},
|
2015-07-21 20:00:09 +00:00
|
|
|
onBuildProject: function() {
|
|
|
|
if (this.state.project.name) {
|
|
|
|
console.log(this.state.project.name);
|
|
|
|
ProjectActions.run(this.state.project.name);
|
|
|
|
}
|
|
|
|
},
|
2015-07-09 20:12:24 +00:00
|
|
|
componentDidMount: function() {
|
|
|
|
this.listenTo(projectStore, this.updateItem);
|
|
|
|
},
|
|
|
|
updateItem: function(project) {
|
|
|
|
this.setState({project: project});
|
|
|
|
},
|
|
|
|
getInitialState: function() {
|
|
|
|
return {
|
|
|
|
project: {}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
render: template,
|
|
|
|
});
|
|
|
|
});
|