LP#1642378 Webstaff negative balance UI progress dialog user/berick/lp1642378-neg-balance-load-fail-progress
authorBill Erickson <berickxx@gmail.com>
Fri, 3 Mar 2017 16:42:44 +0000 (11:42 -0500)
committerBill Erickson <berickxx@gmail.com>
Fri, 3 Mar 2017 16:42:46 +0000 (11:42 -0500)
Display a progress dialog while loading the Patrons With Negative
Balances UI.  Dialog starts indeterminate, morphing into
semi-determinate as patron data streams in.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/web/js/ui/default/staff/admin/local/circ/neg_balance_users.js

index 0428d09..b72fd51 100644 (file)
@@ -3,14 +3,17 @@ angular.module('egAdminCirc',
     ['ngRoute','ui.bootstrap','egCoreMod','egUiMod','egGridMod'])
 
 .controller('NegBalances',
-       ['$scope','$q','$timeout','$location','$window','egCore','egGridDataProvider',
-function($scope , $q , $timeout , $location , $window , egCore , egGridDataProvider) {
+       ['$scope','$q','$timeout','$location','$window','egCore',
+        'egGridDataProvider','egProgressDialog',
+function($scope , $q , $timeout , $location , $window , egCore , 
+         egGridDataProvider , egProgressDialog) {
 
     $scope.grid_provider = egGridDataProvider.instance({});
 
     // API does not currenlty support paging, so it's all or none.
     $scope.grid_provider.get = function(offset, count) {
         if (!$scope.context_org) return $q.when();
+        egProgressDialog.open();
 
         var deferred = $q.defer();
 
@@ -18,7 +21,10 @@ function($scope , $q , $timeout , $location , $window , egCore , egGridDataProvi
             'open-ils.actor',
             'open-ils.actor.users.negative_balance',
             egCore.auth.token(), $scope.context_org.id())
-        .then(deferred.resolve, null, deferred.notify);
+        .then(deferred.resolve, null, function(usr) {
+            egProgressDialog.increment();
+            deferred.notify(usr);
+        }).finally(egProgressDialog.close);
 
         return deferred.promise;
     }