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;
// 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);
.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 = [];
$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
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';
}
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;