LP#1779158 Bib trash groups; show error detail
authorBill Erickson <berickxx@gmail.com>
Mon, 16 Jul 2018 15:01:16 +0000 (11:01 -0400)
committerBill Erickson <berickxx@gmail.com>
Thu, 11 Oct 2018 18:56:30 +0000 (14:56 -0400)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/eg2/src/app/staff/cat/vandelay/export.component.ts
Open-ILS/src/eg2/src/app/staff/cat/vandelay/import.component.html
Open-ILS/src/eg2/src/app/staff/cat/vandelay/import.component.ts
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 d7e4d07..253cfcb 100644 (file)
@@ -48,11 +48,14 @@ export class ExportComponent implements AfterViewInit {
     sourceChange($event: NgbPanelChangeEvent) {
         this.recordSource = $event.panelId;
 
-        // Give the tab a chance to change before focusing.
-        setTimeout(() => 
-            this.renderer.selectRootElement(
-                '#' + this.recordSource + '-input').focus()
-        )
+        if ($event.nextState) { // panel opened
+
+            // give the panel a chance to render before focusing input
+            setTimeout(() => {
+                this.renderer.selectRootElement(
+                    `#${this.recordSource}-input`).focus();
+            })
+        }
     }
 
     fileSelected($event) {
index 2d4b150..58f875b 100644 (file)
       <input #fileSelector (change)="fileSelected($event)" 
         required class="form-control" type="file"/>
     </div>
+    <div class="col-lg-3" *ngIf="bibTrashGroups.length">
+      <label i18n>Remove MARC Field Groups</label>
+    </div>
+    <div class="col-lg-3" *ngIf="bibTrashGroups.length">
+      <select multiple [(ngModel)]="selectedTrashGroups" 
+        class="form-control" size="3">
+        <option *ngFor="let grp of bibTrashGroups" 
+          value="{{grp.id()}}">{{grp.label()}}</option>
+      </select>
+    </div>
   </div>
   <div class="row" *ngIf="importSelection()">
     <div class="col-lg-3">
index 6689e1a..925b28d 100644 (file)
@@ -23,7 +23,7 @@ interface ImportOptions {
     opp_acq_copy_overlay?: boolean;
     merge_profile?: any;
     fall_through_merge_profile?: any;
-    strip_field_groups?: any;
+    strip_field_groups?: number[];
 }
 
 @Component({
@@ -38,6 +38,9 @@ export class ImportComponent implements OnInit, AfterViewInit, OnDestroy {
     // a load-time queue before the queue combobox entries exist.
     startQueueId: number; 
 
+    bibTrashGroups: IdlObject[];
+    selectedTrashGroups: number[];
+
     activeQueueId: number;
     selectedBucket: number;
     selectedBibSource: number;
@@ -93,6 +96,7 @@ export class ImportComponent implements OnInit, AfterViewInit, OnDestroy {
         this.minQualityRatio = 0;
         this.selectedBibSource = 1; // default to system local
         this.recordType = 'bib';
+        this.bibTrashGroups = [];
 
         if (this.vandelay.importSelection) {
 
@@ -149,6 +153,8 @@ export class ImportComponent implements OnInit, AfterViewInit, OnDestroy {
             this.vandelay.getBibBuckets(),
             this.vandelay.getBibSources(),
             this.vandelay.getItemImportDefs(),
+            this.vandelay.getBibTrashGroups().then(
+                groups => this.bibTrashGroups = groups),
             this.org.settings(['vandelay.default_match_set']).then(
                 s => this.defaultMatchSet = s['vandelay.default_match_set'])
         ];
@@ -433,7 +439,7 @@ export class ImportComponent implements OnInit, AfterViewInit, OnDestroy {
             opp_acq_copy_overlay: this.autoOverlayAcqCopies,
             merge_profile: this.selectedMergeProfile,
             fall_through_merge_profile: this.selectedFallThruMergeProfile,
-            strip_field_groups: null // TODO
+            strip_field_groups: this.selectedTrashGroups
         };
 
         if (this.vandelay.importSelection) {
index 6136b13..728b3ed 100644 (file)
@@ -99,8 +99,7 @@
 </ng-template>
 
 <ng-template #errorsTmpl let-row="row">
-  <!-- TODO formatting / css -->
-  <b>{{row.import_error}}</b>
+  <b class="text-danger" title="{{row.error_detail}}">{{row.import_error}}</b>
 </ng-template>
 
 <ng-template #importedAsTmpl let-row="row">
index 9d0ccb1..f6571f5 100644 (file)
@@ -160,6 +160,7 @@ export class QueueComponent implements OnInit, AfterViewInit {
             const recHash: any = {
                 id: rec.id(),
                 import_error: rec.import_error(),
+                error_detail: rec.error_detail(),
                 import_time: rec.import_time(),
                 imported_as: rec.imported_as(),
                 matches: rec.matches()