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;
22 gridSource: GridDataSource;
23 @ViewChild('itemsGrid') itemsGrid: GridComponent;
26 private router: Router,
27 private route: ActivatedRoute,
28 private net: NetService,
29 private auth: AuthService,
30 private vandelay: VandelayService) {
32 this.route.paramMap.subscribe((params: ParamMap) => {
33 this.queueId = +params.get('id');
34 this.queueType = params.get('qtype');
37 this.gridSource = new GridDataSource();
39 // queue API does not support sorting
40 this.gridSource.getRows = (pager: Pager) => {
41 return this.net.request(
43 'open-ils.vandelay.import_item.queue.retrieve',
44 this.auth.token(), this.queueId, {
45 with_import_error: this.filterImportErrors,
53 limitToImportErrors(checked: boolean) {
54 this.filterImportErrors = checked;
55 this.itemsGrid.reload();