LP1843837 Vandelay queue Select All Rows option user/berick/lp1843837-vand-persist-queue-selections-1
authorBill Erickson <berickxx@gmail.com>
Fri, 24 Apr 2020 21:44:53 +0000 (17:44 -0400)
committerBill Erickson <berickxx@gmail.com>
Fri, 24 Apr 2020 21:45:04 +0000 (17:45 -0400)
Adds an option to the Vandelay Queue grid to select all rows via grid
toolbar checkbox.  This was necessary to replace the functionality lost
by disabing grid paging to support persistent grid import selection.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/eg2/src/app/staff/cat/vandelay/queue.component.html
Open-ILS/src/eg2/src/app/staff/cat/vandelay/queue.component.ts

index 1aff1af..abc7ce4 100644 (file)
@@ -2,6 +2,9 @@
 <eg-progress-dialog #progressDlg
   dialogTitle="Deleting Queue..." i18n-dialogTitle></eg-progress-dialog>
 
+<eg-progress-dialog #progressSelect
+  dialogTitle="Selecting all records..." i18n-dialogTitle></eg-progress-dialog>
+
 <ng-container *ngIf="queueSummary && queueSummary.queue">
 
   <eg-confirm-dialog
@@ -142,6 +145,9 @@ because there are a lot of them.
   [disableSelect]="true"
   hideFields="language,pagination,price,rec_identifier,eg_tcn_source,eg_identifier,item_barcode,zsource">
 
+  <eg-grid-toolbar-checkbox i18n-label label="Select All"
+    (onChange)="toggleSelectRows($event)"></eg-grid-toolbar-checkbox>
+
   <eg-grid-toolbar-checkbox i18n-label label="Records With Matches"
     (onChange)="limitToMatches($event)"></eg-grid-toolbar-checkbox>
 
index a3496a3..7a72fe6 100644 (file)
@@ -37,6 +37,7 @@ export class QueueComponent implements OnInit, AfterViewInit {
     @ViewChild('queueGrid', { static: true }) queueGrid: GridComponent;
     @ViewChild('confirmDelDlg', { static: false }) confirmDelDlg: ConfirmDialogComponent;
     @ViewChild('progressDlg', { static: true }) progressDlg: ProgressDialogComponent;
+    @ViewChild('progressSelect', {static: false}) progressSelect: ProgressDialogComponent;
 
     cellTextGenerator: GridCellTextGenerator;
 
@@ -210,6 +211,27 @@ export class QueueComponent implements OnInit, AfterViewInit {
             this.vandelay.importSelection.recordIds.includes(rowId);
     }
 
+    toggleSelectRows(checked: boolean) {
+
+        if (checked) {
+            this.progressSelect.open();
+            this.queueGrid.context.getAllRows().then(_ => {
+                this.queueSource.data.forEach(row => {
+                    if (!this.rowIsSelected(row)) {
+                        this.rowClicked(row);
+                    }
+                });
+                this.progressSelect.close();
+            });
+
+        } else {
+            const selection = this.vandelay.importSelection;
+            if (selection) {
+                selection.recordIds = [];
+            }
+        }
+    }
+
     rowClicked(row: any) {
         const selection = this.findOrCreateImportSelection();
         if (selection.recordIds.includes(row.id)) {