From 0e93432b1ecc4a633b53c368ed9b4eec2569cf2b Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Wed, 27 Mar 2019 12:24:25 -0400 Subject: [PATCH] Debug logs for angular catalog circa 3.3 Signed-off-by: Bill Erickson --- .../eg2/src/app/share/catalog/bib-record.service.ts | 20 ++++++++++++++++---- .../src/eg2/src/app/share/catalog/catalog.service.ts | 1 + .../src/app/staff/catalog/result/record.component.ts | 1 + .../app/staff/catalog/result/results.component.ts | 13 ++++++++++++- 4 files changed, 30 insertions(+), 5 deletions(-) diff --git a/Open-ILS/src/eg2/src/app/share/catalog/bib-record.service.ts b/Open-ILS/src/eg2/src/app/share/catalog/bib-record.service.ts index d536c8beb5..f73dbca35b 100644 --- a/Open-ILS/src/eg2/src/app/share/catalog/bib-record.service.ts +++ b/Open-ILS/src/eg2/src/app/share/catalog/bib-record.service.ts @@ -169,14 +169,22 @@ export class BibRecordService { }, {anonymous: true} // skip unneccesary auth ).pipe(mergeMap(bib => { + console.debug('pcrud grabbed record', bib.id()); const summary = new BibRecordSummary(bib, orgId, orgDepth); summary.net = this.net; // inject summary.ingest(); + console.debug('fetching holdings for record', bib.id()); return this.getHoldingsSummary(bib.id(), orgId, orgDepth) - .then(holdingsSummary => { - summary.holdingsSummary = holdingsSummary; - return summary; - }); + .then( + holdingsSummary => { + summary.holdingsSummary = holdingsSummary; + return summary; + }, + notOk => { + console.error('Holdings summary failed', notOk); + return Promise.reject(null); + } + ); })); } @@ -301,6 +309,7 @@ export class BibRecordService { const holdingsSummary = []; + console.debug('Fetching holdings for ', recordId); return this.unapi.getAsXmlDocument({ target: isMetarecord ? 'mmr' : 'bre', id: recordId, @@ -309,6 +318,7 @@ export class BibRecordService { orgId: orgId, depth: orgDepth }).then(xmlDoc => { + console.debug('Holdings doc fetched', xmlDoc); // namespace resolver const resolver: any = (prefix: string): string => { @@ -329,6 +339,8 @@ export class BibRecordService { holdingsSummary.push(counts); } + console.debug('Done compiling holdings summary for', + recordId, holdingsSummary); return holdingsSummary; }); } diff --git a/Open-ILS/src/eg2/src/app/share/catalog/catalog.service.ts b/Open-ILS/src/eg2/src/app/share/catalog/catalog.service.ts index 90a959975a..5d57e6846a 100644 --- a/Open-ILS/src/eg2/src/app/share/catalog/catalog.service.ts +++ b/Open-ILS/src/eg2/src/app/share/catalog/catalog.service.ts @@ -208,6 +208,7 @@ export class CatalogService { idx = ctx.currentResultIds().indexOf(summary.id); } + console.debug('fetched summary for record index', idx); if (ctx.result.records) { // May be reset when quickly navigating results. ctx.result.records[idx] = summary; diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/result/record.component.ts b/Open-ILS/src/eg2/src/app/staff/catalog/result/record.component.ts index dd13b9d8f6..1176a62f60 100644 --- a/Open-ILS/src/eg2/src/app/staff/catalog/result/record.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/catalog/result/record.component.ts @@ -35,6 +35,7 @@ export class ResultRecordComponent implements OnInit, OnDestroy { ) {} ngOnInit() { + console.debug('Init result record component', this.summary.id); this.searchContext = this.staffCat.searchContext; this.summary.getHoldCount(); this.isRecordSelected = this.basket.hasRecordId(this.summary.id); diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/result/results.component.ts b/Open-ILS/src/eg2/src/app/staff/catalog/result/results.component.ts index 869eff2e79..b2cc22d70d 100644 --- a/Open-ILS/src/eg2/src/app/staff/catalog/result/results.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/catalog/result/results.component.ts @@ -98,8 +98,17 @@ export class ResultsComponent implements OnInit, OnDestroy { this.cat.search(this.searchContext) .then(ok => { this.cat.fetchFacets(this.searchContext); + console.debug('Fetching bib summaries'); this.cat.fetchBibSummaries(this.searchContext) - .then(ok2 => this.fleshSearchResults()); + .then( + ok2 => { + console.debug('bib summaries fetching succeeded'); + this.fleshSearchResults(); + }, + notOk => { + console.error('bib summary fetching failed!', notOk); + } + ); }); } } @@ -124,8 +133,10 @@ export class ResultsComponent implements OnInit, OnDestroy { } fleshSearchResults(): void { + console.log('fleshSearchResults() 1'); const records = this.searchContext.result.records; if (!records || records.length === 0) { return; } + console.log('fleshSearchResults() 2'); // Flesh the creator / editor fields with the user object. this.bib.fleshBibUsers(records.map(r => r.record)); -- 2.11.0