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,
|
2015-08-26 17:47:11 +00:00
|
|
|
DateTime: CommonComponents.DateTime,
|
|
|
|
Duration: CommonComponents.Duration
|
2015-07-09 20:12:24 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
return React.createClass({
|
2015-09-27 23:58:02 +00:00
|
|
|
mixins: [
|
|
|
|
Reflux.connectFilter(projectStore, 'project', function(project) {
|
|
|
|
if (project.name === this.props.params.name) {
|
|
|
|
return project;
|
|
|
|
} else {
|
|
|
|
if (this.state) {
|
|
|
|
return this.state.project;
|
|
|
|
} else {
|
|
|
|
return projectStore.getInitialState();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
],
|
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-09-27 20:47:50 +00:00
|
|
|
render: template
|
2015-07-09 20:12:24 +00:00
|
|
|
});
|
|
|
|
});
|