From 17b991e06b75f9c3621866816cd1cf09c542222b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Daubensch=C3=BCtz?= Date: Tue, 4 Aug 2015 11:48:12 +0200 Subject: [PATCH] adjust store calls to fetch list to new interface --- .../accordion_list_item.js | 6 ++++-- js/components/ascribe_detail/edition.js | 3 ++- js/components/ascribe_detail/piece.js | 9 ++++++--- .../piece_list_bulk_modal.js | 3 ++- js/components/piece_list.js | 16 +++++++++------- js/components/register_piece.js | 3 ++- 6 files changed, 25 insertions(+), 15 deletions(-) diff --git a/js/components/ascribe_accordion_list/accordion_list_item.js b/js/components/ascribe_accordion_list/accordion_list_item.js index 5c47d060..a561b4ed 100644 --- a/js/components/ascribe_accordion_list/accordion_list_item.js +++ b/js/components/ascribe_accordion_list/accordion_list_item.js @@ -87,14 +87,16 @@ let AccordionListItem = React.createClass({ }, handleSubmitPrizeSuccess(response) { - PieceListActions.fetchPieceList(this.state.page, this.state.pageSize, this.state.search, this.state.orderBy, this.state.orderAsc); + PieceListActions.fetchPieceList(this.state.page, this.state.pageSize, this.state.search, + this.state.orderBy, this.state.orderAsc, this.state.filterBy); let notification = new GlobalNotificationModel(response.notification, 'success', 10000); GlobalNotificationActions.appendGlobalNotification(notification); }, onPollingSuccess(pieceId) { - PieceListActions.fetchPieceList(this.state.page, this.state.pageSize, this.state.search, this.state.orderBy, this.state.orderAsc); + PieceListActions.fetchPieceList(this.state.page, this.state.pageSize, this.state.search, + this.state.orderBy, this.state.orderAsc, this.state.filterBy); EditionListActions.toggleEditionList(pieceId); let notification = new GlobalNotificationModel('Editions successfully created', 'success', 10000); diff --git a/js/components/ascribe_detail/edition.js b/js/components/ascribe_detail/edition.js index b19f93b3..25e8a97c 100644 --- a/js/components/ascribe_detail/edition.js +++ b/js/components/ascribe_detail/edition.js @@ -86,7 +86,8 @@ let Edition = React.createClass({ }, handleDeleteSuccess(response) { - PieceListActions.fetchPieceList(this.state.page, this.state.pageSize, this.state.search, this.state.orderBy, this.state.orderAsc); + PieceListActions.fetchPieceList(this.state.page, this.state.pageSize, this.state.search, + this.state.orderBy, this.state.orderAsc, this.state.filterBy); EditionListActions.refreshEditionList(this.props.edition.parent); EditionListActions.closeAllEditionLists(); diff --git a/js/components/ascribe_detail/piece.js b/js/components/ascribe_detail/piece.js index 7dff529f..3fabb055 100644 --- a/js/components/ascribe_detail/piece.js +++ b/js/components/ascribe_detail/piece.js @@ -79,12 +79,14 @@ let Piece = React.createClass({ handleEditionCreationSuccess() { PieceActions.updateProperty({key: 'num_editions', value: 0}); - PieceListActions.fetchPieceList(this.state.page, this.state.pageSize, this.state.search, this.state.orderBy, this.state.orderAsc); + PieceListActions.fetchPieceList(this.state.page, this.state.pageSize, this.state.search, + this.state.orderBy, this.state.orderAsc, this.state.filterBy); this.toggleCreateEditionsDialog(); }, handleDeleteSuccess(response) { - PieceListActions.fetchPieceList(this.state.page, this.state.pageSize, this.state.search, this.state.orderBy, this.state.orderAsc); + PieceListActions.fetchPieceList(this.state.page, this.state.pageSize, this.state.search, + this.state.orderBy, this.state.orderAsc, this.state.filterBy); // since we're deleting a piece, we just need to close // all editions dialogs and not reload them @@ -124,7 +126,8 @@ let Piece = React.createClass({ // btw.: It's not sufficient to just set num_editions to numEditions, since a single accordion // list item also uses the firstEdition property which we can only get from the server in that case. // Therefore we need to at least refetch the changed piece from the server or on our case simply all - PieceListActions.fetchPieceList(this.state.page, this.state.pageSize, this.state.search, this.state.orderBy, this.state.orderAsc); + PieceListActions.fetchPieceList(this.state.page, this.state.pageSize, this.state.search, + this.state.orderBy, this.state.orderAsc, this.state.filterBy); let notification = new GlobalNotificationModel('Editions successfully created', 'success', 10000); GlobalNotificationActions.appendGlobalNotification(notification); diff --git a/js/components/ascribe_piece_list_bulk_modal/piece_list_bulk_modal.js b/js/components/ascribe_piece_list_bulk_modal/piece_list_bulk_modal.js index 36a4c53d..3642a667 100644 --- a/js/components/ascribe_piece_list_bulk_modal/piece_list_bulk_modal.js +++ b/js/components/ascribe_piece_list_bulk_modal/piece_list_bulk_modal.js @@ -76,7 +76,8 @@ let PieceListBulkModal = React.createClass({ }, handleSuccess() { - PieceListActions.fetchPieceList(this.state.page, this.state.pageSize, this.state.search, this.state.orderBy, this.state.orderAsc); + PieceListActions.fetchPieceList(this.state.page, this.state.pageSize, this.state.search, + this.state.orderBy, this.state.orderAsc, this.state.filterBy); this.fetchSelectedPieceEditionList() .forEach((pieceId) => { diff --git a/js/components/piece_list.js b/js/components/piece_list.js index 711f53ea..c3bb284a 100644 --- a/js/components/piece_list.js +++ b/js/components/piece_list.js @@ -34,7 +34,8 @@ let PieceList = React.createClass({ let page = this.getQuery().page || 1; PieceListStore.listen(this.onChange); if (this.state.pieceList.length === 0){ - PieceListActions.fetchPieceList(page, this.state.pageSize, this.state.search, this.state.orderBy, this.state.orderAsc) + PieceListActions.fetchPieceList(page, this.state.pageSize, this.state.search, + this.state.orderBy, this.state.orderAsc, this.state.filterBy) .then(PieceListActions.fetchPieceRequestActions()); } }, @@ -59,9 +60,9 @@ let PieceList = React.createClass({ // the site should go to the top document.body.scrollTop = document.documentElement.scrollTop = 0; - return () => PieceListActions.fetchPieceList(page, this.state.pageSize, - this.state.search, this.state.orderBy, - this.state.orderAsc); + return () => PieceListActions.fetchPieceList(page, this.state.pageSize, this.state.search, + this.state.orderBy, this.state.orderAsc, + this.state.filterBy); }, getPagination() { @@ -79,13 +80,14 @@ let PieceList = React.createClass({ }, searchFor(searchTerm) { - PieceListActions.fetchPieceList(1, this.state.pageSize, searchTerm, this.state.orderBy, this.state.orderAsc); + PieceListActions.fetchPieceList(1, this.state.pageSize, searchTerm, this.state.orderBy, + this.state.orderAsc, this.state.filterBy); this.transitionTo(this.getPathname(), {page: 1}); }, accordionChangeOrder(orderBy, orderAsc) { - PieceListActions.fetchPieceList(this.state.page, this.state.pageSize, - this.state.search, orderBy, orderAsc); + PieceListActions.fetchPieceList(this.state.page, this.state.pageSize, this.state.search, + orderBy, orderAsc, this.state.filterBy); }, render() { diff --git a/js/components/register_piece.js b/js/components/register_piece.js index 20826b7d..71dc7bc1 100644 --- a/js/components/register_piece.js +++ b/js/components/register_piece.js @@ -101,7 +101,8 @@ let RegisterPiece = React.createClass( { this.state.pageSize, this.state.searchTerm, this.state.orderBy, - this.state.orderAsc + this.state.orderAsc, + this.state.filterBy ); this.transitionTo('piece', {pieceId: response.piece.id});