From bde70deffb6a183551c2c41aeb434a2d92c6dc69 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Fri, 31 Jul 2020 13:14:50 -0400 Subject: [PATCH] LP1889694 catalog record summary condensed WIP Signed-off-by: Bill Erickson --- .../src/app/share/catalog/bib-record.service.ts | 1 + .../staff/catalog/result/results.component.html | 10 ++++---- .../app/staff/catalog/result/results.component.ts | 22 ------------------ .../lib/OpenILS/Application/Search/Biblio.pm | 27 ++++++++++++++++++++-- 4 files changed, 30 insertions(+), 30 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 3d93945c4e..7510fe0d0b 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 @@ -124,6 +124,7 @@ export class BibRecordService { const summary = new BibRecordSummary(metabibSummary.record, orgId); summary.net = this.net; // inject summary.metabibId = Number(metabibSummary.metabib_id); + summary.metabibRecords = metabibSummary.metabib_records; summary.display = metabibSummary.display; summary.attributes = metabibSummary.attributes; summary.holdCount = metabibSummary.hold_count; diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/result/results.component.html b/Open-ILS/src/eg2/src/app/staff/catalog/result/results.component.html index 41804cc62c..515a376dd9 100644 --- a/Open-ILS/src/eg2/src/app/staff/catalog/result/results.component.html +++ b/Open-ILS/src/eg2/src/app/staff/catalog/result/results.component.html @@ -65,12 +65,10 @@
-
-
-
- - -
+
+
+ +
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 5de553519c..edcb381044 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 @@ -105,28 +105,6 @@ export class ResultsComponent implements OnInit, OnDestroy { } } - // Records file into place randomly as the server returns data. - // To reduce page display shuffling, avoid showing the list of - // records until the first few are ready to render. - shouldStartRendering(): boolean { - return this.searchHasResults(); - - /* - if (this.searchHasResults()) { - const pageCount = this.searchContext.currentResultIds().length; - switch (pageCount) { - case 1: - return this.searchContext.result.records[0]; - default: - return this.searchContext.result.records[0] - && this.searchContext.result.records[1]; - } - } - - return false; - */ - } - searchIsDone(): boolean { return this.searchContext.searchState === CatalogSearchState.COMPLETE; } diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm index adbe0e7b10..b07440e65a 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm @@ -2753,7 +2753,12 @@ __PACKAGE__->register_method( {desc => 'Array of Record IDs', type => 'array'} ], return => { - desc => 'Stream of record summary objects' + desc => q/ + Stream of record summary objects including id, record, + hold_count, copy_counts, display (metabib display + fields), attributes (metabib record attrs), plus + metabib_id and metabib_records for the metabib variant. + / } } ); @@ -2817,6 +2822,8 @@ sub catalog_record_summary { return undef; } +# Start with a bib summary and augment the data with additional +# metarecord content. sub get_one_metarecord_summary { my ($e, $rec_id) = @_; @@ -2830,8 +2837,23 @@ sub get_one_metarecord_summary { $response->{metabib_id} = $rec_id; $response->{metabib_records} = [map {$_->source} @$maps]; - # augment mraf + my @other_bibs = map {$_->source} grep {$_->source != $bre_id} @$maps; + # Augment the record attributes with those of all of the records + # linked to this metarecord. + if (@other_bibs) { + my $attrs = $e->search_metabib_record_attr_flat({id => \@other_bibs}); + + my $attributes = $response->{attributes}; + + for my $attr (@$attrs) { + $attributes->{$attr->attr} = [] unless $attributes->{$attr->attr}; + push(@{$attributes->{$attr->attr}}, $attr->value) # avoid dupes + unless grep {$_ eq $attr->value} @{$attributes->{$attr->attr}}; + } + } + + return $response; } sub get_one_record_summary { @@ -2844,6 +2866,7 @@ sub get_one_record_summary { } }]) or return {}; + # Compressed display fields are pachaged as JSON my $display = {}; $display->{$_->name} = OpenSRF::Utils::JSON->JSON2perl($_->value) foreach @{$bre->compressed_display_entries}; -- 2.11.0