1
0
mirror of https://github.com/ascribe/onion.git synced 2024-12-23 01:39:36 +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, orderBy,
orderAsc, orderAsc,
filterBy, filterBy,
'pieceList': [], pieceList: [],
'pieceListCount': -1 pieceListCount: -1,
unfilteredPieceListCount: -1
}); });
// afterwards, we can load the list // afterwards, we can load the list
@ -42,8 +43,9 @@ class PieceListActions {
orderBy, orderBy,
orderAsc, orderAsc,
filterBy, filterBy,
'pieceList': res.pieces, pieceList: res.pieces,
'pieceListCount': res.count pieceListCount: res.count,
unfilteredPieceListCount: res.unfiltered_count
}); });
resolve(); resolve();
}) })

View File

@ -69,7 +69,7 @@ let PieceList = React.createClass({
}, },
componentDidUpdate() { 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 // FIXME: hack to redirect out of the dispatch cycle
window.setTimeout(() => this.transitionTo(this.props.redirectTo), 0); window.setTimeout(() => this.transitionTo(this.props.redirectTo), 0);
} }

View File

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