2015-05-07 21:55:40 +00:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
define([
|
|
|
|
'react',
|
|
|
|
'reflux',
|
2015-09-27 20:47:50 +00:00
|
|
|
'underscore',
|
2015-05-07 21:55:40 +00:00
|
|
|
'./item',
|
|
|
|
'app/stores/builds',
|
|
|
|
'templates/app/components/builds/list'
|
2015-09-27 20:47:50 +00:00
|
|
|
], function(React, Reflux, _, Item, buildsStore, template) {
|
2015-07-09 20:12:24 +00:00
|
|
|
template = template.locals({
|
|
|
|
Item: Item
|
|
|
|
});
|
|
|
|
|
2015-05-07 21:55:40 +00:00
|
|
|
var Component = React.createClass({
|
2015-09-27 23:58:02 +00:00
|
|
|
mixins: [
|
|
|
|
Reflux.connectFilter(buildsStore, 'items', function(items) {
|
|
|
|
var projectName = this.props.projectName;
|
|
|
|
if (projectName) {
|
|
|
|
return _(items).filter(function(item) {
|
|
|
|
return item.project.name === projectName;
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
return items;
|
|
|
|
}
|
|
|
|
})
|
|
|
|
],
|
2015-09-27 20:47:50 +00:00
|
|
|
render: template
|
2015-05-07 21:55:40 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
return Component;
|
|
|
|
});
|