From: Cesar Velez Date: Tue, 31 Oct 2017 18:53:09 +0000 (-0400) Subject: LP#1712854 - enable grid data caching for record holds view X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=996f8cb4050825588a926572f4440e8b0341c2ec;p=working%2FEvergreen.git LP#1712854 - enable grid data caching for record holds view Caching was explicitly disabled for record holds view grid, needed to be enabled for clientsort to work. IIRC there was a bug where the holds were duplicating but that's no longer an issue. Signed-off by: Cesar Velez --- diff --git a/Open-ILS/src/templates/staff/cat/catalog/t_holds.tt2 b/Open-ILS/src/templates/staff/cat/catalog/t_holds.tt2 index 00b686cd66..72858958f0 100644 --- a/Open-ILS/src/templates/staff/cat/catalog/t_holds.tt2 +++ b/Open-ILS/src/templates/staff/cat/catalog/t_holds.tt2 @@ -64,8 +64,8 @@ - {{item.patron_barcode}} - {{item.patron_alias}} + + 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 63b9c04659..cf4da3c536 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 @@ -1641,12 +1641,15 @@ function($scope , $routeParams , $location , $window , $q , egCore , egHolds , e $scope.grid_actions.refresh = function () { provider.refresh() }; $scope.hold_grid_controls = {}; - var hold_ids = []; // current list of holds + 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(hold_data) { + function(hold_data) { + holds.push(hold_data); return hold_data; } ); @@ -1655,8 +1658,11 @@ function($scope , $routeParams , $location , $window , $q , egCore , egHolds , e provider.get = function(offset, count) { if ($scope.record_tab != 'holds') return $q.when(); var deferred = $q.defer(); - hold_ids = []; // no caching ATM + // see if we can use cached results + if (holds[offset]){ + return provider.arrayNotifier(holds, offset, count); + } // open a determinate progress dialog, max value set below. egProgressDialog.open({max : 1, value : 0});