[open-ils-commits] [GIT] Evergreen ILS branch master updated. 8d12a5adbfcb7a7be1bdf8bde714ec383b5caa83

Evergreen Git git at git.evergreen-ils.org
Mon Mar 6 13:48:41 EST 2017


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, master has been updated
       via  8d12a5adbfcb7a7be1bdf8bde714ec383b5caa83 (commit)
       via  c96d529a4ead10cade5bc3cde36e59fe50151835 (commit)
       via  7b3a1ca1187bc8caa752580066c791eb0c5661b0 (commit)
       via  1110f323e1f878d2bfd7279f964987be37c38dda (commit)
      from  46c929f6a4884e91eb0d038dde247fc8af12689c (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 8d12a5adbfcb7a7be1bdf8bde714ec383b5caa83
Author: Bill Erickson <berickxx at gmail.com>
Date:   Fri Feb 24 12:12:21 2017 -0500

    LP#1522638 Patron search uses progress modal
    
    Use the progress modal dialog in the web staff patron search UI for
    consistency / code re-use.
    
    Signed-off-by: Bill Erickson <berickxx at gmail.com>
    Signed-off-by: Terran McCanna <tmccanna at georgialibraries.org>
    Signed-off-by: Kathy Lussier <klussier at masslnc.org>

diff --git a/Open-ILS/src/templates/staff/circ/patron/t_search_results.tt2 b/Open-ILS/src/templates/staff/circ/patron/t_search_results.tt2
index a5a58af..cec4dd7 100644
--- a/Open-ILS/src/templates/staff/circ/patron/t_search_results.tt2
+++ b/Open-ILS/src/templates/staff/circ/patron/t_search_results.tt2
@@ -1,19 +1,6 @@
 
-<!-- patron search progress bar -->
-<div class="row" ng-show="show_search_progress">
-  <div class="col-md-6">
-    <div class="progress progress-striped active">
-      <div class="progress-bar" role="progressbar" aria-valuenow="100"
-        aria-valuemin="0" aria-valuemax="100" style="width: 100%">
-        <span class="sr-only">[% l('Loading...') %]</span>
-      </div>
-    </div>
-  </div>
-</div>
-
 <!-- patron search results grid -->
 <eg-grid
-  ng-hide="show_search_progress"
   idl-class="au" id-field="id"
   features="-sort,-display,-multisort"
   main-label="[% l('Patron Search Results') %]"
diff --git a/Open-ILS/web/js/ui/default/staff/circ/patron/app.js b/Open-ILS/web/js/ui/default/staff/circ/patron/app.js
index c00d5a5..8a8e326 100644
--- a/Open-ILS/web/js/ui/default/staff/circ/patron/app.js
+++ b/Open-ILS/web/js/ui/default/staff/circ/patron/app.js
@@ -816,10 +816,10 @@ function($scope , $location , egCore , egConfirmDialog , egUser , patronSvc) {
 .controller('PatronSearchCtrl',
        ['$scope','$q','$routeParams','$timeout','$window','$location','egCore',
        '$filter','egUser', 'patronSvc','egGridDataProvider','$document',
-       'egPatronMerge',
+       'egPatronMerge','egProgressDialog',
 function($scope,  $q,  $routeParams,  $timeout,  $window,  $location,  egCore,
         $filter,  egUser,  patronSvc , egGridDataProvider , $document,
-        egPatronMerge) {
+        egPatronMerge , egProgressDialog) {
 
     $scope.initTab('search');
     $scope.focusMe = true;
@@ -980,8 +980,13 @@ function($scope,  $q,  $routeParams,  $timeout,  $window,  $location,  egCore,
             return deferred.promise;
         }
 
-        // Dispay the search progress bar to indicate a search is in progress
-        $scope.show_search_progress = true;
+        if (!Object.keys(fullSearch.search).length) {
+            // Empty searches are rejected by the server.  Avoid 
+            // running the the empty search that runs on page load. 
+            return $q.when();
+        }
+
+        egProgressDialog.open(); // Indeterminate
 
         patronSvc.patrons = [];
         egCore.net.request(
@@ -998,19 +1003,17 @@ function($scope,  $q,  $routeParams,  $timeout,  $window,  $location,  egCore,
 
         ).then(
             function() {
-                // hide progress bar on 0-hits searches
-                $scope.show_search_progress = false;
                 deferred.resolve();
             },
             null, // onerror
             function(user) {
                 // hide progress bar as soon as the first result appears.
-                $scope.show_search_progress = false;
+                egProgressDialog.close();
                 patronSvc.localFlesh(user); // inline
                 patronSvc.patrons.push(user);
                 deferred.notify(user);
             }
-        );
+        )['finally'](egProgressDialog.close); // close on 0-hits or error
 
         return deferred.promise;
     };

commit c96d529a4ead10cade5bc3cde36e59fe50151835
Author: Bill Erickson <berickxx at gmail.com>
Date:   Fri Mar 3 10:34:26 2017 -0500

    LP#1522638 Bib holds egProgressDialog API updates
    
    1. Use the new egProgressDialog name and the new increment() function.
    2. Open the dialog before data retrieval starts to better indicate work
       is happening.
    3. Close the dialog in promise.finally() to ensure it always closes.
    
    Signed-off-by: Bill Erickson <berickxx at gmail.com>
    Signed-off-by: Terran McCanna <tmccanna at georgialibraries.org>
    Signed-off-by: Kathy Lussier <klussier at masslnc.org>

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 4fadbb4..54f6396 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
@@ -245,10 +245,10 @@ function($scope , $routeParams , $location , $window , $q , egCore) {
 }])
 .controller('CatalogCtrl',
        ['$scope','$routeParams','$location','$window','$q','egCore','egHolds','egCirc','egConfirmDialog','ngToast',
-        'egGridDataProvider','egHoldGridActions','egProgressModal','$timeout','$uibModal','holdingsSvc','egUser','conjoinedSvc',
+        'egGridDataProvider','egHoldGridActions','egProgressDialog','$timeout','$uibModal','holdingsSvc','egUser','conjoinedSvc',
         '$cookies',
 function($scope , $routeParams , $location , $window , $q , egCore , egHolds , egCirc , egConfirmDialog , ngToast ,
-         egGridDataProvider , egHoldGridActions ,egProgressModal, $timeout , $uibModal , holdingsSvc , egUser , conjoinedSvc,
+         egGridDataProvider , egHoldGridActions , egProgressDialog , $timeout , $uibModal , holdingsSvc , egUser , conjoinedSvc,
          $cookies
 ) {
 
@@ -1364,6 +1364,10 @@ 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
+
+        // open a determinate progress dialog, max value set below.
+        egProgressDialog.open({max : 1, value : 0});
+
         // fetch the IDs
         egCore.net.request(
             'open-ils.circ',
@@ -1372,15 +1376,25 @@ 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).then(function(){
-                    egProgressModal.close();
-                    });
+
+                // Set the max value of the progress bar to the lesser of
+                // the total number of holds to fetch or the page size
+                // of the grid.
+                egProgressDialog.update(
+                    {max : Math.min(hold_ids.length, count)});
+
+                var holds_fetched = 0;
+                fetchHolds(offset, count)
+                .then(deferred.resolve, null, 
+                    function(hold_data) {
+                        holds_fetched++;
+                        deferred.notify(hold_data);
+                        egProgressDialog.increment();
+                    }
+                )['finally'](egProgressDialog.close);
             }
         );
 

commit 7b3a1ca1187bc8caa752580066c791eb0c5661b0
Author: Bill Erickson <berickxx at gmail.com>
Date:   Fri Mar 3 10:34:20 2017 -0500

    LP#1522638 egProgressDialog features and docs
    
    Use an HTML5 <progress/> element as the progress bar instead of the
    Bootstrap progress CSS class.  The HTML5 element provides a more
    accurate display.
    
    Add support for 3 modes of operation:
    
    * determinate - shows dialog and percentage progress
    * semi-determinate - shows a value-less <progress/> but also displays
      the current value to indicate work happening.
    * indeterminate - shows a value-less <progress/> with no specificat
      indication of forward momentum.
    
    Adds a bunch of docs.
    
    Rename egProgressModal to egProgressDialog for consistency with other
    eg*Dialog's (which are also modal).
    
    Signed-off-by: Bill Erickson <berickxx at gmail.com>
    Signed-off-by: Terran McCanna <tmccanna at georgialibraries.org>
    Signed-off-by: Kathy Lussier <klussier at masslnc.org>

diff --git a/Open-ILS/src/templates/staff/css/style.css.tt2 b/Open-ILS/src/templates/staff/css/style.css.tt2
index f30ccaa..bdfd64d 100644
--- a/Open-ILS/src/templates/staff/css/style.css.tt2
+++ b/Open-ILS/src/templates/staff/css/style.css.tt2
@@ -473,6 +473,11 @@ table.list tr.selected td { /* deprecated? */
     }
 }
 
+.eg-modal-progress progress {
+  width: 100%;
+  height: 25px;
+}
+
 [%# 
 vim: ft=css 
 %]
diff --git a/Open-ILS/src/templates/staff/share/t_progress_bar.tt2 b/Open-ILS/src/templates/staff/share/t_progress_bar.tt2
deleted file mode 100644
index 6e4df97..0000000
--- a/Open-ILS/src/templates/staff/share/t_progress_bar.tt2
+++ /dev/null
@@ -1,15 +0,0 @@
-<!--
-  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>
diff --git a/Open-ILS/src/templates/staff/share/t_progress_dialog.tt2 b/Open-ILS/src/templates/staff/share/t_progress_dialog.tt2
new file mode 100644
index 0000000..2df60d2
--- /dev/null
+++ b/Open-ILS/src/templates/staff/share/t_progress_dialog.tt2
@@ -0,0 +1,30 @@
+<!--
+  Generic progress bar wrapped in a modal dialog.
+-->
+
+<div>
+  <div class="modal-header"></div>
+  <div class="modal-body">
+    <div class="row eg-modal-progress">
+
+      <div ng-if="data.hasvalue() && data.hasmax()">
+        <!-- determinate progress bar.  shows max/value progress -->
+        <div class="col-md-10">
+          <progress max="{{data.max}}" value="{{data.value}}"></progress>
+        </div>
+        <div class="col-md-2">{{data.percent()}}%</div>
+      </div>
+
+      <div ng-if="data.hasvalue() && !data.hasmax()">
+        <!-- semi-determinate progress bar.  shows value -->
+        <div class="col-md-10"><progress max="1"></progress></div>
+        <div class="col-md-2">{{data.value}}...</div>
+      </div>
+
+      <div ng-if="!data.hasvalue()">
+        <!-- indeterminate -->
+        <div class="col-md-12"><progress max="1"></progress></div>
+      </div>
+    </div>
+  </div>
+</div>
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 19e80a3..ad4c104 100644
--- a/Open-ILS/web/js/ui/default/staff/services/ui.js
+++ b/Open-ILS/web/js/ui/default/staff/services/ui.js
@@ -78,32 +78,126 @@ function($timeout , $parse) {
     };
 })
 
-
 /**
- * egProgressModal.open();
+ * Progress Dialog. 
+ *
+ * egProgressDialog.open();
+ * egProgressDialog.open({value : 0});
+ * egProgressDialog.open({value : 0, max : 123});
+ * egProgressDialog.increment();
+ * egProgressDialog.increment();
+ * egProgressDialog.close();
+ *
+ * Each dialog has 2 numbers, 'max' and 'value'.
+ * The content of these values determines how the dialog displays.  
+ *
+ * There are 3 flavors:
+ *
+ * -- value is set, max is set
+ * determinate: shows a progression with a percent complete.
+ *
+ * -- value is set, max is unset
+ * semi-determinate, with a value report.  Shows a value-less
+ * <progress/>, but shows the value as a number in the dialog.
+ *
+ * This is useful in cases where the total number of items to retrieve
+ * from the server is unknown, but we know how many items we've
+ * retrieved thus far.  It helps to reinforce that something specific
+ * is happening, but we don't know when it will end.
+ *
+ * -- value is unset
+ * indeterminate: shows a generic value-less <progress/> with no 
+ * clear indication of progress.
+ *
+ * Only 1 egProgressDialog instance will be activate at a time.
+ * Each invocation of .open() destroys any existing instance.
  */
-.factory('egProgressModal', 
 
-        ['$uibModal','$interpolate',
-function($uibModal, $interpolate){
+/* Simple storage class for egProgressDialog data maintenance.
+ * This data lives outside of egProgressDialog so it can be 
+ * directly imported into egProgressDialog's $uibModalInstance.
+ */
+.factory('egProgressData', [
+    function() {
+        var service = {}; // max/value initially unset
+
+        service.reset = function() {
+            delete service.max;
+            delete service.value;
+        }
+
+        service.hasvalue = function() {
+            return Number.isInteger(service.value);
+        }
+
+        service.hasmax = function() {
+            return Number.isInteger(service.max);
+        }
+
+        service.percent = function() {
+            if (service.hasvalue()  && 
+                service.hasmax()    && 
+                service.max > 0     &&
+                service.value <= service.max)
+                return Math.floor((service.value / service.max) * 100);
+            return 100;
+        }
+
+        return service;
+    }
+])
+
+.factory('egProgressDialog', [
+            'egProgressData','$uibModal', 
+    function(egProgressData , $uibModal) {
     var service = {};
 
-    service.open = function() {
+    service.open = function(args) {
+        service.close(); // force-kill existing instances.
+
+        // Reset to an indeterminate progress bar, 
+        // overlay with caller values.
+        egProgressData.reset();
+        service.update(angular.extend({}, args));
+
         return $uibModal.open({
-            templateUrl: './share/t_progress_bar',
-            controller: ['$scope', '$uibModalInstance',
-                function($scope, $uibModalInstance) {
+            templateUrl: './share/t_progress_dialog',
+            controller: ['$scope','$uibModalInstance','egProgressData',
+                function( $scope , $uibModalInstance , egProgressData) {
                   service.currentInstance = $uibModalInstance;
+                  $scope.data = egProgressData; // tiny service
                 }
             ]
         });
     };
+
     service.close = function() {
         if (service.currentInstance) {
             service.currentInstance.close();
             delete service.currentInstance;
         }
     }
+
+    // Set the current state of the progress bar.
+    service.update = function(args) {
+        if (args.max != undefined) 
+            egProgressData.max = args.max;
+        if (args.value != undefined) 
+            egProgressData.value = args.value;
+    }
+
+    // Increment the current value.  If no amount is specified,
+    // it increments by 1.  Calling increment() on an indetermite
+    // progress bar will force it to be a (semi-)determinate bar.
+    service.increment = function(amt) {
+        if (!Number.isInteger(amt)) amt = 1;
+
+        if (!egProgressData.hasvalue())
+            egProgressData.value = 0;
+
+        egProgressData.value += amt;
+    }
+
     return service;
 }])
 

commit 1110f323e1f878d2bfd7279f964987be37c38dda
Author: Victoria Lewis <vlewis at catalystdevworks.com>
Date:   Mon Feb 6 12:12:56 2017 -0800

    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 <vlewis at catalystdevworks.com>
    Signed-off-by: Bill Erickson <berickxx at gmail.com>
    Signed-off-by: Terran McCanna <tmccanna at georgialibraries.org>
    Signed-off-by: Kathy Lussier <klussier at masslnc.org>

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 0000000..6e4df97
--- /dev/null
+++ b/Open-ILS/src/templates/staff/share/t_progress_bar.tt2
@@ -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>
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 3ab19cc..4fadbb4 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 e4e4579..19e80a3 100644
--- a/Open-ILS/web/js/ui/default/staff/services/ui.js
+++ b/Open-ILS/web/js/ui/default/staff/services/ui.js
@@ -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') });
  */

-----------------------------------------------------------------------

Summary of changes:
 .../staff/circ/patron/t_search_results.tt2         |   13 --
 Open-ILS/src/templates/staff/css/style.css.tt2     |    5 +
 .../templates/staff/share/t_progress_dialog.tt2    |   30 +++++
 .../web/js/ui/default/staff/cat/catalog/app.js     |   28 ++++-
 .../web/js/ui/default/staff/circ/patron/app.js     |   19 ++--
 Open-ILS/web/js/ui/default/staff/services/ui.js    |  122 ++++++++++++++++++++
 6 files changed, 191 insertions(+), 26 deletions(-)
 create mode 100644 Open-ILS/src/templates/staff/share/t_progress_dialog.tt2


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list