From: Bill Erickson <berickxx@gmail.com> Date: Tue, 3 Aug 2021 21:11:42 +0000 (-0400) Subject: LP1932358 Serialize patron bucket entry batch deletion X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=095997028bcbc39b2159894997ede497309416fd;p=Evergreen.git LP1932358 Serialize patron bucket entry batch deletion Avoid large sets of parallel patron bucket item delete calls by serialzing the calls so they go one at a time. Adds a progress meter to the display during delete. Signed-off-by: Bill Erickson <berickxx@gmail.com> Signed-off-by: Josh Stompro <stompro@stompro.org> Signed-off-by: Galen Charlton <gmc@equinoxOLI.org> --- diff --git a/Open-ILS/src/templates/staff/circ/patron/bucket/t_view.tt2 b/Open-ILS/src/templates/staff/circ/patron/bucket/t_view.tt2 index 37cdaee866..a5d6a9c1e5 100644 --- a/Open-ILS/src/templates/staff/circ/patron/bucket/t_view.tt2 +++ b/Open-ILS/src/templates/staff/circ/patron/bucket/t_view.tt2 @@ -1,3 +1,17 @@ +<!-- edit bucket dialog --> +<style> +progress { + text-align: center; + height: 25px; + width: 500px; + margin-bottom: 10px; +} +</style> + +<div ng-show='running'> + <progress max="{{progress.max}}" value="{{progress.count}}"></progress> +</div> + <eg-grid ng-hide="forbidden" features="allowAll,-display" diff --git a/Open-ILS/web/js/ui/default/staff/circ/patron/bucket/app.js b/Open-ILS/web/js/ui/default/staff/circ/patron/bucket/app.js index 2c3d3555e4..e183683a09 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/patron/bucket/app.js +++ b/Open-ILS/web/js/ui/default/staff/circ/patron/bucket/app.js @@ -789,19 +789,32 @@ function($scope, $q , $routeParams , $timeout , $window , $uibModal , bucketSvc } $scope.detachUsers = function(users) { - var promises = []; + var promise = $q.when(); + + $scope.running = true; + $scope.progress = { + count: 0, + max: users.length + }; + angular.forEach(users, function(rec) { var item = bucketSvc.currentBucket.items().filter( function(i) { return (i.target_user() == rec.id) } ); - if (item.length) - promises.push(bucketSvc.detachUser(item[0].id())); + if (item.length) { + promise = promise.then(function() { + return bucketSvc.detachUser(item[0].id()) + .then(function() { $scope.progress.count++; }); + }); + } }); bucketSvc.bucketNeedsRefresh = true; - return $q.all(promises).then(drawBucket); + return promise + .then(function() { $scope.running = false; }) + .then(drawBucket); } $scope.spawnUserEdit = function (users) {