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

38 lines
838 B
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',
2015-07-09 20:12:24 +00:00
'templates/app/components/projects/view/index'
], function(React, Reflux, ProjectActions, BuildActions,
projectStore, Builds, Scm, template
2015-07-09 20:12:24 +00:00
) {
template = template.locals({
Builds: Builds,
Scm: Scm
2015-07-09 20:12:24 +00:00
});
return React.createClass({
mixins: [Reflux.ListenerMixin],
componentDidMount: function() {
ProjectActions.read({name: this.props.params.name});
BuildActions.readAll({projectName: this.props.params.name});
this.listenTo(projectStore, this.updateItem);
},
updateItem: function(project) {
this.setState({project: project});
},
getInitialState: function() {
return {
project: {}
}
},
render: template,
});
});