LP#1712854: Disable all server-side sorting, but provide a stub for later, if we...
authorMike Rylander <mrylander@gmail.com>
Wed, 12 Sep 2018 13:14:58 +0000 (09:14 -0400)
committerJane Sandberg <sandbej@linnbenton.edu>
Wed, 15 Jul 2020 01:08:05 +0000 (18:08 -0700)
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: John Yorio <jyorio@equinoxinitiative.org>
Signed-off-by: Jane Sandberg <sandbej@linnbenton.edu>
Open-ILS/src/templates/staff/circ/holds/t_shelf_list.tt2
Open-ILS/web/js/ui/default/staff/cat/catalog/app.js
Open-ILS/web/js/ui/default/staff/circ/holds/app.js

index 71d4abb..22a6e39 100644 (file)
   <eg-grid-field label="[% l('Hold Note Count') %]" path='hold.note_count' hidden></eg-grid-field>
   <eg-grid-field label="[% l('User Display Name') %]" path='hold.usr_display_name' hidden></eg-grid-field>
   <eg-grid-field label="[% l('User Alias') %]" path='hold.usr_alias' hidden></eg-grid-field>
-  <eg-grid-field label="[% l('User Alias or Display Name') %]" path='hold.usr_alias_or_display_name' nonsortable hidden></eg-grid-field>
+  <eg-grid-field label="[% l('User Alias or Display Name') %]" path='hold.usr_alias_or_display_name' hidden></eg-grid-field>
   <eg-grid-field label="[% l('User Barcode') %]" path='hold.ucard_barcode' hidden></eg-grid-field>
   <eg-grid-field label="[% l('Requestor Username') %]" path='hold.rusr_usrname' hidden></eg-grid-field>
   <eg-grid-field label="[% l('Copy ID') %]" path='hold.cp_id' hidden></eg-grid-field>
index 491b6ca..68f387e 100644 (file)
@@ -1803,7 +1803,9 @@ function($scope , $routeParams , $location , $window , $q , egCore , egHolds , e
         };
 
         var order_by = [{ request_time : null }];
-        if (provider.sort && provider.sort.length) {
+        // NOTE: Server sort is disabled for now.  See the comment on
+        // similar code in circ/holds/app.js for details.
+        if (false && provider.sort && provider.sort.length) {
             order_by = [];
             angular.forEach(provider.sort, function (c) {
                 if (!angular.isObject(c)) {
index d73fda7..08701c2 100644 (file)
@@ -90,12 +90,44 @@ function($scope , $q , $routeParams , $window , $location , egCore , egHolds , e
         };
 
         var order_by = [{ shelf_expire_time : null }];
-        if (provider.sort && provider.sort.length) {
+
+        // NOTE: Server sorting is currently disabled entirely by the 
+        // first clause in this 'if'.   This is perfectly fine because
+        // clientsort always runs inside the arrayNotifier implementation
+        // in the egGrid code.   However, in order to retain the memory
+        // of sorting constraints placed on us by the current server-side
+        // code, an initial "cannot sort these" array and test is added
+        // here.  An alternate implementation might be to map fields to
+        // query positions, thus allowing positional ORDER BY clauses.
+        // With as many fields as the wide hold object has, this is
+        // non-trivial at the moment.
+        if (false && provider.sort && provider.sort.length) {
+            // A list of fields we can't sort on the server side.  That's ok, because
+            // the grid is marked clientsort, so it always re-sorts in the browser.
+            var cannot_sort = [
+                'relative_queue_position',
+                'default_estimated_wait',
+                'min_estimated_wait',
+                'potentials',
+                'other_holds',
+                'total_wait_time',
+                'notification_count',
+                'last_notification_time',
+                'is_staff_hold',
+                'copy_location_order_position',
+                'hold_status',
+                'clear_me',
+                'usr_alias_or_display_name',
+                'usr_display_name',
+                'usr_alias_or_first_given_name'
+            ];
+
             order_by = [];
             angular.forEach(provider.sort, function (c) {
                 if (!angular.isObject(c)) {
                     if (c.match(/^hold\./)) {
                         var i = c.replace('hold.','');
+                        if (cannot_sort.includes(i)) return;
                         var ob = {};
                         ob[i] = null;
                         order_by.push(ob);
@@ -105,6 +137,7 @@ function($scope , $q , $routeParams , $window , $location , egCore , egHolds , e
                     var direction = c[i];
                     if (i.match(/^hold\./)) {
                         i = i.replace('hold.','');
+                        if (cannot_sort.includes(i)) return;
                         var ob = {}
                         ob[i] = {dir:direction};
                         order_by.push(ob);