From 91b50cfcfbeb304dcb213af75a7b575726076da5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johnny=20Marie=CC=81thoz?= Date: Mon, 4 Nov 2024 14:30:41 +0100 Subject: [PATCH] migration: add reject action MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Adds a "reject" button to speed up the user action. * Fixes the ILS Pid focus. * Do not display the first candidate for a "no match" deduplication status. Co-Authored-by: Johnny MarieĢthoz --- ...igration-data-deduplication.component.html | 62 ++++++++++++++----- .../migration-data-deduplication.component.ts | 17 +++-- .../src/app/migration/migration.module.ts | 2 + 3 files changed, 60 insertions(+), 21 deletions(-) diff --git a/projects/admin/src/app/migration/deduplication/record/brief-view/migration-data-deduplication/migration-data-deduplication.component.html b/projects/admin/src/app/migration/deduplication/record/brief-view/migration-data-deduplication/migration-data-deduplication.component.html index 08610426f..c4b834b09 100644 --- a/projects/admin/src/app/migration/deduplication/record/brief-view/migration-data-deduplication/migration-data-deduplication.component.html +++ b/projects/admin/src/app/migration/deduplication/record/brief-view/migration-data-deduplication/migration-data-deduplication.component.html @@ -18,64 +18,92 @@ @if (record()) {
- + - ILS pid: {{ ilsPid }}  + ILS pid: {{ ilsPid }}  - + -
+
- {{currentCandidateIndex+1}} / {{candidates.length}} + + {{ currentCandidateIndex + 1 }} / {{ + candidates.length + }} +
-
- +
+ +
@if (messages) {
- +
}
@if (record()?.metadata?.deduplication?.modified_by) { ({{ record()?.metadata?.deduplication?.modified_by }} / {{ - record()?.metadata?.deduplication?.modified_at | dateTranslate : "medium" + record()?.metadata?.deduplication?.modified_at + | dateTranslate : "medium" }}) } diff --git a/projects/admin/src/app/migration/deduplication/record/brief-view/migration-data-deduplication/migration-data-deduplication.component.ts b/projects/admin/src/app/migration/deduplication/record/brief-view/migration-data-deduplication/migration-data-deduplication.component.ts index 241f6812d..b8275f77c 100644 --- a/projects/admin/src/app/migration/deduplication/record/brief-view/migration-data-deduplication/migration-data-deduplication.component.ts +++ b/projects/admin/src/app/migration/deduplication/record/brief-view/migration-data-deduplication/migration-data-deduplication.component.ts @@ -38,9 +38,6 @@ export class MigrationDataDeduplicationBriefComponent implements OnInit { // current ILS pid ilsPid = null; - // toggle in place edit ils pid - isInplaceActive = false; - // current candidate currentCandidate = null; @@ -54,11 +51,15 @@ export class MigrationDataDeduplicationBriefComponent implements OnInit { ngOnInit(): void { let ilsPid = this.record()?.metadata?.deduplication?.ils_pid; // get value from the backend if it exists - if (ilsPid == null && this.candidates.length > 0) { + if (ilsPid == null && this.candidates.length > 0 && this.status() !== 'no match') { ilsPid = this.candidates[0].json.pid; } // display the current candidate if exists this.updateCurrentCandidate(ilsPid); + if (this.status() == 'no match') { + this.currentCandidateIndex = -1; + this.currentCandidate = null; + } } /** @@ -191,6 +192,14 @@ export class MigrationDataDeduplicationBriefComponent implements OnInit { this.updateCurrentCandidate(ilsPid); } + /** + * Reject the candidates and set the status to "no match". + */ + reject() { + this.ilsPid = null; + this.save(); + } + /** * Save the candidates and the ILS pid value in the backend. */ diff --git a/projects/admin/src/app/migration/migration.module.ts b/projects/admin/src/app/migration/migration.module.ts index 5bd1a9d5a..281ccc9eb 100644 --- a/projects/admin/src/app/migration/migration.module.ts +++ b/projects/admin/src/app/migration/migration.module.ts @@ -16,6 +16,7 @@ */ import { NgModule } from '@angular/core'; +import { AutoFocusModule } from 'primeng/autofocus'; import { RecordModule } from '@rero/ng-core'; import { SharedModule } from '@rero/shared'; @@ -57,6 +58,7 @@ import { MigrationDetailComponent } from './record/brief-view/migration/migratio InplaceModule, ToastModule, PaginationModule, + AutoFocusModule ], exports: [], providers: [MessageService],