1 import {Component, OnInit, ViewChild} from '@angular/core';
2 import {Observable} from 'rxjs';
3 import {map} from 'rxjs/operators';
4 import {Router, ActivatedRoute, ParamMap} from '@angular/router';
5 import {Pager} from '@eg/share/util/pager';
6 import {IdlObject} from '@eg/core/idl.service';
7 import {NetService} from '@eg/core/net.service';
8 import {AuthService} from '@eg/core/auth.service';
9 import {GridComponent} from '@eg/share/grid/grid.component';
10 import {GridDataSource} from '@eg/share/grid/grid';
11 import {VandelayService} from './vandelay.service';
14 templateUrl: 'queue-items.component.html'
16 export class QueueItemsComponent {
20 filterImportErrors: boolean;
21 limitToImportErrors: (checked: boolean) => void;
23 gridSource: GridDataSource;
24 @ViewChild('itemsGrid') itemsGrid: GridComponent;
27 private router: Router,
28 private route: ActivatedRoute,
29 private net: NetService,
30 private auth: AuthService,
31 private vandelay: VandelayService) {
33 this.route.paramMap.subscribe((params: ParamMap) => {
34 this.queueId = +params.get('id');
35 this.queueType = params.get('qtype');
38 this.gridSource = new GridDataSource();
40 // queue API does not support sorting
41 this.gridSource.getRows = (pager: Pager) => {
42 return this.net.request(
44 'open-ils.vandelay.import_item.queue.retrieve',
45 this.auth.token(), this.queueId, {
46 with_import_error: this.filterImportErrors,
53 this.limitToImportErrors = (checked: boolean) => {
54 this.filterImportErrors = checked;
55 this.itemsGrid.reload();