[open-ils-commits] [GIT] Evergreen ILS branch master updated. 16820395ec44a6944f020cb65c2d79c315de209e

Evergreen Git git at git.evergreen-ils.org
Mon Mar 6 17:11:10 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  16820395ec44a6944f020cb65c2d79c315de209e (commit)
       via  e8c945b99dc5d8b3d4aa014b50e3474138af1be9 (commit)
       via  354988bfab03a9bd1f99c67a22790ce72d6ee9fb (commit)
      from  6fa137e176b4f08f083828fcc454aefbc2e8118b (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 16820395ec44a6944f020cb65c2d79c315de209e
Author: Bill Erickson <berickxx at gmail.com>
Date:   Fri Mar 3 11:42:44 2017 -0500

    LP#1642378 Webstaff negative balance UI progress dialog
    
    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 at gmail.com>
    Signed-off-by: Kathy Lussier <klussier at masslnc.org>

diff --git a/Open-ILS/web/js/ui/default/staff/admin/local/circ/neg_balance_users.js b/Open-ILS/web/js/ui/default/staff/admin/local/circ/neg_balance_users.js
index 1697aa7..1386c6c 100644
--- a/Open-ILS/web/js/ui/default/staff/admin/local/circ/neg_balance_users.js
+++ b/Open-ILS/web/js/ui/default/staff/admin/local/circ/neg_balance_users.js
@@ -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();
 
@@ -19,10 +22,11 @@ function($scope , $q , $timeout , $location , $window , egCore , egGridDataProvi
             'open-ils.actor.users.negative_balance',
             egCore.auth.token(), $scope.context_org.id())
         .then(deferred.resolve, null, function(blob) {
+            egProgressDialog.increment();
             // Give the grid a top-level identifier field
             blob.usr_id = blob.usr.id();
             deferred.notify(blob)
-        });
+        }).finally(egProgressDialog.close);
 
         return deferred.promise;
     }

commit e8c945b99dc5d8b3d4aa014b50e3474138af1be9
Author: Bill Erickson <berickxx at gmail.com>
Date:   Mon Feb 27 16:53:52 2017 -0500

    LP#1642378 Webstaff Negative Balance org select repairs
    
    1. Disable org units in the org unit selector that cannot have users.
    
    Additional code cleanup:
    
    2. The org selector calls egStartup internally, so if the page
    controller has no need to wait on the startup to complete, then it does
    not need to manually invoke the startup.
    
    3. No longer necessary to manually track the selected org unit from the
    org selector directive.
    
    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/admin/local/circ/neg_balance_users.tt2 b/Open-ILS/src/templates/staff/admin/local/circ/neg_balance_users.tt2
index 73d7ec8..9501f6a 100644
--- a/Open-ILS/src/templates/staff/admin/local/circ/neg_balance_users.tt2
+++ b/Open-ILS/src/templates/staff/admin/local/circ/neg_balance_users.tt2
@@ -23,6 +23,7 @@
     <div class="form-group">
       <label>[% l('Patron Library') %]</label>
       <eg-org-selector onchange="org_changed" 
+        disable-test="disable_org"
         selected="context_org"></eg-org-selector>
     </div>
   </div>
diff --git a/Open-ILS/web/js/ui/default/staff/admin/local/circ/neg_balance_users.js b/Open-ILS/web/js/ui/default/staff/admin/local/circ/neg_balance_users.js
index 4169c9b..1697aa7 100644
--- a/Open-ILS/web/js/ui/default/staff/admin/local/circ/neg_balance_users.js
+++ b/Open-ILS/web/js/ui/default/staff/admin/local/circ/neg_balance_users.js
@@ -6,8 +6,6 @@ angular.module('egAdminCirc',
        ['$scope','$q','$timeout','$location','$window','egCore','egGridDataProvider',
 function($scope , $q , $timeout , $location , $window , egCore , egGridDataProvider) {
 
-    egCore.startup.go(); // standalone mode requires manual startup
-
     $scope.grid_provider = egGridDataProvider.instance({});
 
     // API does not currenlty support paging, so it's all or none.
@@ -30,10 +28,14 @@ function($scope , $q , $timeout , $location , $window , egCore , egGridDataProvi
     }
 
     $scope.org_changed = function(org) {
-        $scope.context_org = org; // hmm, why necessary.
         $scope.grid_provider.refresh();
     }
 
+    $scope.disable_org = function(org_id) {
+        if (!org_id) return true;
+        return egCore.org.get(org_id).ou_type().can_have_users() != 't';
+    }
+
     // NOTE: Chrome only allows one tab/window to open per user
     // action.  Only the first patron will be displayed.
     $scope.get_user = function(selected) {

commit 354988bfab03a9bd1f99c67a22790ce72d6ee9fb
Author: Bill Erickson <berickxx at gmail.com>
Date:   Mon Feb 27 16:43:09 2017 -0500

    LP#1642378 Webstaff org selector misc. repairs
    
    1. Always apply default values after egStartup.go() has completed.
       Among other things, this prevents the occaisonal "cannot call ws_ou()
       on an undefined value" errors bubbling up from the org selector
       when an attempt to set default values occured before egAuth had
       retrieved the user (which occurs during startup).
    
    2. For consistency, always run the $scope.onchange handler on initial
       page load when a selected value and change handler are defined.
       Similar to #1 above, the initial onchange always fires after
       egStartup has completed.
    
    3. Run the change handler in a $timeout so that the $scope.selected
       value has a chance to propagate to the calling controller's $scope.
       Otherwise, the the calling controller has to manually track the
       selected value (which partially defeats the purpose of having this
       directive in the first place).
    
    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/services/ui.js b/Open-ILS/web/js/ui/default/staff/services/ui.js
index ad4c104..5d73487 100644
--- a/Open-ILS/web/js/ui/default/staff/services/ui.js
+++ b/Open-ILS/web/js/ui/default/staff/services/ui.js
@@ -550,8 +550,8 @@ function($window , egStrings) {
            + '</ul>'
           + '</div>',
 
-        controller : ['$scope','$timeout','egOrg','egAuth','egCore','egStartup',
-              function($scope , $timeout , egOrg , egAuth , egCore , egStartup) {
+        controller : ['$scope','$timeout','egCore','egStartup',
+              function($scope , $timeout , egCore , egStartup) {
 
             if ($scope.alldisabled) {
                 $scope.disable_button = $scope.alldisabled == 'true' ? true : false;
@@ -559,19 +559,18 @@ function($window , egStrings) {
                 $scope.disable_button = false;
             }
 
-            $scope.egOrg = egOrg; // for use in the link function
-            $scope.egAuth = egAuth; // for use in the link function
-            $scope.hatch = egCore.hatch // for use in the link function
-
             // avoid linking the full fleshed tree to the scope by 
             // tossing in a flattened list.
             // --
             // Run-time code referencing post-start data should be run
             // from within a startup block, otherwise accessing this
             // module before startup completes will lead to failure.
+            //
+            // controller() runs before link().
+            // This post-startup code runs after link().
             egStartup.go().then(function() {
 
-                $scope.orgList = egOrg.list().map(function(org) {
+                $scope.orgList = egCore.org.list().map(function(org) {
                     return {
                         id : org.id(),
                         shortname : org.shortname(), 
@@ -579,10 +578,39 @@ function($window , egStrings) {
                     }
                 });
 
-                if (!$scope.selected && !$scope.nodefault)
-                    $scope.selected = egOrg.get(egAuth.user().ws_ou());
+                // Apply default values
+
+                if ($scope.stickySetting) {
+                    var orgId = egCore.hatch.getLocalItem($scope.stickySetting);
+                    if (orgId) {
+                        $scope.selected = egCore.org.get(orgId);
+                    }
+                }
+
+                if (!$scope.selected && !$scope.nodefault) {
+                    $scope.selected = 
+                        egCore.org.get(egCore.auth.user().ws_ou());
+                }
+
+                fire_orgsel_onchange(); // no-op if nothing is selected
             });
 
+            /**
+             * Fire onchange handler after a timeout, so the
+             * $scope.selected value has a chance to propagate to
+             * the page controllers before the onchange fires.  This
+             * way, the caller does not have to manually capture the
+             * $scope.selected value during onchange.
+             */
+            function fire_orgsel_onchange() {
+                if (!$scope.selected || !$scope.onchange) return;
+                $timeout(function() {
+                    console.debug(
+                        'egOrgSelector onchange('+$scope.selected.id()+')');
+                    $scope.onchange($scope.selected)
+                });
+            }
+
             $scope.getSelectedName = function() {
                 if ($scope.selected && $scope.selected.shortname)
                     return $scope.selected.shortname();
@@ -590,11 +618,11 @@ function($window , egStrings) {
             }
 
             $scope.orgChanged = function(org) {
-                $scope.selected = egOrg.get(org.id);
+                $scope.selected = egCore.org.get(org.id);
                 if ($scope.stickySetting) {
                     egCore.hatch.setLocalItem($scope.stickySetting, org.id);
                 }
-                if ($scope.onchange) $scope.onchange($scope.selected);
+                fire_orgsel_onchange();
             }
 
         }],
@@ -610,20 +638,7 @@ function($window , egStrings) {
                         scope[field] = false;
                 }
             );
-
-            if (scope.stickySetting) {
-                var orgId = scope.hatch.getLocalItem(scope.stickySetting);
-                if (orgId) {
-                    scope.selected = scope.egOrg.get(orgId);
-                    if (scope.onchange)
-                        scope.onchange(scope.selected);
-                }
-            }
-
-            if (!scope.selected && !scope.nodefault)
-                scope.selected = scope.egOrg.get(scope.egAuth.user().ws_ou());
         }
-
     }
 })
 

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

Summary of changes:
 .../staff/admin/local/circ/neg_balance_users.tt2   |    1 +
 .../staff/admin/local/circ/neg_balance_users.js    |   18 ++++--
 Open-ILS/web/js/ui/default/staff/services/ui.js    |   63 ++++++++++++--------
 3 files changed, 52 insertions(+), 30 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list