From: Mike Rylander Date: Mon, 4 Dec 2017 15:06:08 +0000 (-0500) Subject: LP#1712854: Fetch all hold data for clientsort support X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=ab46373765d8544b9ee4d8799dd151d29c5c3dc4;p=working%2FEvergreen.git LP#1712854: Fetch all hold data for clientsort support In order for the clientsort feature to work, we must fetch all the data up front. So, we do that for the Record / View Holds and the Hold Shelf interfaces. The Hold Shelf also gets a progress dialog, as the dataset may be large. Signed-off-by: Mike Rylander --- diff --git a/Open-ILS/web/js/ui/default/staff/cat/catalog/app.js b/Open-ILS/web/js/ui/default/staff/cat/catalog/app.js index cf4da3c536..8c94f5b90b 100644 --- a/Open-ILS/web/js/ui/default/staff/cat/catalog/app.js +++ b/Open-ILS/web/js/ui/default/staff/cat/catalog/app.js @@ -1644,10 +1644,8 @@ function($scope , $routeParams , $location , $window , $q , egCore , egHolds , e var holds = []; // actual hold objs for caching var hold_ids = []; // current list of hold ids - function fetchHolds(offset, count) { - var ids = hold_ids.slice(offset, offset + count); - - return egHolds.fetch_holds(ids).then(null, null, + function fetchHolds() { + return egHolds.fetch_holds(hold_ids).then(null, null, function(hold_data) { holds.push(hold_data); return hold_data; @@ -1687,11 +1685,10 @@ function($scope , $routeParams , $location , $window , $q , egCore , egHolds , e // the total number of holds to fetch or the page size // of the grid. egProgressDialog.update( - {max : Math.min(hold_ids.length, count)}); + {max : hold_ids.length}); var holds_fetched = 0; - fetchHolds(offset, count) - .then(deferred.resolve, null, + fetchHolds().then(deferred.resolve, null, function(hold_data) { holds_fetched++; deferred.notify(hold_data); diff --git a/Open-ILS/web/js/ui/default/staff/circ/holds/app.js b/Open-ILS/web/js/ui/default/staff/circ/holds/app.js index 00389fe947..75e6e6a335 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/holds/app.js +++ b/Open-ILS/web/js/ui/default/staff/circ/holds/app.js @@ -37,8 +37,8 @@ angular.module('egHoldsApp', .controller('HoldsShelfCtrl', - ['$scope','$q','$routeParams','$window','$location','egCore','egHolds','egHoldGridActions','egCirc','egGridDataProvider', -function($scope , $q , $routeParams , $window , $location , egCore , egHolds , egHoldGridActions , egCirc , egGridDataProvider) { + ['$scope','$q','$routeParams','$window','$location','egCore','egHolds','egHoldGridActions','egCirc','egGridDataProvider','egProgressDialog', +function($scope , $q , $routeParams , $window , $location , egCore , egHolds , egHoldGridActions , egCirc , egGridDataProvider , egProgressDialog) { $scope.detail_hold_id = $routeParams.hold_id; var hold_ids = []; @@ -47,9 +47,8 @@ function($scope , $q , $routeParams , $window , $location , egCore , egHolds , e $scope.gridControls = {}; $scope.grid_actions = egHoldGridActions; - function fetch_holds(offset, count) { - var ids = hold_ids.slice(offset, offset + count); - return egHolds.fetch_holds(ids).then(null, null, + function fetch_holds() { + return egHolds.fetch_holds(hold_ids).then(null, null, function(hold_data) { holds.push(hold_data); return hold_data; // to the grid @@ -84,6 +83,7 @@ function($scope , $q , $routeParams , $window , $location , egCore , egHolds , e hold_ids = []; holds = []; + egProgressDialog.open({max : 1, value : 0}); var method = 'open-ils.circ.captured_holds.id_list.on_shelf.retrieve.authoritative.atomic'; if (clear_mode) method = 'open-ils.circ.captured_holds.id_list.expired_on_shelf_or_wrong_shelf.retrieve.atomic'; @@ -99,8 +99,15 @@ function($scope , $q , $routeParams , $window , $location , egCore , egHolds , e } hold_ids = ids; - fetch_holds(offset, count) - .then(deferred.resolve, null, deferred.notify); + egProgressDialog.update( + {max : hold_ids.length}); + + fetch_holds().then(deferred.resolve, null, + function(hold_data) { + deferred.notify(hold_data); + egProgressDialog.increment(); + } + )['finally'](egProgressDialog.close); }); return deferred.promise;