nci/static/js/app/components/projects/view/index.js

52 lines
1.2 KiB
JavaScript
Raw Normal View History

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',
'app/components/common/scm/index',
'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,
projectStore, Builds, Scm, template, CommonComponents
2015-07-09 20:12:24 +00:00
) {
template = template.locals({
Builds: Builds,
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
});
});