LP#1779158 Import item views
authorBill Erickson <berickxx@gmail.com>
Mon, 16 Jul 2018 20:26:49 +0000 (16:26 -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/queue-items.component.html [new file with mode: 0644]
Open-ILS/src/eg2/src/app/staff/cat/vandelay/queue-items.component.ts [new file with mode: 0644]
Open-ILS/src/eg2/src/app/staff/cat/vandelay/queue.component.html
Open-ILS/src/eg2/src/app/staff/cat/vandelay/queue.component.ts
Open-ILS/src/eg2/src/app/staff/cat/vandelay/queued-record.component.html
Open-ILS/src/eg2/src/app/staff/cat/vandelay/record-items.component.html [new file with mode: 0644]
Open-ILS/src/eg2/src/app/staff/cat/vandelay/record-items.component.ts [new file with mode: 0644]
Open-ILS/src/eg2/src/app/staff/cat/vandelay/routing.module.ts
Open-ILS/src/eg2/src/app/staff/cat/vandelay/vandelay.module.ts

diff --git a/Open-ILS/src/eg2/src/app/staff/cat/vandelay/queue-items.component.html b/Open-ILS/src/eg2/src/app/staff/cat/vandelay/queue-items.component.html
new file mode 100644 (file)
index 0000000..8bc896f
--- /dev/null
@@ -0,0 +1,19 @@
+<div class="row mb-3">
+  <div class="col-lg-2">
+    <button class="btn btn-info label-with-material-icon"
+      routerLink="/staff/cat/vandelay/queue/{{queueType}}/{{queueId}}">
+      <span class="material-icons">arrow_back</span>
+      <span i18n>Return to Queue</span>
+    </button>
+  </div>
+</div>
+
+<eg-grid #itemsGrid 
+  showFields="record,import_error,imported_as,import_time,owning_lib,call_number,barcode"
+  persistKey="cat.vandelay.queue.items"
+  idlClass="vii" [dataSource]="gridSource">
+  <eg-grid-toolbar-checkbox [onChange]="limitToImportErrors"
+    i18n-label label="Limit to Import Failures"></eg-grid-toolbar-checkbox>
+
+</eg-grid>
+
diff --git a/Open-ILS/src/eg2/src/app/staff/cat/vandelay/queue-items.component.ts b/Open-ILS/src/eg2/src/app/staff/cat/vandelay/queue-items.component.ts
new file mode 100644 (file)
index 0000000..d72a81b
--- /dev/null
@@ -0,0 +1,60 @@
+import {Component, OnInit, ViewChild} from '@angular/core';
+import {Observable} from 'rxjs/Observable';
+import 'rxjs/add/observable/of';
+import {map} from 'rxjs/operators/map';
+import {Router, ActivatedRoute, ParamMap} from '@angular/router';              
+import {Pager} from '@eg/share/util/pager';                                    
+import {IdlObject} from '@eg/core/idl.service';
+import {NetService} from '@eg/core/net.service';
+import {AuthService} from '@eg/core/auth.service';
+import {GridComponent} from '@eg/share/grid/grid.component';
+import {GridDataSource} from '@eg/share/grid/grid';
+import {VandelayService} from './vandelay.service';
+
+@Component({
+  templateUrl: 'queue-items.component.html'
+})
+export class QueueItemsComponent {
+
+    queueType: string;
+    queueId: number;
+    filterImportErrors: boolean;
+    limitToImportErrors: (checked: boolean) => void;
+
+    gridSource: GridDataSource;
+    @ViewChild('itemsGrid') itemsGrid: GridComponent;
+
+    constructor(
+        private router: Router,
+        private route: ActivatedRoute,
+        private net: NetService,
+        private auth: AuthService,
+        private vandelay: VandelayService) {
+
+        this.route.paramMap.subscribe((params: ParamMap) => {                  
+            this.queueId = +params.get('id');
+            this.queueType = params.get('qtype');
+        });
+
+        this.gridSource = new GridDataSource();
+
+        // queue API does not support sorting
+        this.gridSource.getRows = (pager: Pager) => {
+            return this.net.request(
+                'open-ils.vandelay',
+                'open-ils.vandelay.import_item.queue.retrieve',
+                this.auth.token(), this.queueId, {
+                    with_import_error: this.filterImportErrors,
+                    offset: pager.offset,
+                    limit: pager.limit
+                }
+            );
+        };
+
+        this.limitToImportErrors = (checked: boolean) => {
+            this.filterImportErrors = checked;
+            this.itemsGrid.reload();
+        }
+    }
+}
+
index 728b3ed..bd99107 100644 (file)
           <li class="list-group-item">
             <div class="d-flex">
               <div class="flex-1">
-                <a i18n>View Import Items</a>
+                <a i18n
+                  routerLink="/staff/cat/vandelay/queue/{{queueType}}/{{queueId}}/items">
+                    View Import Items
+                </a>
               </div>
               <div class="flex-1">
                 <a [routerLink]="" (click)="exportNonImported()" 
 </ng-template>
 
 <ng-template #errorsTmpl let-row="row">
-  <b class="text-danger" title="{{row.error_detail}}">{{row.import_error}}</b>
+  <div *ngIf="row.error_detail">
+    <b class="text-danger" title="{{row.error_detail}}">{{row.import_error}}</b>
+  </div>
+  <div *ngIf="row.error_items.length">
+    <b class="text-danger">Items ({{row.error_items.length}})</b>
+  </div>
 </ng-template>
 
 <ng-template #importedAsTmpl let-row="row">
index f6571f5..e8b3747 100644 (file)
@@ -163,6 +163,8 @@ export class QueueComponent implements OnInit, AfterViewInit {
                 error_detail: rec.error_detail(),
                 import_time: rec.import_time(),
                 imported_as: rec.imported_as(),
+                import_items: rec.import_items(),
+                error_items: rec.import_items().filter(i => i.import_error()),
                 matches: rec.matches()
             };
 
index a9a0d20..d9e8534 100644 (file)
       </eg-queued-record-matches>
                </ng-template>
        </ngb-tab>
+       <ngb-tab title="Import Items" i18n-title id="items">
+               <ng-template ngbTabContent>
+      <eg-queued-record-items [recordId]="recordId">
+      </eg-queued-record-items>
+               </ng-template>
+       </ngb-tab>
 </ngb-tabset>
diff --git a/Open-ILS/src/eg2/src/app/staff/cat/vandelay/record-items.component.html b/Open-ILS/src/eg2/src/app/staff/cat/vandelay/record-items.component.html
new file mode 100644 (file)
index 0000000..012a579
--- /dev/null
@@ -0,0 +1,6 @@
+<eg-grid #itemsGrid 
+  showFields="record,import_error,imported_as,import_time,owning_lib,call_number,barcode"
+  persistKey="cat.vandelay.queue.bib.items"
+  idlClass="vii" [dataSource]="gridSource">
+</eg-grid>
+
diff --git a/Open-ILS/src/eg2/src/app/staff/cat/vandelay/record-items.component.ts b/Open-ILS/src/eg2/src/app/staff/cat/vandelay/record-items.component.ts
new file mode 100644 (file)
index 0000000..37383a8
--- /dev/null
@@ -0,0 +1,37 @@
+import {Component, Input, ViewChild} from '@angular/core';
+import {Pager} from '@eg/share/util/pager';                                    
+import {IdlObject} from '@eg/core/idl.service';
+import {NetService} from '@eg/core/net.service';
+import {PcrudService} from '@eg/core/pcrud.service';
+import {AuthService} from '@eg/core/auth.service';
+import {GridComponent} from '@eg/share/grid/grid.component';
+import {GridDataSource} from '@eg/share/grid/grid';
+import {VandelayService} from './vandelay.service';
+
+@Component({
+  selector: 'eg-queued-record-items',
+  templateUrl: 'record-items.component.html'
+})
+export class RecordItemsComponent {
+
+    @Input() recordId: number;
+
+    gridSource: GridDataSource;
+    @ViewChild('itemsGrid') itemsGrid: GridComponent;
+
+    constructor(
+        private net: NetService,
+        private auth: AuthService,
+        private pcrud: PcrudService,
+        private vandelay: VandelayService) {
+
+        this.gridSource = new GridDataSource();
+
+        // queue API does not support sorting
+        this.gridSource.getRows = (pager: Pager) => {
+            return this.pcrud.search('vii', 
+                {record: this.recordId}, {order_by: {vii: ['id']})
+        };
+    }
+}
+
index f6ce368..3378f86 100644 (file)
@@ -9,6 +9,7 @@ import {QueuedRecordComponent} from './queued-record.component';
 import {DisplayAttrsComponent} from './display-attrs.component';
 import {MergeProfilesComponent} from './merge-profiles.component';
 import {HoldingsProfilesComponent} from './holdings-profiles.component';
+import {QueueItemsComponent} from './queue-items.component';
 
 const routes: Routes = [{
   path: '',
@@ -36,6 +37,9 @@ const routes: Routes = [{
     path: 'queue/:qtype/:id/record/:recordId/:recordTab',
     component: QueuedRecordComponent
   }, {
+    path: 'queue/:qtype/:id/items',
+    component: QueueItemsComponent
+  }, {
     path: 'display_attrs',
     component: DisplayAttrsComponent
   }, {
index a826578..9f0e8db 100644 (file)
@@ -14,6 +14,8 @@ import {QueuedRecordMatchesComponent} from './queued-record-matches.component';
 import {DisplayAttrsComponent} from './display-attrs.component';
 import {MergeProfilesComponent} from './merge-profiles.component';
 import {HoldingsProfilesComponent} from './holdings-profiles.component';
+import {QueueItemsComponent} from './queue-items.component';
+import {RecordItemsComponent} from './record-items.component';
 
 @NgModule({
   declarations: [
@@ -26,7 +28,9 @@ import {HoldingsProfilesComponent} from './holdings-profiles.component';
     QueuedRecordMatchesComponent,
     DisplayAttrsComponent,
     MergeProfilesComponent,
-    HoldingsProfilesComponent
+    HoldingsProfilesComponent,
+    QueueItemsComponent,
+    RecordItemsComponent
   ],
   imports: [
     StaffCommonModule,