.map(f => f.name);
}
- // Note responses are returned upon receipt, not necessarily in
- // request ID order.
- getBibSummaryBatch(bibIds: number[],
+ // Note when multiple IDs are provided, responses are emitted in order
+ // of receipt, not necessarily in the requested ID order.
+ getBibSummary(bibIds: number | number[],
orgId?: number, orgDepth?: number): Observable<BibRecordSummary> {
- if (bibIds.length === 0) {
+ const ids = [].concat(bibIds);
+
+ if (ids.length === 0) {
return from([]);
}
- return this.pcrud.search('bre', {id: bibIds},
+ return this.pcrud.search('bre', {id: ids},
{ flesh: 1,
flesh_fields: {bre: ['flat_display_entries', 'mattrs']},
select: {bre : this.fetchableBreFields()}
}));
}
- getBibSummary(bibId: number,
- orgId?: number, orgDepth?: number): Promise<BibRecordSummary> {
-
- return this.pcrud.retrieve('bre', bibId,
- { flesh: 1,
- flesh_fields: {bre: ['flat_display_entries', 'mattrs']},
- select: {bre : this.fetchableBreFields()}
- },
- {anonymous: true} // skip unneccesary auth
- ).pipe(mergeMap(bib => {
- const summary = new BibRecordSummary(bib, orgId, orgDepth);
- summary.net = this.net; // inject
- summary.ingest();
- return this.getHoldingsSummary(bib.id(), orgId, orgDepth)
- .then(holdingsSummary => {
- summary.holdingsSummary = holdingsSummary;
- return summary;
- });
- })).toPromise();
- }
-
// Flesh the creator and editor fields.
// Handling this separately lets us pull from the cache and
// avoids the requirement that the main bib query use a staff
ctx.org.root().ou_type().depth() :
ctx.searchOrg.ou_type().depth();
- return this.bibService.getBibSummaryBatch(
+ return this.bibService.getBibSummary(
ctx.currentResultIds(), ctx.searchOrg.id(), depth)
.pipe(map(summary => {
// Responses are not necessarily returned in request-ID order.
this.bib.getBibSummary(
this.recordId,
this.searchContext.searchOrg.id(),
- this.searchContext.searchOrg.ou_type().depth()
- ).then(summary => {
+ this.searchContext.searchOrg.ou_type().depth()).toPromise()
+ .then(summary => {
this.summary =
this.staffCat.currentDetailRecordSummary = summary;
this.bib.fleshBibUsers([summary.record]);
<div class="flex-1">{{summary.record.tcn_value()}}</div>
<div class="flex-1 font-weight-bold pl-1" i18n>Created By:</div>
<div class="flex-1" *ngIf="summary.record.creator().usrname">
- {{summary.record.creator().usrname()}}
+ <a href="/eg/staff/circ/patron/{{summary.record.creator().id()}}/checkout">
+ {{summary.record.creator().usrname()}}
+ </a>
</div>
</div>
</li>
<div class="flex-1">{{summary.id}}</div>
<div class="flex-1 font-weight-bold pl-1" i18n>Last Edited By:</div>
<div class="flex-1" *ngIf="summary.record.editor().usrname">
- {{summary.record.editor().usrname()}}
+ <a href="/eg/staff/circ/patron/{{summary.record.editor().id()}}/checkout">
+ {{summary.record.editor().usrname()}}
+ </a>
</div>
</div>
</li>
<li class="list-group-item" *ngIf="expandDisplay">
<div class="d-flex">
<div class="flex-1 font-weight-bold" i18n>Bib Call #:</div>
- <div class="flex-3">{{summary.callNumber}}</div>
+ <div class="flex-3">{{summary.bibCallNumber}}</div>
<div class="flex-1 font-weight-bold" i18n>Record Owner:</div>
- <div class="flex-1">TODO</div>
+ <div class="flex-1">{{orgName(summary.record.owner())}}</div>
<div class="flex-1 font-weight-bold pl-1" i18n>Created On:</div>
- <div class="flex-1">{{summary.create_date | date:'shortDate'}}</div>
+ <div class="flex-1">{{summary.record.create_date() | date:'short'}}</div>
<div class="flex-1 font-weight-bold pl-1" i18n>Last Edited On:</div>
- <div class="flex-1">{{summary.edit_date | date:'shortDate'}}</div>
+ <div class="flex-1">{{summary.record.edit_date() | date:'short'}}</div>
</div>
</li>
</ul>
import {Component, OnInit, Input} from '@angular/core';
import {NetService} from '@eg/core/net.service';
+import {OrgService} from '@eg/core/org.service';
import {PcrudService} from '@eg/core/pcrud.service';
import {CatalogService} from '@eg/share/catalog/catalog.service';
import {BibRecordService, BibRecordSummary} from '@eg/share/catalog/bib-record.service';
private bib: BibRecordService,
private cat: CatalogService,
private net: NetService,
+ private org: OrgService,
private pcrud: PcrudService
) {}
}
loadSummary(): void {
- this.bib.getBibSummary(this.recordId).then(summary => {
+ this.bib.getBibSummary(this.recordId).toPromise()
+ .then(summary => {
summary.getBibCallNumber();
this.bib.fleshBibUsers([summary.record]);
this.summary = summary;
console.log(this.summary.display);
});
}
+
+ orgName(orgId: number): string {
+ if (orgId) {
+ return this.org.get(orgId).shortname();
+ }
+ }
+
}