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