From 54ecb032b057136d670dd400b91629fd7dbbadc4 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Mon, 14 Oct 2019 15:40:12 -0400 Subject: [PATCH] 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 --- .../app/staff/cat/vandelay/queue.component.html | 12 +++++++++++ .../src/app/staff/cat/vandelay/queue.component.ts | 23 +++++++++++++++++----- .../vandelay/queued-record-matches.component.ts | 3 +++ 3 files changed, 33 insertions(+), 5 deletions(-) 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 2c1b3c3215..e672793923 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,9 +127,18 @@ definitions. Hide a number of stock record attributes by default because there are a lot of them. --> + + + check_circle + + + @@ -142,6 +151,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 19f08ad6ad..57da332e1d 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 @@ -198,12 +198,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 f50c48266d..cbd9413e33 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 @@ -78,6 +78,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); + } } } -- 2.11.0