Debug logs for angular catalog circa 3.3
authorBill Erickson <berickxx@gmail.com>
Wed, 27 Mar 2019 16:24:25 +0000 (12:24 -0400)
committerBill Erickson <berickxx@gmail.com>
Wed, 27 Mar 2019 16:24:25 +0000 (12:24 -0400)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/eg2/src/app/share/catalog/bib-record.service.ts
Open-ILS/src/eg2/src/app/share/catalog/catalog.service.ts
Open-ILS/src/eg2/src/app/staff/catalog/result/record.component.ts
Open-ILS/src/eg2/src/app/staff/catalog/result/results.component.ts

index d536c8b..f73dbca 100644 (file)
@@ -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;
         });
     }
index 90a9599..5d57e68 100644 (file)
@@ -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;
index dd13b9d..1176a62 100644 (file)
@@ -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);
index 869eff2..b2cc22d 100644 (file)
@@ -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));