LP1746566 - Enable 500, 1K, and ALL-the-Rows in patron grids user/cesardv/lp1746566-Webstaff_Grid_Enable_AllTheRows
authorCesar Velez <cesar.velez@equinoxinitiative.org>
Wed, 7 Feb 2018 17:05:10 +0000 (12:05 -0500)
committerCesar Velez <cesar.velez@equinoxinitiative.org>
Fri, 9 Feb 2018 17:07:18 +0000 (12:07 -0500)
This adds to the Items out, holds, and ItemStatus grids the
'allowAll' grid feature which will enable the 500, 1K, and ALL
(really 10K) rows/pagesize. For the ALL option a modal has been
wired to that the action can be confirmed, since it might be a
very slow operation.

Signed-off by: Cesar Velez <cesar.velez@equinoxinitiative.org>

Open-ILS/src/templates/staff/base_js.tt2
Open-ILS/src/templates/staff/cat/item/t_list.tt2
Open-ILS/src/templates/staff/circ/patron/t_holds_list.tt2
Open-ILS/src/templates/staff/circ/patron/t_items_out.tt2
Open-ILS/src/templates/staff/share/t_autogrid.tt2
Open-ILS/web/js/ui/default/staff/services/grid.js

index 2932e45..a58ae8d 100644 (file)
@@ -203,6 +203,8 @@ UpUp.start({
     s.CONFIRM_IN_HOUSE_NUM_USES_COUNT_TITLE = "[% l('Are you sure you want to record {{num_uses}} uses for this?') %]";
     s.PAGE_TITLE_DEFAULT = "[% l('Evergreen Staff Client') %]";
     s.PAGE_TITLE_DYNAMIC_AND_CONTEXT = "[% l('[_1] - [_2]', '{{dynamic}}', '{{context}}') %]";
+    s.CONFIRM_LONG_RUNNING_ACTION_MSG = "[% l('This action might take a while to complete. Continue?') %]";
+    s.CONFIRM_LONG_RUNNING_ACTION_ALL_ROWS_TITLE = "[% l('Are you sure you want to load ALL items?') %]";
   }]);
 </script>
 
index eb584c9..324ef22 100644 (file)
@@ -1,7 +1,7 @@
 <eg-grid
   id-field="index"
   idl-class="acp"
-  features="-display,clientsort"
+  features="-display,clientsort,allowAll"
   main-label="[% l('Item Status') %]"
   items-provider="gridDataProvider"
   grid-controls="gridControls"
index 65fb234..d649f59 100644 (file)
@@ -1,6 +1,6 @@
 <eg-grid
   id-field="id"
-  features="clientsort"
+  features="clientsort,allowAll"
   items-provider="gridDataProvider"
   persist-key="circ.patron.holds"
   dateformat="{{$root.egDateAndTimeFormat}}">
index 4efa432..b2adc1a 100644 (file)
@@ -29,7 +29,7 @@
   ng-if="items_out_display == 'noncat'"
   idl-class="ancc"
   id-field="id"
-  features="clientsort"
+  features="clientsort,allowAll"
   items-provider="gridDataProvider"
   persist-key="circ.patron.items_out.noncat"
   dateformat="{{$root.egDateAndTimeFormat}}">
index e8f94d7..195ec1a 100644 (file)
             {{t}}
           </a>
         </li>
+        <li ng-if="allowAll" ng-repeat="t in [500,1000]">
+          <a href ng-click='offset(0);limit(t);collect()'>
+            {{t}}
+          </a>
+        </li>
         <li ng-if="allowAll" >
-          <a href ng-click='offset(0);limit(10000);collect()'>[% l('All') %]</a>
+          <a href ng-click='confirmAllowAllAndCollect();'>[% l('All') %]</a>
         </li>
       </ul>
     </div>
index fab8679..cf0aacf 100644 (file)
@@ -119,10 +119,10 @@ angular.module('egGridMod',
         controller : [
                     '$scope','$q','egCore','egGridFlatDataProvider','$location',
                     'egGridColumnsProvider','$filter','$window','$sce','$timeout',
-                    'egProgressDialog',
+                    'egProgressDialog', 'egConfirmDialog', 'egStrings',
             function($scope,  $q , egCore,  egGridFlatDataProvider , $location,
                      egGridColumnsProvider , $filter , $window , $sce , $timeout,
-                     egProgressDialog) {
+                     egProgressDialog, egConfirmDialog, egStrings) {
 
             var grid = this;
 
@@ -1123,6 +1123,18 @@ angular.module('egGridMod',
 
             $scope.collect = function() { grid.collect() }
 
+
+            $scope.confirmAllowAllAndCollect = function(){
+                egConfirmDialog.open(egStrings.CONFIRM_LONG_RUNNING_ACTION_ALL_ROWS_TITLE,
+                    egStrings.CONFIRM_LONG_RUNNING_ACTION_MSG)
+                    .result
+                    .then(function(){
+                        $scope.offset(0);
+                        $scope.limit(10000);
+                        grid.collect();
+                });
+            }
+
             // asks the dataProvider for a page of data
             grid.collect = function() {