"schema-utils": "^1.0.0"
}
},
+ "file-saver": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/file-saver/-/file-saver-2.0.0.tgz",
+ "integrity": "sha512-cYM1ic5DAkg25pHKgi5f10ziAM7RJU37gaH1XQlyNDrtUnzhC/dfoV9zf2OmF0RMKi42jG5B0JWBnPQqyj/G6g=="
+ },
"filename-regex": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/filename-regex/-/filename-regex-2.0.1.tgz",
"@nguniversal/express-engine": "^7.1.0",
"bootstrap-css-only": "^4.2.1",
"core-js": "^2.6.3",
+ "file-saver": "^2.0.0",
"ngx-cookie": "^4.1.2",
"rxjs": "^6.4.0",
"zone.js": "^0.8.29"
import {Component, OnInit, ViewChild} from '@angular/core';
-import {Router, ActivatedRoute, ParamMap} from '@angular/router';
+import {Router, ActivatedRoute, ParamMap} from '@angular/router';
import {NgbTabset, NgbTabChangeEvent} from '@ng-bootstrap/ng-bootstrap';
@Component({
private router: Router,
private route: ActivatedRoute) {
- this.route.paramMap.subscribe((params: ParamMap) => {
+ this.route.paramMap.subscribe((params: ParamMap) => {
this.attrType = params.get('atype');
});
}
// prevent tab changing until after route navigation
evt.preventDefault();
- const url =
+ const url =
`/staff/cat/vandelay/display_attrs/${this.attrType}`;
this.router.navigate([url]);
import {NgbPanelChangeEvent} from '@ng-bootstrap/ng-bootstrap';
import {HttpClient, HttpRequest, HttpEventType} from '@angular/common/http';
import {HttpResponse, HttpErrorResponse} from '@angular/common/http';
-import {saveAs} from 'file-saver/FileSaver';
+import {saveAs} from 'file-saver';
import {AuthService} from '@eg/core/auth.service';
import {ToastService} from '@eg/share/toast/toast.service';
import {ProgressInlineComponent} from '@eg/share/dialog/progress-inline.component';
isExporting: boolean;
@ViewChild('fileSelector') private fileSelector;
- @ViewChild('exportProgress')
+ @ViewChild('exportProgress')
private exportProgress: ProgressInlineComponent;
constructor(
setTimeout(() => {
this.renderer.selectRootElement(
`#${this.recordSource}-input`).focus();
- })
+ });
}
}
fileSelected($event) {
- this.selectedFile = $event.target.files[0];
+ this.selectedFile = $event.target.files[0];
}
hasNeededData(): boolean {
switch (this.recordSource) {
case 'csv':
- formData.append('idcolumn', ''+this.fieldNumber);
- formData.append('idfile',
+ formData.append('idcolumn', '' + this.fieldNumber);
+ formData.append('idfile',
this.selectedFile, this.selectedFile.name);
break;
case 'record-id':
- formData.append('id', ''+this.recordId);
+ formData.append('id', '' + this.recordId);
break;
case 'bucket-id':
- formData.append('containerid', ''+this.bucketId);
+ formData.append('containerid', '' + this.bucketId);
break;
}
-
+
this.sendExportRequest(formData);
}
const fileName = `export.${this.recordType}.` +
`${this.recordEncoding}.${this.recordFormat}`;
- const req = new HttpRequest('POST', VANDELAY_EXPORT_PATH,
+ const req = new HttpRequest('POST', VANDELAY_EXPORT_PATH,
formData, {reportProgress: true, responseType: 'text'});
this.http.request(req).subscribe(
evt => {
- console.log(evt);
+ console.debug(evt);
if (evt.type === HttpEventType.DownloadProgress) {
// File size not reported by server in advance.
this.exportProgress.update({value: evt.loaded});
} else if (evt instanceof HttpResponse) {
- saveAs(new Blob([evt.body],
+ saveAs(new Blob([evt.body as Blob],
{type: 'application/octet-stream'}), fileName);
this.isExporting = false;
-import {Component, OnInit, AfterViewInit, Input, ViewChild, OnDestroy} from '@angular/core';
-import {tap} from 'rxjs/operators/tap';
+import {Component, OnInit, AfterViewInit, Input,
+ ViewChild, OnDestroy} from '@angular/core';
+import {Subject} from 'rxjs';
+import {tap} from 'rxjs/operators';
import {IdlObject} from '@eg/core/idl.service';
import {NetService} from '@eg/core/net.service';
import {EventService} from '@eg/core/event.service';
import {OrgService} from '@eg/core/org.service';
import {AuthService} from '@eg/core/auth.service';
import {ToastService} from '@eg/share/toast/toast.service';
-import {ComboboxComponent,
+import {ComboboxComponent,
ComboboxEntry} from '@eg/share/combobox/combobox.component';
import {VandelayService, VandelayImportSelection,
VANDELAY_UPLOAD_PATH} from './vandelay.service';
import {HttpResponse, HttpErrorResponse} from '@angular/common/http';
import {ProgressInlineComponent} from '@eg/share/dialog/progress-inline.component';
import {AlertDialogComponent} from '@eg/share/dialog/alert.component';
-import {Subject} from 'rxjs/Subject';
import {ServerStoreService} from '@eg/core/server-store.service';
const TEMPLATE_SETTING_NAME = 'eg.cat.vandelay.import.templates';
merge_profile?: any;
fall_through_merge_profile?: any;
strip_field_groups?: number[];
- match_quality_ratio: number,
+ match_quality_ratio: number;
exit_early: boolean;
}
// used for applying a default queue ID value when we have
// a load-time queue before the queue combobox entries exist.
- startQueueId: number;
+ startQueueId: number;
bibTrashGroups: IdlObject[];
selectedTrashGroups: number[];
newTemplateName: string;
@ViewChild('fileSelector') private fileSelector;
- @ViewChild('uploadProgress')
+ @ViewChild('uploadProgress')
private uploadProgress: ProgressInlineComponent;
- @ViewChild('enqueueProgress')
+ @ViewChild('enqueueProgress')
private enqueueProgress: ProgressInlineComponent;
- @ViewChild('importProgress')
+ @ViewChild('importProgress')
private importProgress: ProgressInlineComponent;
// Need these refs so values can be applied via external stimuli
- @ViewChild('formTemplateSelector')
+ @ViewChild('formTemplateSelector')
private formTemplateSelector: ComboboxComponent;
@ViewChild('recordTypeSelector')
private recordTypeSelector: ComboboxComponent;
switch (etype) {
case 'bibSources':
return (this.vandelay.bibSources || []).map(
- s => { return {id: s.id(), label: s.source()}; });
+ s => {
+ return {id: s.id(), label: s.source()};
+ });
case 'bibBuckets':
list = this.vandelay.bibBuckets;
switch (etype) {
case 'recordType':
this.recordType = id;
-
+ break;
+
case 'bibSources':
this.selectedBibSource = id;
break;
}
fileSelected($event) {
- this.selectedFile = $event.target.files[0];
+ this.selectedFile = $event.target.files[0];
}
// Required form data varies depending on context.
if (this.vandelay.importSelection) {
return this.importActionSelected();
} else {
- return this.selectedQueue
- && Boolean(this.recordType) && Boolean(this.selectedFile)
+ return this.selectedQueue &&
+ Boolean(this.recordType) && Boolean(this.selectedFile);
}
}
} else {
alert(evt); // server error
}
- }
+ }
return Promise.reject('Queue Create Failed');
}
// Nothing to upload when processing pre-queued records.
return Promise.resolve();
}
-
+
const formData: FormData = new FormData();
formData.append('ses', this.auth.token());
- formData.append('marc_upload',
+ formData.append('marc_upload',
this.selectedFile, this.selectedFile.name);
if (this.selectedBibSource) {
- formData.append('bib_source', ''+this.selectedBibSource);
+ formData.append('bib_source', '' + this.selectedBibSource);
}
- const req = new HttpRequest('POST', VANDELAY_UPLOAD_PATH, formData,
+ const req = new HttpRequest('POST', VANDELAY_UPLOAD_PATH, formData,
{reportProgress: true, responseType: 'text'});
return this.http.request(req).pipe(tap(
} else if (evt instanceof HttpResponse) {
this.sessionKey = evt.body as string;
console.log(
- 'Vandelay file uploaded OK with key '+this.sessionKey);
+ 'Vandelay file uploaded OK with key ' + this.sessionKey);
}
},
// Nothing to enqueue when processing pre-queued records
return Promise.resolve();
}
- var spoolType = this.recordType;
- if (this.recordType == 'authority') spoolType = 'auth'
+
+ let spoolType = this.recordType;
+ if (this.recordType === 'authority') {
+ spoolType = 'auth';
+ }
const method = `open-ils.vandelay.${spoolType}.process_spool`;
return new Promise((resolve, reject) => {
this.net.request(
- 'open-ils.vandelay', method,
+ 'open-ils.vandelay', method,
this.auth.token(), this.sessionKey, this.activeQueueId,
- null, null, this.selectedBibSource,
+ null, null, this.selectedBibSource,
(this.sessionName || null), true
).subscribe(
tracker => {
trkr => {
this.enqueueProgress.update({
// enqueue API only tracks actions performed
- max: null,
+ max: null,
value: trkr.actions_performed()
});
},
}
return new Promise((resolve, reject) => {
- this.net.request('open-ils.vandelay',
+ this.net.request('open-ils.vandelay',
method, this.auth.token(), target, options)
.subscribe(
tracker => {
const template = {};
TEMPLATE_ATTRS.forEach(key => template[key] = this[key]);
- console.debug("Saving import profile", template);
+ console.debug('Saving import profile', template);
this.formTemplates[this.selectedTemplate] = template;
return this.store.setItem(TEMPLATE_SETTING_NAME, this.formTemplates);
}
markTemplateDefault() {
-
+
Object.keys(this.formTemplates).forEach(
name => delete this.formTemplates.default
);
if (!this.matchSet_) { return Promise.resolve(); }
return this.pcrud.search('vmsp',
- {match_set: this.matchSet_.id()}, {},
+ {match_set: this.matchSet_.id()}, {},
{atomic: true, authoritative: true}
).toPromise().then(points => this.ingestMatchPoints(points));
}
getPointLabel(point: IdlObject, showmatch?: boolean): Promise<string> {
return this.strings.interpolate(
- 'staff.cat.vandelay.matchpoint.label',
+ 'staff.cat.vandelay.matchpoint.label',
{point: point, showmatch: showmatch}
);
}
deleteNode() {
this.changesMade = true;
- const node = this.tree.selectedNode()
+ const node = this.tree.selectedNode();
this.tree.removeNode(node);
}
} else {
- if (ptype == 'attr') {
+ if (ptype === 'attr') {
point.svf(this.newPoint.values.recordAttr);
- } else if (ptype == 'marc') {
+ } else if (ptype === 'marc') {
point.tag(this.newPoint.values.marcTag);
point.subfield(this.newPoint.values.marcSf);
- } else if (ptype == 'heading') {
+ } else if (ptype === 'heading') {
point.heading(true);
}
}
const node: TreeNode = new TreeNode({
- id: point.id(),
+ id: point.id(),
callerData: {point: point}
});
if (node.children.length) {
return '(' + node.children.map(renderNode).join(
- ' ' + node.callerData.slimLabel + ' ') + ')'
+ ' ' + node.callerData.slimLabel + ' ') + ')';
} else if (!node.callerData.point.bool_op()) {
return node.callerData.slimLabel;
} else {
return '()';
}
- }
+ };
return renderNode(this.tree.rootNode);
}
'open-ils.vandelay.match_set.update',
this.auth.token(), this.matchSet_.id(), rootPoint
).toPromise().then(
- ok =>this.refreshTree(),
+ ok => this.refreshTree(),
err => console.error(err)
);
}
import {Component, AfterViewInit, ViewChild} from '@angular/core';
-import {Router} from '@angular/router';
-import {Pager} from '@eg/share/util/pager';
+import {Router} from '@angular/router';
+import {Pager} from '@eg/share/util/pager';
import {IdlObject} from '@eg/core/idl.service';
import {PcrudService} from '@eg/core/pcrud.service';
import {OrgService} from '@eg/core/org.service';
this.gridSource.getRows = (pager: Pager) => {
const orgs = this.org.ancestors(this.contextOrg, true);
- return this.pcrud.search('vms', {owner: orgs}, {
+ return this.pcrud.search('vms', {owner: orgs}, {
order_by: {vms: ['name']},
limit: pager.limit,
offset: pager.offset
});
- }
+ };
this.createNew = () => {
this.editDialog.mode = 'create';
@Input() isForQuality: boolean;
// biblio, authority, quality
- @Input() set pointType(type_: string) {
+ @Input() set pointType(type_: string) {
this.values.pointType = type_;
this.values.recordAttr = '';
this.values.matchScore = 1;
import {Component, OnInit, ViewChild, AfterViewInit, Input} from '@angular/core';
-import {Observable} from 'rxjs/Observable';
-import 'rxjs/add/observable/of';
+import {Observable, of} from 'rxjs';
import {IdlObject, IdlService} from '@eg/core/idl.service';
import {PcrudService} from '@eg/core/pcrud.service';
import {NetService} from '@eg/core/net.service';
matchSet_: IdlObject;
@Input() set matchSet(ms: IdlObject) {
this.matchSet_ = ms;
- if (ms) {
- this.matchSetType = ms.mtype();
+ if (ms) {
+ this.matchSetType = ms.mtype();
if (this.grid) {
this.grid.reload();
}
this.dataSource.getRows = (pager: Pager, sort: any[]) => {
if (!this.matchSet_) {
- return Observable.of();
+ return of();
}
const orderBy: any = {};
const search = {match_set: this.matchSet_.id()};
return this.pcrud.search('vmsq', search, searchOps);
- }
+ };
this.deleteSelected = (rows: any[]) => {
this.pcrud.remove(rows).subscribe(
ngOnInit() {}
addQuality() {
- const quality = this.idl.create('vmsq');
+ const quality = this.idl.create('vmsq');
const values = this.newPoint.values;
quality.match_set(this.matchSet_.id());
import {Component, OnInit, ViewChild} from '@angular/core';
-import {Router, ActivatedRoute, ParamMap} from '@angular/router';
+import {Router, ActivatedRoute, ParamMap} from '@angular/router';
import {NgbTabset, NgbTabChangeEvent} from '@ng-bootstrap/ng-bootstrap';
import {IdlObject} from '@eg/core/idl.service';
import {PcrudService} from '@eg/core/pcrud.service';
private pcrud: PcrudService,
private org: OrgService
) {
- this.route.paramMap.subscribe((params: ParamMap) => {
+ this.route.paramMap.subscribe((params: ParamMap) => {
this.matchSetId = +params.get('id');
this.matchSetTab = params.get('matchSetTab');
});
// prevent tab changing until after route navigation
evt.preventDefault();
- const url =
+ const url =
`/staff/cat/vandelay/match_sets/${this.matchSetId}/${this.matchSetTab}`;
this.router.navigate([url]);
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 {Observable} from 'rxjs';
+import {map} from 'rxjs/operators';
+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';
private auth: AuthService,
private vandelay: VandelayService) {
- this.route.paramMap.subscribe((params: ParamMap) => {
+ this.route.paramMap.subscribe((params: ParamMap) => {
this.queueId = +params.get('id');
this.queueType = params.get('qtype');
});
this.limitToImportErrors = (checked: boolean) => {
this.filterImportErrors = checked;
this.itemsGrid.reload();
- }
+ };
}
}
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 {Observable, of} from 'rxjs';
+import {map} from 'rxjs/operators';
+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';
// queue API does not support sorting
this.queueSource.getRows = (pager: Pager) => {
return this.loadQueues(pager);
- }
+ };
this.deleteSelected = (queues: IdlObject[]) => {
// because they can be bulky calls
const qtype = this.queueType;
const method = `open-ils.vandelay.${qtype}_queue.delete`;
+ const selected = queues.slice(0); // clone to be nice
- const deleteNext = (queues: IdlObject[], idx: number) => {
- const queue = queues[idx];
- if (!queue) {
+ const deleteNext = (idx: number) => {
+ const queue = selected[idx];
+ if (!queue) {
this.currentGrid().reload();
- return Promise.resolve();
+ return Promise.resolve();
}
-
- return this.net.request('open-ils.vandelay',
+
+ return this.net.request('open-ils.vandelay',
method, this.auth.token(), queue.id()
- ).toPromise().then(() => deleteNext(queues, ++idx));
- }
+ ).toPromise().then(() => deleteNext(++idx));
+ };
- deleteNext(queues, 0);
+ deleteNext(0);
};
}
currentGrid(): GridComponent {
- // The active grid changes along with the queue type.
+ // The active grid changes along with the queue type.
// The inactive grid will be set to null.
return this.bibQueueGrid || this.authQueueGrid;
}
loadQueues(pager: Pager): Observable<any> {
if (!this.queueType) {
- return Observable.of();
+ return of();
}
const qtype = this.queueType.match(/bib/) ? 'bib' : 'authority';
const method = `open-ils.vandelay.${qtype}_queue.owner.retrieve`;
- return this.net.request('open-ils.vandelay',
+ return this.net.request('open-ils.vandelay',
method, this.auth.token(), null, null,
{offset: pager.offset, limit: pager.limit}
);
import {Component, OnInit, AfterViewInit, ViewChild} from '@angular/core';
-import {Observable} from 'rxjs/Observable';
-import 'rxjs/add/observable/of';
-import {map} from 'rxjs/operators/map';
-import {filter} from 'rxjs/operators/filter';
-import {Router, ActivatedRoute, ParamMap} from '@angular/router';
-import {Pager} from '@eg/share/util/pager';
+import {Observable} from 'rxjs';
+import {map, filter} from 'rxjs/operators';
+import {Router, ActivatedRoute, ParamMap} from '@angular/router';
+import {Pager} from '@eg/share/util/pager';
import {IdlObject} from '@eg/core/idl.service';
import {EventService} from '@eg/core/event.service';
import {NetService} from '@eg/core/net.service';
private auth: AuthService,
private vandelay: VandelayService) {
- this.route.paramMap.subscribe((params: ParamMap) => {
+ this.route.paramMap.subscribe((params: ParamMap) => {
this.queueType = params.get('qtype');
this.queueId = +params.get('id');
});
}
ngAfterViewInit() {
- if (this.queueType) {
- this.applyQueueType();
+ if (this.queueType) {
+ this.applyQueueType();
if (this.queueId) {
this.loadQueueSummary();
}
}
openRecord(row: any) {
- if (this.queueType == 'auth') {
+ if (this.queueType === 'auth') {
this.queueType = 'authority';
}
- const url =
+ const url =
`/staff/cat/vandelay/queue/${this.queueType}/${this.queueId}/record/${row.id}/marc`;
this.router.navigate([url]);
}
}
qtypeShort(): string {
- return this.queueType === 'bib' ? 'bib' : 'auth';
+ return this.queueType === 'bib' ? 'bib' : 'auth';
}
loadQueueSummary(): Promise<any> {
- const method =
+ const method =
`open-ils.vandelay.${this.qtypeShort()}_queue.summary.retrieve`;
return this.net.request(
const options = {
clear_marc: true,
offset: pager.offset,
- limit: pager.limit,
+ limit: pager.limit,
flesh_import_items: true,
non_imported: this.filters.nonImported,
with_import_error: this.filters.withErrors
- }
+ };
return this.vandelay.getQueuedRecords(
this.queueId, this.queueType, options, this.filters.matches).pipe(
const e = this.evt.parse(rec);
if (e) { console.error(e); return false; }
return true;
- }),
+ }),
map(rec => {
const recHash: any = {
id: rec.id(),
recHash.error_items = rec.import_items().filter(i => i.import_error());
}
- // Link the record attribute values to the root record
+ // Link the record attribute values to the root record
// object so the grid can find them.
rec.attributes().forEach(attr => {
- const def =
+ const def =
this.attrDefs.filter(d => d.id() === attr.field())[0];
recHash[def.code()] = attr.attr_value();
});
import {Component, Input, OnInit, ViewChild} from '@angular/core';
-import {Router, ActivatedRoute, ParamMap} from '@angular/router';
-import {Observable} from 'rxjs/Observable';
-import 'rxjs/add/observable/of';
-import {map} from 'rxjs/operators/map';
+import {Router, ActivatedRoute, ParamMap} from '@angular/router';
+import {Observable, of} from 'rxjs';
+import {map} from 'rxjs/operators';
import {Pager} from '@eg/share/util/pager';
import {GridComponent} from '@eg/share/grid/grid.component';
import {GridDataSource, GridColumn} from '@eg/share/grid/grid';
this.bibDataSource.getRows = (pager: Pager) => {
return this.getBibMatchRows(pager);
- }
+ };
/* TODO
this.authDataSource.getRows = (pager: Pager) => {
// Mark or un-mark as row as the merge target on row click
this.matchRowClick = (row: any) => {
this.toggleMergeTarget(row.id);
- }
+ };
}
toggleMergeTarget(matchId: number) {
vqbr_quality: this.queuedRecord.quality(),
match_score: match.match_score(),
bib_summary: bibSummaries[match.eg_record()]
- }
+ };
observer.next(row);
});
if (this.queuedRecord) {
return Promise.resolve('');
}
- let idlClass = this.queueType === 'bib' ? 'vqbr' : 'vqar';
+ const idlClass = this.queueType === 'bib' ? 'vqbr' : 'vqar';
const flesh = {flesh: 1, flesh_fields: {}};
flesh.flesh_fields[idlClass] = ['matches'];
return this.pcrud.retrieve(idlClass, this.recordId, flesh)
import {Component, OnInit, ViewChild} from '@angular/core';
-import {Router, ActivatedRoute, ParamMap} from '@angular/router';
+import {Router, ActivatedRoute, ParamMap} from '@angular/router';
import {NgbTabset, NgbTabChangeEvent} from '@ng-bootstrap/ng-bootstrap';
@Component({
private router: Router,
private route: ActivatedRoute) {
- this.route.paramMap.subscribe((params: ParamMap) => {
+ this.route.paramMap.subscribe((params: ParamMap) => {
this.queueId = +params.get('id');
this.recordId = +params.get('recordId');
this.queueType = params.get('qtype');
// prevent tab changing until after route navigation
evt.preventDefault();
- const url =
+ const url =
`/staff/cat/vandelay/queue/${this.queueType}/${this.queueId}` +
`/record/${this.recordId}/${this.recordTab}`;
this.pcrud.search('vst', query, {order_by: {vst: 'create_time'}})
.subscribe(
tracker => {
- // The screen flickers less if the tracker array is
+ // The screen flickers less if the tracker array is
// updated inline instead of rebuilt every time.
- const existing =
+ const existing =
this.trackers.filter(t => t.id() === tracker.id())[0];
if (existing) {
},
err => {},
() => {
- const active =
+ const active =
this.trackers.filter(t => t.state() === 'active');
// Continue updating the display with updated tracker
import {Component, Input, ViewChild} from '@angular/core';
-import {Pager} from '@eg/share/util/pager';
+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';
// queue API does not support sorting
this.gridSource.getRows = (pager: Pager) => {
- return this.pcrud.search('vii',
+ return this.pcrud.search('vii',
{record: this.recordId}, {order_by: {vii: ['id']}});
};
}
import {Component, OnInit, AfterViewInit, ViewChild} from '@angular/core';
-import {Router, ActivatedRoute, NavigationEnd} from "@angular/router";
-import {take} from 'rxjs/operators/take';
+import {Router, ActivatedRoute, NavigationEnd} from '@angular/router';
+import {take} from 'rxjs/operators';
import {VandelayService} from './vandelay.service';
import {IdlObject} from '@eg/core/idl.service';
import {Injectable} from '@angular/core';
-import {Observable} from 'rxjs/Observable';
-import {tap} from 'rxjs/operators/tap';
-import {map} from 'rxjs/operators/map';
+import {Observable} from 'rxjs';
+import {tap, map} from 'rxjs/operators';
import {HttpClient} from '@angular/common/http';
-import {saveAs} from 'file-saver/FileSaver';
+import {saveAs} from 'file-saver';
import {IdlService, IdlObject} from '@eg/core/idl.service';
import {OrgService} from '@eg/core/org.service';
import {NetService} from '@eg/core/net.service';
}
const cls = (dtype === 'bib') ? 'vqbrad' : 'vqarad';
const orderBy = {};
- orderBy[cls] = 'id'
- return this.pcrud.retrieveAll(cls,
+ orderBy[cls] = 'id';
+ return this.pcrud.retrieveAll(cls,
{order_by: orderBy}, {atomic: true}).toPromise()
.then(list => {
this.attrDefs[dtype] = list;
}
const owners = this.org.ancestors(this.auth.user().ws_ou(), true);
- return this.pcrud.search('vmp',
+ return this.pcrud.search('vmp',
{owner: owners}, {order_by: {vmp: ['name']}}, {atomic: true})
.toPromise().then(profiles => {
this.mergeProfiles = profiles;
return Promise.resolve(this.bibSources);
}
- return this.pcrud.retrieveAll('cbs',
- {order_by: {cbs: 'id'}},
+ return this.pcrud.retrieveAll('cbs',
+ {order_by: {cbs: 'id'}},
{atomic: true}
).toPromise().then(sources => {
this.bibSources = sources;
// todo: differentiate between biblio and authority a la queue api
getMatchSets(mtype: string): Promise<IdlObject[]> {
-
+
const mstype = mtype.match(/bib/) ? 'biblio' : 'authority';
if (this.matchSets[mtype]) {
const owners = this.org.ancestors(this.auth.user().ws_ou(), true);
- return this.pcrud.search('vms',
+ return this.pcrud.search('vms',
{owner: owners, mtype: mstype}, {}, {atomic: true})
.toPromise().then(sets => {
this.matchSets[mtype] = sets;
return Promise.resolve(this.bibBuckets);
}
- const bkts = [];
return this.net.request(
- 'open-ils.actor',
+ 'open-ils.actor',
'open-ils.actor.container.retrieve_by_class',
this.auth.token(), this.auth.user().id(), 'biblio', 'staff_client'
- //).pipe(tap(bkt => bkts.push(bkt))).toPromise().then(() => bkts);
).toPromise().then(bkts => {
this.bibBuckets = bkts;
return bkts;
const owners = this.org.ancestors(this.auth.user().ws_ou(), true);
- return this.pcrud.search('vibtg',
- {always_apply : 'f', owner: owners},
+ return this.pcrud.search('vibtg',
+ {always_apply : 'f', owner: owners},
{vibtg : ['label']},
{atomic: true}
).toPromise().then(groups => {
// Create a queue and return the ID of the new queue via promise.
createQueue(
- queueName: string,
- recordType: string,
- importDefId: number,
- matchSet: number,
+ queueName: string,
+ recordType: string,
+ importDefId: number,
+ matchSet: number,
matchBucket: number): Promise<number> {
const method = `open-ils.vandelay.${recordType}_queue.create`;
let qType = recordType;
if (recordType.match(/bib_acq/)) {
- let qType = 'acq';
+ qType = 'acq';
}
return new Promise((resolve, reject) => {
this.net.request(
- 'open-ils.vandelay', method,
- this.auth.token(), queueName, null, qType,
+ 'open-ils.vandelay', method,
+ this.auth.token(), queueName, null, qType,
matchSet, importDefId, matchBucket
).subscribe(queue => {
const e = this.evt.parse(queue);
- if (e) {
+ if (e) {
reject(e);
} else {
// createQueue is always called after queues have
- // been fetched and cached.
+ // been fetched and cached.
this.allQueues[qType].push(queue);
resolve(queue.id());
}
});
}
- getQueuedRecords(queueId: number, queueType: string,
+ getQueuedRecords(queueId: number, queueType: string,
options?: any, limitToMatches?: boolean): Observable<any> {
const qtype = queueType.match(/bib/) ? 'bib' : 'auth';
- let method =
+ let method =
`open-ils.vandelay.${qtype}_queue.records.retrieve`;
if (limitToMatches) {
- method =
+ method =
`open-ils.vandelay.${qtype}_queue.records.matches.retrieve`;
}
- return this.net.request('open-ils.vandelay',
+ return this.net.request('open-ils.vandelay',
method, this.auth.token(), queueId, options);
}
const etype = queue.queue_type().match(/auth/) ? 'auth' : 'bib';
- let url =
- `${VANDELAY_EXPORT_PATH}?type=${etype}&queueid=${queue.id()}`
+ let url =
+ `${VANDELAY_EXPORT_PATH}?type=${etype}&queueid=${queue.id()}`;
let saveName = queue.name();
-
+
if (nonImported) {
url += '&nonimported=1';
saveName += '_nonimported';
);
}
- // Poll every 2 seconds for session tracker updates so long
+ // Poll every 2 seconds for session tracker updates so long
// as the session tracker is active.
// Returns an Observable of tracker objects.
pollSessionTracker(id: number): Observable<IdlObject> {
getNextSessionTracker(id: number, observer: any) {
- // No need for this to be an authoritative call.
+ // No need for this to be an authoritative call.
// It will complete eventually regardless.
this.pcrud.retrieve('vst', id).subscribe(
tracker => {
if (tracker && tracker.state() === 'active') {
observer.next(tracker);
- setTimeout(() =>
+ setTimeout(() =>
this.getNextSessionTracker(id, observer), 2000);
} else {
console.debug(
}
ngOnInit() {
-
+
if (this.qId) {
this.bucketType = 'vandelay_queue';
} else {