From: Bill Erickson Date: Wed, 12 May 2021 16:05:40 +0000 (-0400) Subject: LP1842763 Import from queue selection improvements X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=refs%2Fheads%2Fuser%2Fberick%2Flp1842763-vand-allow-import-from-selection-v2;p=working%2FEvergreen.git LP1842763 Import from queue selection improvements Improve retention of selected queue information and selected overlay targets while navigating Vandelay queue and import interfaces. Also adds a 'Select All' records option to the queue grid. Signed-off-by: Bill Erickson --- diff --git a/Open-ILS/src/eg2/src/app/staff/cat/vandelay/import.component.html b/Open-ILS/src/eg2/src/app/staff/cat/vandelay/import.component.html index b9f059b251..e98d9b3c07 100644 --- a/Open-ILS/src/eg2/src/app/staff/cat/vandelay/import.component.html +++ b/Open-ILS/src/eg2/src/app/staff/cat/vandelay/import.component.html @@ -20,7 +20,7 @@
- + @@ -48,7 +51,7 @@
@@ -65,7 +68,7 @@
+ + + + + check_circle + + + + + @@ -141,6 +156,9 @@ because there are a lot of them. + + diff --git a/Open-ILS/src/eg2/src/app/staff/cat/vandelay/queue.component.ts b/Open-ILS/src/eg2/src/app/staff/cat/vandelay/queue.component.ts index 484e456633..7a72fe657c 100644 --- a/Open-ILS/src/eg2/src/app/staff/cat/vandelay/queue.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/cat/vandelay/queue.component.ts @@ -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; @@ -205,12 +206,46 @@ export class QueueComponent implements OnInit, AfterViewInit { Boolean(this.vandelay.importSelection.overlayMap[rid]); } + rowIsSelected(rowId: number): boolean { + return this.vandelay.importSelection && + 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)) { + selection.recordIds = selection.recordIds.filter( + rid => rid !== row.id); + } else { + selection.recordIds.push(row.id); + } + } + importSelected() { - const rows = this.queueGrid.context.getSelectedRows(); - if (rows.length) { - const selection = this.findOrCreateImportSelection(); - selection.recordIds = rows.map(row => row.id); - console.log('importing: ', this.vandelay.importSelection); + const selection = this.findOrCreateImportSelection(); + if (selection.recordIds.length) { + console.debug('importing: ', this.vandelay.importSelection); this.router.navigate(['/staff/cat/vandelay/import']); } } diff --git a/Open-ILS/src/eg2/src/app/staff/cat/vandelay/vandelay.service.ts b/Open-ILS/src/eg2/src/app/staff/cat/vandelay/vandelay.service.ts index cd52d44e1f..3d97ba1d7e 100644 --- a/Open-ILS/src/eg2/src/app/staff/cat/vandelay/vandelay.service.ts +++ b/Open-ILS/src/eg2/src/app/staff/cat/vandelay/vandelay.service.ts @@ -19,7 +19,7 @@ export class VandelayImportSelection { recordIds: number[]; queue: IdlObject; importQueue: boolean; // import the whole queue - overlayMap: {[qrId: number]: /* breId */ number}; + overlayMap: {[qrId: number]: /* match */ IdlObject}; constructor() { this.recordIds = [];