1 import {Component, ViewChild} from '@angular/core';
2 import {Router, ActivatedRoute, ParamMap} from '@angular/router';
3 import {Pager} from '@eg/share/util/pager';
4 import {NetService} from '@eg/core/net.service';
5 import {AuthService} from '@eg/core/auth.service';
6 import {GridComponent} from '@eg/share/grid/grid.component';
7 import {GridDataSource} from '@eg/share/grid/grid';
8 import {VandelayService} from './vandelay.service';
11 templateUrl: 'queue-items.component.html'
13 export class QueueItemsComponent {
17 filterImportErrors: boolean;
19 gridSource: GridDataSource;
20 @ViewChild('itemsGrid', { static: true }) itemsGrid: GridComponent;
23 private router: Router,
24 private route: ActivatedRoute,
25 private net: NetService,
26 private auth: AuthService,
27 private vandelay: VandelayService) {
29 this.route.paramMap.subscribe((params: ParamMap) => {
30 this.queueId = +params.get('id');
31 this.queueType = params.get('qtype');
34 this.gridSource = new GridDataSource();
36 // queue API does not support sorting
37 this.gridSource.getRows = (pager: Pager) => {
38 return this.net.request(
40 'open-ils.vandelay.import_item.queue.retrieve',
41 this.auth.token(), this.queueId, {
42 with_import_error: this.filterImportErrors,
50 limitToImportErrors(checked: boolean) {
51 this.filterImportErrors = checked;
52 this.itemsGrid.reload();