1
0
mirror of https://github.com/ascribe/onion.git synced 2024-12-22 17:33:14 +01:00

integrate unfilteredPieceListCount into piece list store and list

This commit is contained in:
Tim Daubenschütz 2015-08-31 16:57:16 +02:00
parent 02ed21fef5
commit 55948bc9ba
3 changed files with 10 additions and 6 deletions

View File

@ -25,8 +25,9 @@ class PieceListActions {
orderBy,
orderAsc,
filterBy,
'pieceList': [],
'pieceListCount': -1
pieceList: [],
pieceListCount: -1,
unfilteredPieceListCount: -1
});
// afterwards, we can load the list
@ -42,8 +43,9 @@ class PieceListActions {
orderBy,
orderAsc,
filterBy,
'pieceList': res.pieces,
'pieceListCount': res.count
pieceList: res.pieces,
pieceListCount: res.count,
unfilteredPieceListCount: res.unfiltered_count
});
resolve();
})

View File

@ -69,7 +69,7 @@ let PieceList = React.createClass({
},
componentDidUpdate() {
if (this.props.redirectTo && this.state.pieceListCount === 0) {
if (this.props.redirectTo && this.state.unfilteredPieceListCount === 0) {
// FIXME: hack to redirect out of the dispatch cycle
window.setTimeout(() => this.transitionTo(this.props.redirectTo), 0);
}

View File

@ -21,6 +21,7 @@ class PieceListStore {
this.pieceList = [];
// -1 specifies that the store is currently loading
this.pieceListCount = -1;
this.unfilteredPieceListCount = -1;
this.page = 1;
this.pageSize = 10;
this.search = '';
@ -30,13 +31,14 @@ class PieceListStore {
this.bindActions(PieceListActions);
}
onUpdatePieceList({ page, pageSize, search, pieceList, orderBy, orderAsc, pieceListCount, filterBy }) {
onUpdatePieceList({ page, pageSize, search, pieceList, orderBy, orderAsc, pieceListCount, unfilteredPieceListCount, filterBy }) {
this.page = page;
this.pageSize = pageSize;
this.search = search;
this.orderAsc = orderAsc;
this.orderBy = orderBy;
this.pieceListCount = pieceListCount;
this.unfilteredPieceListCount = unfilteredPieceListCount;
this.filterBy = filterBy;
/**