From 1110f323e1f878d2bfd7279f964987be37c38dda Mon Sep 17 00:00:00 2001 From: Victoria Lewis Date: Mon, 6 Feb 2017 12:12:56 -0800 Subject: [PATCH] LP#1522638 Record holds tab gets modal progress bar When loading "View Holds" for a bib record progress bar modal appears while user waits for titles to display. Signed-off-by: Victoria Lewis Signed-off-by: Bill Erickson Signed-off-by: Terran McCanna Signed-off-by: Kathy Lussier --- .../templates/staff/share/t_progress_bar.tt2 | 15 ++++++++++ .../js/ui/default/staff/cat/catalog/app.js | 14 ++++++---- .../web/js/ui/default/staff/services/ui.js | 28 +++++++++++++++++++ 3 files changed, 52 insertions(+), 5 deletions(-) create mode 100644 Open-ILS/src/templates/staff/share/t_progress_bar.tt2 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 index 0000000000..6e4df97b54 --- /dev/null +++ b/Open-ILS/src/templates/staff/share/t_progress_bar.tt2 @@ -0,0 +1,15 @@ + +
+ + +
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 3ab19cc4bf..4fadbb4e53 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 @@ -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; } } diff --git a/Open-ILS/web/js/ui/default/staff/services/ui.js b/Open-ILS/web/js/ui/default/staff/services/ui.js index e4e457988e..19e80a3937 100644 --- a/Open-ILS/web/js/ui/default/staff/services/ui.js +++ b/Open-ILS/web/js/ui/default/staff/services/ui.js @@ -79,6 +79,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') }); -- 2.43.2