LP#2013223: quiet browser console noise from some AngularJS grids
authorGalen Charlton <gmc@equinoxOLI.org>
Wed, 29 Mar 2023 16:09:32 +0000 (12:09 -0400)
committerJane Sandberg <sandbergja@gmail.com>
Tue, 9 May 2023 22:34:18 +0000 (15:34 -0700)
This patch quells console error noise from certain AngularJS grids.

To test
-------
[1] Go to the AngularJS Renew Items, Holds Shelf, or patron holds list
    pages.
[2] Note that the brower console has a lot of "TypeError: action.handler is undefined"
    error messages.
[3] Apply the patch and repeat step 1. This time, the "action.handler"
    errors should be gone.

Signed-off-by: Galen Charlton <gmc@equinoxOLI.org>
Signed-off-by: Stephanie Leary <stephanie.leary@equinoxoli.org>
Signed-off-by: Jane Sandberg <sandbergja@gmail.com>

Open-ILS/web/js/ui/default/staff/services/grid.js

index 57d93c8..8d07f9b 100644 (file)
@@ -658,7 +658,12 @@ angular.module('egGridMod',
 
             // fires the disable handler function for a context action
             $scope.actionDisable = function(action) {
-                if(grid.getSelectedItems().length == 0 && action.handler.length > 0) {
+                if (!action.handler) {
+                    // we're probably a divider, so there's no action
+                    // to enable
+                    return true;
+                }
+                if (grid.getSelectedItems().length == 0 && action.handler.length > 0) {
                     return true;
                 }
                 if (typeof action.disabled == 'undefined') {