newSessionWrapper(optionalSessionToClone?: any) {
this.newSessionDialog.sessionToClone = optionalSessionToClone;
this.newSessionDialog.open({size: 'lg'}).subscribe( (res) => {
- console.log('dialog res', res);
+ console.log('new dialog res', res);
+ if (res['sessionId']) {
+ window.alert( // TODO: replace this with an angular dialog
+ $localize`Session ID = ` + res['sessionId'] + '\n'
+ + $localize`Title Hits = ` + res['number_of_hits'] + '\n'
+ + $localize`URLs Extracted = ` + res['urls_extracted'] + '\n'
+ + $localize`URLs Verified = ` + res['verified_total_processed'] + '\n'
+ );
+ }
if (res && res['sessionId']) {
- if (res['viewURLs']) {
+ if (res['viewURLs'] && res['urls_extracted'] > 0) {
this.router.navigate(['/staff/cat/linkchecker/urls/'],
{ queryParams: { sessions: JSON.stringify([ Number(res['sessionId']) ]) } });
- } else if (res['viewAttempts']) {
+ } else if (res['viewAttempts'] && res['verified_total_processed'] > 0) {
this.router.navigate(['/staff/cat/linkchecker/attempts/'],
{ queryParams: { sessions: JSON.stringify([ Number(res['sessionId']) ]) } });
} else {
private renderer: Renderer2,
) {
super(modal);
+ if (this.modal) {} // noop for linting
}
ngOnInit() {
applyOwningLibrary(p: any) {
// [applyOrgId]="sessionOwningLibrary" is working fine
+ if (p) {} // noop for linting
}
applySessionSearch(p: any) {
+ if (p) {} // noop for linting
}
applySearchScope(p: any) {
// https://stackoverflow.com/questions/42322968/angular2-dynamic-input-field-lose-focus-when-input-changes
trackByIdx(index: any, item: any) {
- return index;
+ if (item) {} // noop for linting
+ return index;
}
addSelectorRow(index: number): void {
createNewSession(options: any) {
///////////////////////////////////////////////
+ options['verified_total_processed'] = 0;
+ options['url_selectors_created'] = 0;
+ options['urls_extracted'] = 0;
this.startProgressMeter($localize`Creating session...`);
this.subscriptions.push(this.net.request(
'open-ils.url_verify',
this.stopProgressMeter();
this.close(false);
} else {
- console.log('url_selector',res2);
+ //console.log('url_selector',res2);
+ options['url_selectors_created'] += 1;
}
},
error: (err2) => {
console.log('res3',res3);
if (!this.progress.hasMax()) {
// first response returned by the API is the number of search results
+ options['number_of_hits'] = Number(res3);
// We'll become a determinate progress meter for this section
this.progress.update({max: res3, value: 0});
} else {
// subsequent responses are the number of URLs extracted from each search result
this.progress.increment();
+ if (Array.isArray(res3)) {
+ res3.forEach( c => options['urls_extracted'] += Number(c) );
+ } else {
+ options['urls_extracted'] += Number(res3);
+ }
}
},
error: (err3) => {
next: (res4) => {
console.log('res4',res4);
this.progress.update({max: res4['url_count'], value: res4['total_processed']});
+ options['verified_total_processed'] = Number(res4['total_processed']);
},
error: (err4) => {
this.stopProgressMeter();