From: Bill Erickson Date: Mon, 14 Oct 2019 19:40:12 +0000 (-0400) Subject: LP1843837 Vandelay queue import selection persistence X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=5b07a5e3c9ba587396a3f4931a97fc1f547017b0;p=working%2FEvergreen.git LP1843837 Vandelay queue import selection persistence Manage grid row selection locally for the Vandelay Inspect Queue interface (similar to the Record Matches interface) so the set of selected records and optional merge/overlay targets may persist across grid renderings without having to synchronize selection between the grid and the Vandelay service. To test, create a queue with matches, select some items in the grid, click on one of the matches to select a match, then return to the grid. Both the newly selected match-target row and the previously selected rows will retain their selection. Signed-off-by: Bill Erickson --- diff --git a/Open-ILS/src/eg2/src/app/staff/cat/vandelay/queue.component.html b/Open-ILS/src/eg2/src/app/staff/cat/vandelay/queue.component.html index b3b39a8a16..1aff1af77f 100644 --- a/Open-ILS/src/eg2/src/app/staff/cat/vandelay/queue.component.html +++ b/Open-ILS/src/eg2/src/app/staff/cat/vandelay/queue.component.html @@ -127,10 +127,19 @@ definitions. Hide a number of stock record attributes by default because there are a lot of them. --> + + + check_circle + + + + + 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..a3496a3b9b 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 @@ -205,12 +205,25 @@ 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); + } + + 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/queued-record-matches.component.ts b/Open-ILS/src/eg2/src/app/staff/cat/vandelay/queued-record-matches.component.ts index dfbee692ef..7a4d186ae0 100644 --- a/Open-ILS/src/eg2/src/app/staff/cat/vandelay/queued-record-matches.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/cat/vandelay/queued-record-matches.component.ts @@ -86,6 +86,9 @@ export class QueuedRecordMatchesComponent implements OnInit { } const match = this.matchMap[matchId]; selection.overlayMap[this.recordId] = match.eg_record(); + if (!selection.recordIds.includes(this.recordId)) { + selection.recordIds.push(this.recordId); + } } }