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

43 lines
988 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',
'templates/app/components/projects/view/index',
'app/components/common/index'
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,
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-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,
});
});