LP1879335 Manage Authorities Angular WIP user/berick/lp1879335-manage-authorities-angular
authorBill Erickson <berickxx@gmail.com>
Wed, 20 May 2020 15:04:17 +0000 (11:04 -0400)
committerBill Erickson <berickxx@gmail.com>
Wed, 20 May 2020 15:04:17 +0000 (11:04 -0400)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/eg2/src/app/staff/cat/authority/browse.component.html
Open-ILS/src/eg2/src/app/staff/cat/authority/browse.component.ts
Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Authority.pm

index 7846e8d..94a0f53 100644 (file)
@@ -13,8 +13,8 @@
       </div>
       <input type="text" class="form-control" placeholder="Search Term" 
         i18n-placeholder aria-describedby="search-term" 
-        (change)="search()"
-        (keyup.enter)="search()" [(ngModel)]="browse.searchTerm">
+        (change)="search(null, true)"
+        (keyup.enter)="search(null, true)" [(ngModel)]="browse.searchTerm">
     </div>
   </div>
   <div class="col-lg-5">
@@ -23,7 +23,7 @@
         <span class="input-group-text" id="auth-axis" i18n>Authority Type</span>
       </div>
       <eg-combobox #axisCbox [(ngModel)]="authorityAxis" 
-        [entries]="browse.authorityAxes" (onChange)="search(0, $event)">
+        [entries]="browse.authorityAxes" (onChange)="search(null, true)">
       </eg-combobox>
       <!--
       Hiding 'submit' button since it should never be necessary, plus it
index bfcdbfb..8f6dc1e 100644 (file)
@@ -38,7 +38,7 @@ export class BrowseAuthorityComponent implements OnInit {
         private net: NetService,
         private org: OrgService,
         private pcrud: PcrudService,
-        private browse: BrowseService
+        public browse: BrowseService
     ) {}
 
     ngOnInit() {
@@ -97,9 +97,11 @@ export class BrowseAuthorityComponent implements OnInit {
         this.browse.markedForMerge = {};
     }
 
-    search(offset?: number) {
+    search(offset?: number, isNew?: boolean) {
         if (offset) {
             this.browse.searchOffset += offset;
+        } else if (isNew) {
+            this.browse.searchOffset = 0;
         }
         this.grid.reload();
     }
index 549593a..9e2dfda 100644 (file)
@@ -392,10 +392,11 @@ sub authority_main_entry {
         };
 
         # Extract the heading and thesaurus.
-        # In theory this data has already been extracted in the DB,
-        # but my results vary quite a bit from the previous authority
-        # manage interface.  I took the MARC parsing approach because
-        # it matches the logic (and results) of the previous UI.
+        # In theory this data has already been extracted in the DB, but
+        # using authority.simple_heading results in data that varies
+        # quite a bit from the previous authority manage interface.  I
+        # took the MARC parsing approach because it matches the logic
+        # (and results) of the previous UI.
 
         my $marc = MARC::Record->new_from_xml($rec->marc);
         my $heading_field = $marc->field('1..');
@@ -403,16 +404,19 @@ sub authority_main_entry {
 
         my $field_008 = $marc->field('008');
         if ($field_008) {
+
+            # Extract the 1-char thesaurus code from the 008.
             my $thes = substr($field_008->data, 11, 1);
 
             if (defined $thes) {
                 $response->{thesaurus} = $thes;
 
                 if ($thes ne 'z') { # 'z' ('Other') maps to many entries
-                    my $thesaurus = 
-                        $e->search_authority_thesaurus({short_code => $thes})->[0];
+                    my $thesaurus = $e->search_authority_thesaurus(
+                        {short_code => $thes})->[0];
 
-                    $response->{thesaurus_code} = $thesaurus->code if $thesaurus;
+                    $response->{thesaurus_code} = 
+                        $thesaurus->code if $thesaurus;
                 }
             }
         }