LP#1522638 Record holds tab gets modal progress bar
authorVictoria Lewis <vlewis@catalystdevworks.com>
Mon, 6 Feb 2017 20:12:56 +0000 (12:12 -0800)
committerKathy Lussier <klussier@masslnc.org>
Mon, 6 Mar 2017 18:46:41 +0000 (13:46 -0500)
When loading "View Holds" for a bib record
progress bar modal appears while user waits for titles to display.

Signed-off-by: Victoria Lewis <vlewis@catalystdevworks.com>
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Terran McCanna <tmccanna@georgialibraries.org>
Signed-off-by: Kathy Lussier <klussier@masslnc.org>
Open-ILS/src/templates/staff/share/t_progress_bar.tt2 [new file with mode: 0644]
Open-ILS/web/js/ui/default/staff/cat/catalog/app.js
Open-ILS/web/js/ui/default/staff/services/ui.js

diff --git a/Open-ILS/src/templates/staff/share/t_progress_bar.tt2 b/Open-ILS/src/templates/staff/share/t_progress_bar.tt2
new file mode 100644 (file)
index 0000000..6e4df97
--- /dev/null
@@ -0,0 +1,15 @@
+<!--
+  Generic progress bar.
+
+-->
+<div>
+  <div class="modal-header">
+  </div>
+  <div class="modal-body">
+    <div class="progress progress-striped active">
+      <div class="progress-bar" role="progressbar" aria-valuenow="100"
+        aria-valuemin="0" aria-valuemax="100" style="width: 100%">
+      </div>
+    </div>
+  </div>
+</div>
index 3ab19cc..4fadbb4 100644 (file)
@@ -243,13 +243,12 @@ function($scope , $routeParams , $location , $window , $q , egCore) {
     
 
 }])
-
 .controller('CatalogCtrl',
        ['$scope','$routeParams','$location','$window','$q','egCore','egHolds','egCirc','egConfirmDialog','ngToast',
-        'egGridDataProvider','egHoldGridActions','$timeout','$uibModal','holdingsSvc','egUser','conjoinedSvc',
+        'egGridDataProvider','egHoldGridActions','egProgressModal','$timeout','$uibModal','holdingsSvc','egUser','conjoinedSvc',
         '$cookies',
 function($scope , $routeParams , $location , $window , $q , egCore , egHolds , egCirc , egConfirmDialog , ngToast ,
-         egGridDataProvider , egHoldGridActions , $timeout , $uibModal , holdingsSvc , egUser , conjoinedSvc,
+         egGridDataProvider , egHoldGridActions ,egProgressModal, $timeout , $uibModal , holdingsSvc , egUser , conjoinedSvc,
          $cookies
 ) {
 
@@ -1353,6 +1352,7 @@ function($scope , $routeParams , $location , $window , $q , egCore , egHolds , e
     var hold_ids = []; // current list of holds
     function fetchHolds(offset, count) {
         var ids = hold_ids.slice(offset, offset + count);
+
         return egHolds.fetch_holds(ids).then(null, null,
             function(hold_data) { 
                 return hold_data;
@@ -1364,7 +1364,6 @@ function($scope , $routeParams , $location , $window , $q , egCore , egHolds , e
         if ($scope.record_tab != 'holds') return $q.when();
         var deferred = $q.defer();
         hold_ids = []; // no caching ATM
-
         // fetch the IDs
         egCore.net.request(
             'open-ils.circ',
@@ -1373,11 +1372,15 @@ function($scope , $routeParams , $location , $window , $q , egCore , egHolds , e
             {pickup_lib : egCore.org.descendants($scope.pickup_ou.id(), true)}
         ).then(
             function(hold_data) {
+                if(hold_data.title_holds.length){
+                    egProgressModal.open().result;};
                 angular.forEach(hold_data, function(list, type) {
                     hold_ids = hold_ids.concat(list);
                 });
                 fetchHolds(offset, count).then(
-                    deferred.resolve, null, deferred.notify);
+                    deferred.resolve, null, deferred.notify).then(function(){
+                    egProgressModal.close();
+                    });
             }
         );
 
@@ -1504,6 +1507,7 @@ function($scope , $routeParams , $location , $window , $q , egCore , egHolds , e
                 $scope.detail_hold_record_id = $scope.record_id; 
                 // refresh the holds grid
                 provider.refresh();
+
                 break;
         }
     }
index e4e4579..19e80a3 100644 (file)
@@ -80,6 +80,34 @@ function($timeout , $parse) {
 
 
 /**
+ * egProgressModal.open();
+ */
+.factory('egProgressModal', 
+
+        ['$uibModal','$interpolate',
+function($uibModal, $interpolate){
+    var service = {};
+
+    service.open = function() {
+        return $uibModal.open({
+            templateUrl: './share/t_progress_bar',
+            controller: ['$scope', '$uibModalInstance',
+                function($scope, $uibModalInstance) {
+                  service.currentInstance = $uibModalInstance;
+                }
+            ]
+        });
+    };
+    service.close = function() {
+        if (service.currentInstance) {
+            service.currentInstance.close();
+            delete service.currentInstance;
+        }
+    }
+    return service;
+}])
+
+/**
  * egAlertDialog.open({message : 'hello {{name}}'}).result.then(
  *     function() { console.log('alert closed') });
  */