nci/static/js/app/components/builds/list.js

40 lines
828 B
JavaScript
Raw Normal View History

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',
2015-12-17 20:22:14 +00:00
'app/actions/build',
2015-05-07 21:55:40 +00:00
'app/stores/builds',
'templates/app/components/builds/list'
2015-12-17 20:22:14 +00:00
], function(React, Reflux, _, Item, BuildActions, 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 && item.project.name === projectName;
2015-09-27 23:58:02 +00:00
});
} else {
return items;
}
})
],
2015-12-17 20:22:14 +00:00
onShowMoreBuilds: function(projectName) {
BuildActions.readAll({
projectName: projectName,
limit: this.state.items.length + 20
});
},
2015-09-27 20:47:50 +00:00
render: template
2015-05-07 21:55:40 +00:00
});
return Component;
});