[open-ils-commits] [GIT] Evergreen ILS branch rel_3_4 updated. 6f0b79352e1972a42ff0c17c98d35af974ecfb32

Evergreen Git git at git.evergreen-ils.org
Thu May 14 17:28:58 EDT 2020


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, rel_3_4 has been updated
       via  6f0b79352e1972a42ff0c17c98d35af974ecfb32 (commit)
       via  b011e7e9a23df412125613a8b3a3e414bf717319 (commit)
       via  c8ef21aa5ef74cbfa72ad440b30fe71e90b7fa7f (commit)
       via  38dbc668ca5c8d340fe4cb4e7bcab8c9a885decd (commit)
       via  f24000c7abd809331c6e2ddc9edd2f40923430f3 (commit)
       via  5b1af9dd6f33b25f8e2d11573270b7617e8bb1aa (commit)
      from  e268dedf139e42797f1ae4f4df24bd6bea6a07a5 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 6f0b79352e1972a42ff0c17c98d35af974ecfb32
Author: Bill Erickson <berickxx at gmail.com>
Date:   Wed May 6 10:47:37 2020 -0400

    LP1847800 Admin grid filter display, default fields, IDL repairs
    
    * Indicate in the UI when grid filters are applied via URL and offer a
      way for the user to clear the filters.
    
    * When grid filters are applied, use them as the basis for the "Default
      New Record" object which seeds the fm-editor.  In other words, apply
      default values to the fm-editor to match the grid filters.
    
    * Repair some IDL thinkos and add more 'selector' values.
    
    Signed-off-by: Bill Erickson <berickxx at gmail.com>
    Signed-off-by: Chris Sharp <csharp at georgialibraries.org>

diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml
index 0db8a20578..f49c3ef2e7 100644
--- a/Open-ILS/examples/fm_IDL.xml
+++ b/Open-ILS/examples/fm_IDL.xml
@@ -217,7 +217,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
 
 	<class id="vibtf" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="vandelay::import_bib_trash_fields" oils_persist:tablename="vandelay.import_bib_trash_fields" reporter:label="Import/Overlay Fields for Removal">
 		<fields oils_persist:primary="id" oils_persist:sequence="vandelay.import_bib_trash_fields_id_seq">
-			<field reporter:label="Field ID" name="id" reporter:datatype="id"/>
+			<field reporter:label="Field ID" name="id" reporter:datatype="id" reporter:selector="field"/>
 			<field reporter:label="Group" name="grp" reporter:datatype="link" config_field="true"/>
 			<field reporter:label="Field" name="field" reporter:datatype="text"/>
 		</fields>
@@ -339,7 +339,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
             reporter:label="Import/Overlay Field Groups for Removal">
 		<fields oils_persist:primary="id" 
                 oils_persist:sequence="vandelay.import_bib_trash_group_id_seq">
-			<field reporter:label="ID" name="id" reporter:datatype="id" reporter:selector="name"/>
+			<field reporter:label="ID" name="id" reporter:datatype="id" reporter:selector="label"/>
 			<field reporter:label="Owner" name="owner" reporter:datatype="link"/>
 			<field reporter:label="Label" name="label" reporter:datatype="text"/>
 			<field reporter:label="Always Apply" name="always_apply" reporter:datatype="bool"/>
@@ -2582,7 +2582,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
 			<link field="thesauri" reltype="has_many" key="control_set" map="" class="at"/>
 			<link field="main_entry" reltype="has_a" key="id" map="" class="acsaf"/>
 			<link field="sub_entries" reltype="has_many" key="main_entry" map="" class="acsaf"/>
-			<link field="heading" reltype="has_a" key="id" map="" class="ahf"/>
+			<link field="heading_field" reltype="has_a" key="id" map="" class="ahf"/>
 		</links>
 		<permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
 			<actions>
@@ -2776,7 +2776,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
 
 	<class id="ahf" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="authority::heading_field" oils_persist:tablename="authority.heading_field" reporter:label="Authority Heading Fields">
 		<fields oils_persist:primary="id" oils_persist:sequence="authority.heading_fields_id_seq">
-			<field name="id" reporter:datatype="id" />
+			<field name="id" reporter:datatype="id" reporter:selector="label" />
 			<field name="heading_type" reporter:datatype="text" reporter:label="Heading Type" />
 			<field name="heading_purpose" reporter:datatype="text" reporter:label="Heading Purpose" />
 			<field name="label" reporter:datatype="text" reporter:label="Heading Field Label" />
diff --git a/Open-ILS/src/eg2/src/app/staff/share/admin-page/admin-page.component.html b/Open-ILS/src/eg2/src/app/staff/share/admin-page/admin-page.component.html
index b7dec5c125..5234f491af 100644
--- a/Open-ILS/src/eg2/src/app/staff/share/admin-page/admin-page.component.html
+++ b/Open-ILS/src/eg2/src/app/staff/share/admin-page/admin-page.component.html
@@ -16,13 +16,27 @@
 <ng-template #createErrStrTmpl i18n>Failed to create new {{idlClassDef.label}}</ng-template>
 <eg-string #createErrString [template]="createErrStrTmpl"></eg-string>
 
-<ng-container *ngIf="orgField">
-  <eg-org-family-select
-    [limitPerms]="viewPerms" 
-    [selectedOrgId]="contextOrg.id()"
-    [(ngModel)]="searchOrgs"
-    (ngModelChange)="grid.reload()">
-  </eg-org-family-select>
+<ng-container *ngIf="orgField || gridFilters">
+  <div class="row">
+    <div class="col-lg-6">
+      <ng-container *ngIf="orgField">
+        <eg-org-family-select
+          [limitPerms]="viewPerms" 
+          [selectedOrgId]="contextOrg.id()"
+          [(ngModel)]="searchOrgs"
+          (ngModelChange)="grid.reload()">
+        </eg-org-family-select>
+      </ng-container>
+    </div>
+    <div class="col-lg-6 d-flex">
+      <div class="flex-1"></div><!-- push right -->
+      <ng-container *ngIf="gridFilters">
+        <span i18n>Filters Applied: {{gridFilters | json}}</span>
+        <a class="pl-2 font-italic" 
+          [attr.href]="clearGridFiltersUrl()" i18n>Clear Filters</a>
+      </ng-container>
+    </div>
+  </div>
   <hr/>
 </ng-container>
 
diff --git a/Open-ILS/src/eg2/src/app/staff/share/admin-page/admin-page.component.ts b/Open-ILS/src/eg2/src/app/staff/share/admin-page/admin-page.component.ts
index 844da1e46d..46941f5f92 100644
--- a/Open-ILS/src/eg2/src/app/staff/share/admin-page/admin-page.component.ts
+++ b/Open-ILS/src/eg2/src/app/staff/share/admin-page/admin-page.component.ts
@@ -186,6 +186,20 @@ export class AdminPageComponent implements OnInit {
             } catch (E) {
                 console.error('Invalid grid filters provided: ', filters);
             }
+
+            // Use the grid filters as the basis for our default
+            // new record (passed to fm-editor).
+            if (!this.defaultNewRecord) {
+                const rec = this.idl.create(this.idlClass);
+                Object.keys(this.gridFilters).forEach(field => {
+                    // When filtering on the primary key of the current
+                    // object type, avoid using it in the default new object.
+                    if (rec[field] && this.pkeyField !== field) {
+                        rec[field](this.gridFilters[field]);
+                    }
+                });
+                this.defaultNewRecord = rec;
+            }
         }
 
         // Limit the view org selector to orgs where the user has
@@ -459,6 +473,12 @@ export class AdminPageComponent implements OnInit {
             idlField: col.name
         });
     }
+
+    clearGridFiltersUrl(): string {
+        const parts = this.idlClassDef.table.split(/\./);
+        const url = this.configLinkBasePath + '/' + parts[0] + '/' + parts[1];
+        return this.ngLocation.prepareExternalUrl(url);
+    }
 }
 
 

commit b011e7e9a23df412125613a8b3a3e414bf717319
Author: Jeff Davis <jdavis at sitka.bclibraries.ca>
Date:   Tue May 5 14:37:05 2020 -0700

    LP#1847800: secondary admin pages for Authority Control Sets and Authority Thesauri
    
    Signed-off-by: Jeff Davis <jdavis at sitka.bclibraries.ca>
    Signed-off-by: Bill Erickson <berickxx at gmail.com>
    Signed-off-by: Chris Sharp <csharp at georgialibraries.org>

diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml
index f4dfba0972..0db8a20578 100644
--- a/Open-ILS/examples/fm_IDL.xml
+++ b/Open-ILS/examples/fm_IDL.xml
@@ -2539,8 +2539,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
 			<field reporter:label="Control Set ID" name="id" reporter:datatype="id" reporter:selector="name"/>
 			<field reporter:label="Name" name="name" reporter:datatype="text" oils_persist:i18n="true" oils_obj:required="true" />
 			<field reporter:label="Description" name="description" reporter:datatype="text" oils_persist:i18n="true" />
-			<field reporter:label="Controlling Authority Fields" name="authority_fields" reporter:datatype="link" oils_persist:virtual="true"/>
-			<field reporter:label="Thesauri" name="thesauri" reporter:datatype="link" oils_persist:virtual="true"/>
+			<field reporter:label="Controlling Authority Fields" name="authority_fields" reporter:datatype="link" oils_persist:virtual="true" config_field="true"/>
+			<field reporter:label="Thesauri" name="thesauri" reporter:datatype="link" oils_persist:virtual="true" config_field="true"/>
 		</fields>
 		<links>
 			<link field="authority_fields" reltype="has_many" key="control_set" map="" class="acsaf"/>
@@ -2560,7 +2560,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
 		<fields oils_persist:primary="id" oils_persist:sequence="authority.control_set_authority_field_id_seq">
 			<field reporter:label="Control Set Authority Field ID" name="id" reporter:datatype="id" reporter:selector="name"/>
 			<field reporter:label="Main Entry" name="main_entry" reporter:datatype="link"/>
-			<field reporter:label="Control Set" name="control_set" reporter:datatype="link"/>
+			<field reporter:label="Control Set" name="control_set" reporter:datatype="link" config_field="true"/>
 			<field reporter:label="Tag" name="tag" reporter:datatype="text" oils_obj:required="true" oils_obj:validate="^.{3}$"/>
 			<field reporter:label="Subfield List" name="sf_list" reporter:datatype="text" />
 			<field reporter:label="Subfield List for Display" name="display_sf_list" reporter:datatype="text" />
@@ -2636,7 +2636,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
 	<class id="at" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="authority::thesaurus" oils_persist:tablename="authority.thesaurus" reporter:label="Authority Thesaurus" oils_persist:field_safe="true">
 		<fields oils_persist:primary="code">
 			<field reporter:label="Thesaurus Code" name="code" reporter:datatype="id" reporter:selector="name"/>
-			<field reporter:label="Control Set" name="control_set" reporter:datatype="link"/>
+			<field reporter:label="Control Set" name="control_set" reporter:datatype="link" config_field="true"/>
 			<field reporter:label="Name" name="name" reporter:datatype="text" oils_persist:i18n="true" oils_obj:required="true" />
 			<field reporter:label="Description" name="description" reporter:datatype="text" oils_persist:i18n="true" />
 			<field reporter:label="Short Code" name="short_code" reporter:datatype="text" />

commit c8ef21aa5ef74cbfa72ad440b30fe71e90b7fa7f
Author: Jeff Davis <jdavis at sitka.bclibraries.ca>
Date:   Tue May 5 14:11:41 2020 -0700

    LP#1847800 / LP#1847810: secondary admin pages: MARC Search/Facet Fields -> virtual index definitions
    
    Signed-off-by: Jeff Davis <jdavis at sitka.bclibraries.ca>
    Signed-off-by: Bill Erickson <berickxx at gmail.com>
    Signed-off-by: Chris Sharp <csharp at georgialibraries.org>

diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml
index 8946823c1b..f4dfba0972 100644
--- a/Open-ILS/examples/fm_IDL.xml
+++ b/Open-ILS/examples/fm_IDL.xml
@@ -2929,7 +2929,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
 			<field reporter:label="Authority XPath" name="authority_xpath" reporter:datatype="text" />
 			<field reporter:label="Restrict?" name="restrict" reporter:datatype="bool" />
 			<field reporter:label="Display Field Map" name="display_field_map" oils_persist:virtual="true" reporter:datatype="link"/>
-			<field reporter:label="Virtual Field Data Suppliers" name="data_sources" oils_persist:virtual="true" reporter:datatype="link"/>
+			<field reporter:label="Virtual Field Data Suppliers" name="data_sources" oils_persist:virtual="true" reporter:datatype="link" config_field="true"/>
 		</fields>
 		<links>
 			<link field="format" reltype="has_a" key="name" map="" class="cxt"/>
@@ -2951,7 +2951,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
 		<fields oils_persist:primary="id" oils_persist:sequence="config.metabib_field_virtual_map_id_seq">
 			<field reporter:label="ID" name="id" reporter:datatype="id"/>
 			<field reporter:label="Real" name="real" reporter:datatype="link"/>
-			<field reporter:label="Virtual" name="virtual" reporter:datatype="link"/>
+			<field reporter:label="Virtual" name="virtual" reporter:datatype="link" config_field="true"/>
 			<field reporter:label="Weight" name="weight" reporter:datatype="int"/>
 		</fields>
 		<links>

commit 38dbc668ca5c8d340fe4cb4e7bcab8c9a885decd
Author: Jeff Davis <jdavis at sitka.bclibraries.ca>
Date:   Tue May 5 12:16:37 2020 -0700

    LP#1847800 / LP#1847781: secondary admin pages for MARC Import Remove Fields
    
    Signed-off-by: Jeff Davis <jdavis at sitka.bclibraries.ca>
    Signed-off-by: Bill Erickson <berickxx at gmail.com>
    Signed-off-by: Chris Sharp <csharp at georgialibraries.org>

diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml
index f675add01b..8946823c1b 100644
--- a/Open-ILS/examples/fm_IDL.xml
+++ b/Open-ILS/examples/fm_IDL.xml
@@ -218,7 +218,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
 	<class id="vibtf" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="vandelay::import_bib_trash_fields" oils_persist:tablename="vandelay.import_bib_trash_fields" reporter:label="Import/Overlay Fields for Removal">
 		<fields oils_persist:primary="id" oils_persist:sequence="vandelay.import_bib_trash_fields_id_seq">
 			<field reporter:label="Field ID" name="id" reporter:datatype="id"/>
-			<field reporter:label="Group" name="grp" reporter:datatype="link"/>
+			<field reporter:label="Group" name="grp" reporter:datatype="link" config_field="true"/>
 			<field reporter:label="Field" name="field" reporter:datatype="text"/>
 		</fields>
 		<links>
@@ -343,9 +343,11 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
 			<field reporter:label="Owner" name="owner" reporter:datatype="link"/>
 			<field reporter:label="Label" name="label" reporter:datatype="text"/>
 			<field reporter:label="Always Apply" name="always_apply" reporter:datatype="bool"/>
+			<field reporter:label="Fields" name="import_bib_trash_fields" oils_persist:virtual="true" reporter:datatype="link" config_field="true"/>
 		</fields>
 		<links>
 			<link field="owner" reltype="has_a" key="id" map="" class="aou"/>
+			<link field="import_bib_trash_fields" reltype="has_many" key="grp" map="" class="vibtf"/>
 		</links>
 		<permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
 			<actions>

commit f24000c7abd809331c6e2ddc9edd2f40923430f3
Author: Bill Erickson <berickxx at gmail.com>
Date:   Wed Apr 29 17:27:23 2020 -0400

    LP1847800 Admin grids support config_field links
    
    For IDL fields which have config_field=true, the value in the admin grid
    is rendered as a link to the grid for the linked field.  Additionally,
    the link contains a gridFilter so the destination grid only displays
    rows related to the selected field.
    
    Adds config_field=true values for z39.50 source and two links for hard
    due date and hard due date values.
    
    Signed-off-by: Bill Erickson <berickxx at gmail.com>
    Signed-off-by: Chris Sharp <csharp at georgialibraries.org>

diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml
index 55190ede7d..f675add01b 100644
--- a/Open-ILS/examples/fm_IDL.xml
+++ b/Open-ILS/examples/fm_IDL.xml
@@ -1251,7 +1251,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
     <class id="cza" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="config::z3950_attr" oils_persist:tablename="config.z3950_attr" reporter:label="Z39.50 Attribute">
         <fields oils_persist:primary="id" oils_persist:sequence="config.z3950_attr_id_seq">
             <field reporter:label="Z39.50 Attribute ID" name="id" reporter:datatype="id" reporter:selector="label"/>
-            <field reporter:label="Z39.50 Source" name="source" reporter:datatype="link"/>
+            <field reporter:label="Z39.50 Source" name="source" reporter:datatype="link" config_field="true"/>
             <field reporter:label="Name" name="name" reporter:datatype="text"/>
             <field reporter:label="Label" name="label" reporter:datatype="text" oils_persist:i18n="true"/>
             <field reporter:label="Code" name="code"  reporter:datatype="int"/>
@@ -3548,9 +3548,12 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
             <field reporter:label="Always Use?" name="forceto" reporter:datatype="bool"/>
 			<field reporter:label="Current Ceiling Date" name="ceiling_date" reporter:datatype="timestamp"/>
             <field reporter:label="Owner" name="owner" reporter:datatype="org_unit"/>
+			<field reporter:label="Values" name="values" oils_persist:virtual="true" 
+				reporter:datatype="link" config_field="true"/>
 		</fields>
 		<links>
             <link field="owner" reltype="has_a" key="id" map="" class="aou"/>
+			<link field="values" reltype="has_many" key="hard_due_date" map="" class="chddv"/>
 		</links>
 		<permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
             <actions>
@@ -3565,7 +3568,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
 	<class id="chddv" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="config::hard_due_date_values" oils_persist:tablename="config.hard_due_date_values" reporter:label="Hard Due Date Values">
 		<fields oils_persist:primary="id" oils_persist:sequence="config.hard_due_date_values_id_seq">
 			<field reporter:label="ID" name="id" reporter:datatype="id"/>
-			<field reporter:label="Hard Due Date" name="hard_due_date" reporter:datatype="link"/>
+			<field reporter:label="Hard Due Date" name="hard_due_date" reporter:datatype="link" config_field="true"/>
 			<field reporter:label="Ceiling Date" name="ceiling_date" reporter:datatype="timestamp"/>
             <field reporter:label="Active Date" name="active_date" reporter:datatype="timestamp"/>
 		</fields>
diff --git a/Open-ILS/src/eg2/src/app/staff/admin/basic-admin-page.component.ts b/Open-ILS/src/eg2/src/app/staff/admin/basic-admin-page.component.ts
index ceed28792d..1c9b4c80a3 100644
--- a/Open-ILS/src/eg2/src/app/staff/admin/basic-admin-page.component.ts
+++ b/Open-ILS/src/eg2/src/app/staff/admin/basic-admin-page.component.ts
@@ -13,6 +13,7 @@ import {IdlService} from '@eg/core/idl.service';
       <eg-staff-banner bannerText="{{classLabel}} Configuration" i18n-bannerText>
       </eg-staff-banner>
       <eg-admin-page persistKeyPfx="{{persistKeyPfx}}" idlClass="{{idlClass}}"
+        configLinkBasePath="{{configLinkBasePath}}"
         readonlyFields="{{readonlyFields}}"
         [disableOrgFilter]="disableOrgFilter"></eg-admin-page>
     `
@@ -24,6 +25,7 @@ export class BasicAdminPageComponent implements OnInit {
     classLabel: string;
     persistKeyPfx: string;
     readonlyFields = '';
+    configLinkBasePath = '/staff/admin';
 
     // Tell the admin page to disable and hide the automagic org unit filter
     disableOrgFilter: boolean;
@@ -59,6 +61,8 @@ export class BasicAdminPageComponent implements OnInit {
             // ACQ is a special case, because unlike 'server', 'local',
             // 'workstation', the schema ('acq') is the root of the path.
             this.persistKeyPfx = '';
+        } else {
+            this.configLinkBasePath += '/' + this.persistKeyPfx;
         }
 
         // Pass the readonlyFields param if available
diff --git a/Open-ILS/src/eg2/src/app/staff/admin/local/admin-carousel.component.ts b/Open-ILS/src/eg2/src/app/staff/admin/local/admin-carousel.component.ts
index bfbd4204a5..e344688ee9 100644
--- a/Open-ILS/src/eg2/src/app/staff/admin/local/admin-carousel.component.ts
+++ b/Open-ILS/src/eg2/src/app/staff/admin/local/admin-carousel.component.ts
@@ -1,4 +1,6 @@
 import {Component, Input, ViewChild, OnInit} from '@angular/core';
+import {Location} from '@angular/common';
+import {FormatService} from '@eg/core/format.service';
 import {AdminPageComponent} from '@eg/staff/share/admin-page/admin-page.component';
 import {ActivatedRoute} from '@angular/router';
 import {IdlService, IdlObject} from '@eg/core/idl.service';
@@ -28,6 +30,8 @@ export class AdminCarouselComponent extends AdminPageComponent implements OnInit
 
     constructor(
         route: ActivatedRoute,
+        ngLocation: Location,
+        format: FormatService,
         idl: IdlService,
         org: OrgService,
         auth: AuthService,
@@ -36,7 +40,7 @@ export class AdminCarouselComponent extends AdminPageComponent implements OnInit
         toast: ToastService,
         private net: NetService
     ) {
-        super(route, idl, org, auth, pcrud, perm, toast);
+        super(route, ngLocation, format, idl, org, auth, pcrud, perm, toast);
     }
 
     ngOnInit() {
diff --git a/Open-ILS/src/eg2/src/app/staff/share/admin-page/admin-page.component.html b/Open-ILS/src/eg2/src/app/staff/share/admin-page/admin-page.component.html
index 09c15579d9..b7dec5c125 100644
--- a/Open-ILS/src/eg2/src/app/staff/share/admin-page/admin-page.component.html
+++ b/Open-ILS/src/eg2/src/app/staff/share/admin-page/admin-page.component.html
@@ -33,6 +33,11 @@
   <ng-container *ngTemplateOutlet="helpTemplate"></ng-container>
 </ng-container>
 
+<ng-template #configFieldLink let-row="row" let-col="col">
+  <a i18n-title title="Link To {{col.label}}"
+    [attr.href]="configFieldLinkUrl(row, col)">{{configLinkLabel(row, col)}}</a>
+</ng-template>
+
 <eg-grid #grid idlClass="{{idlClass}}" [dataSource]="dataSource" 
     [sortable]="true" persistKey="{{persistKey}}">
   <eg-grid-toolbar-button [disabled]="!canCreate" 
@@ -45,6 +50,10 @@
   </eg-grid-toolbar-action>
   <eg-grid-toolbar-action label="Delete Selected" i18n-label (onClick)="deleteSelected($event)">
   </eg-grid-toolbar-action>
+  <ng-container *ngFor="let cf of configFields">
+    <eg-grid-column name="{{cf.name}}" [cellTemplate]="configFieldLink">
+    </eg-grid-column>
+  </ng-container>
 </eg-grid>
 
 <eg-fm-record-editor #editDialog idlClass="{{idlClass}}" 
diff --git a/Open-ILS/src/eg2/src/app/staff/share/admin-page/admin-page.component.ts b/Open-ILS/src/eg2/src/app/staff/share/admin-page/admin-page.component.ts
index 665ebd6258..844da1e46d 100644
--- a/Open-ILS/src/eg2/src/app/staff/share/admin-page/admin-page.component.ts
+++ b/Open-ILS/src/eg2/src/app/staff/share/admin-page/admin-page.component.ts
@@ -1,7 +1,9 @@
 import {Component, Input, OnInit, TemplateRef, ViewChild} from '@angular/core';
 import {ActivatedRoute} from '@angular/router';
+import {Location} from '@angular/common';
 import {IdlService, IdlObject} from '@eg/core/idl.service';
-import {GridDataSource} from '@eg/share/grid/grid';
+import {FormatService} from '@eg/core/format.service';
+import {GridDataSource, GridColumn} from '@eg/share/grid/grid';
 import {GridComponent} from '@eg/share/grid/grid.component';
 import {TranslateComponent} from '@eg/share/translate/translate.component';
 import {ToastService} from '@eg/share/toast/toast.service';
@@ -75,6 +77,13 @@ export class AdminPageComponent implements OnInit {
     // Override field options for create/edit dialog
     @Input() fieldOptions: {[field: string]: FmFieldOptions};
 
+    // Override default values for fm-editor
+    @Input() defaultNewRecord: IdlObject;
+
+    // Used as the first part of the routerLink path when creating
+    // links to related tables via configField's.
+    @Input() configLinkBasePath: string;
+
     @ViewChild('grid') grid: GridComponent;
     @ViewChild('editDialog') editDialog: FmRecordEditorComponent;
     @ViewChild('successString') successString: StringComponent;
@@ -87,7 +96,7 @@ export class AdminPageComponent implements OnInit {
 
     idlClassDef: any;
     pkeyField: string;
-    configFields: string[];
+    configFields: any[]; // IDL field definitions
 
     // True if any columns on the object support translations
     translateRowIdx: number;
@@ -106,6 +115,8 @@ export class AdminPageComponent implements OnInit {
 
     constructor(
         private route: ActivatedRoute,
+        private ngLocation: Location,
+        private format: FormatService,
         public idl: IdlService,
         private org: OrgService,
         public auth: AuthService,
@@ -143,6 +154,7 @@ export class AdminPageComponent implements OnInit {
     }
 
     ngOnInit() {
+
         this.idlClassDef = this.idl.classes[this.idlClass];
         this.pkeyField = this.idlClassDef.pkey || 'id';
 
@@ -156,6 +168,13 @@ export class AdminPageComponent implements OnInit {
                 this.idlClassDef.table;
         }
 
+
+        // Note the field filter could be based purely on fields
+        // which are links, but that leads to cases where links
+        // are created to tables which are too big and/or admin
+        // interfaces which are not otherwise used because they
+        // have custom UI's instead.
+        // this.idlClassDef.fields.filter(f => f.datatype === 'link');
         this.configFields =
             this.idlClassDef.fields.filter(f => f.config_field);
 
@@ -235,7 +254,10 @@ export class AdminPageComponent implements OnInit {
 
             const search: any = {};
 
-            search[this.orgField] = this.searchOrgs.orgIds || [this.contextOrg.id()];
+            if (this.orgField) {
+                search[this.orgField] =
+                    this.searchOrgs.orgIds || [this.contextOrg.id()];
+            }
 
             if (this.gridFilters) {
                 // Lay the URL grid filters over our search object.
@@ -361,6 +383,82 @@ export class AdminPageComponent implements OnInit {
 
         this.translator.open({size: 'lg'});
     }
+
+    // Construct a routerLink path for a configField.
+    configFieldRouteLink(row: any, col: GridColumn): string {
+        const cf = this.configFields.filter(field => field.name === col.name)[0];
+        const linkClass = this.idl.classes[cf['class']];
+        const pathParts = linkClass.table.split(/\./); // schema.tablename
+        return `${this.configLinkBasePath}/${pathParts[0]}/${pathParts[1]}`;
+    }
+
+    // Compiles a gridFilter value used when navigating to a linked
+    // class via configField.  The filter ensures the linked page
+    // only shows rows which refer back to the object from which the
+    // link was clicked.
+    configFieldRouteParams(row: any, col: GridColumn): any {
+        const cf = this.configFields.filter(field => field.name === col.name)[0];
+        let value = this.configFieldLinkedValue(row, col);
+
+        // For certain has-a relationships, the linked object will be
+        // fleshed so its display (selector) value can be used.
+        // Extract the scalar value found at the remote target field.
+        if (value && typeof value === 'object') { value = value[cf.key](); }
+
+        const filter: any = {};
+        filter[cf.key] = value;
+
+        return {gridFilters : JSON.stringify(filter)};
+    }
+
+    // Returns the value on the local object for the field which
+    // refers to the remote object.  This may be a scalar or a
+    // fleshed IDL object.
+    configFieldLinkedValue(row: any, col: GridColumn): any {
+        const cf = this.configFields.filter(field => field.name === col.name)[0];
+        const linkClass = this.idl.classes[cf['class']];
+
+        // cf.key is the name of the field on the linked object that matches
+        // the value on our local object.
+        // In as has_many relationship, the remote field has its own
+        // 'key' value which determines which field on the local object
+        // represents the other end of the relationship.  This is
+        // typically, but not always the local pkey field.
+
+        const localField =
+            cf.reltype === 'has_many' ?
+            (linkClass.field_map[cf.key].key || this.pkeyField) : cf.name;
+
+        return row[localField]();
+    }
+
+    // Returns a URL suitable for using as an href.
+    // We use an href to jump to the secondary admin page because
+    // routerLink within the same base component results in component
+    // reuse of a series of components which were not designed with
+    // reuse in mind.
+    configFieldLinkUrl(row: any, col: GridColumn): string {
+        const path = this.configFieldRouteLink(row, col);
+        const filters = this.configFieldRouteParams(row, col);
+        const url = path + '?gridFilters=' +
+            encodeURIComponent(filters.gridFilters);
+
+        return this.ngLocation.prepareExternalUrl(url);
+    }
+
+    configLinkLabel(row: any, col: GridColumn): string {
+        const cf = this.configFields.filter(field => field.name === col.name)[0];
+
+        // Has-many links have no specific value to use for display
+        // so just use the column label.
+        if (cf.reltype === 'has_many') { return col.label; }
+
+        return this.format.transform({
+            value: row[col.name](),
+            idlClass: this.idlClass,
+            idlField: col.name
+        });
+    }
 }
 
 

commit 5b1af9dd6f33b25f8e2d11573270b7617e8bb1aa
Author: Jeff Davis <jeff.davis at bc.libraries.coop>
Date:   Tue Dec 17 16:06:19 2019 -0800

    LP#1847800 / LP#1834687: secondary admin pages: config_field attribute in IDL
    
    Signed-off-by: Jeff Davis <jeff.davis at bc.libraries.coop>
    Signed-off-by: Bill Erickson <berickxx at gmail.com>
    Signed-off-by: Chris Sharp <csharp at georgialibraries.org>

diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml
index 7e06453e25..55190ede7d 100644
--- a/Open-ILS/examples/fm_IDL.xml
+++ b/Open-ILS/examples/fm_IDL.xml
@@ -1231,7 +1231,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
             <field reporter:label="Record Format" name="record_format"  reporter:datatype="text"/>
             <field reporter:label="Transmission Format" name="transmission_format"  reporter:datatype="text"/>
             <field reporter:label="Auth" name="auth"  reporter:datatype="bool"/>
-            <field reporter:label="Attrs" name="attrs" oils_persist:virtual="true"  reporter:datatype="link"/>
+            <field reporter:label="Attrs" name="attrs" oils_persist:virtual="true"  reporter:datatype="link" config_field="true"/>
             <field reporter:label="Use Permission" name="use_perm"  reporter:datatype="link"/>
         </fields>
         <links>
diff --git a/Open-ILS/examples/fm_IDL.xsd b/Open-ILS/examples/fm_IDL.xsd
index 7ebbd51fb1..82cf1ecdda 100644
--- a/Open-ILS/examples/fm_IDL.xsd
+++ b/Open-ILS/examples/fm_IDL.xsd
@@ -61,6 +61,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
   <xs:attribute ref="reporter:label"/>
   <xs:attribute ref="reporter:datatype"/>
   <xs:attribute ref="reporter:selector"/>
+  <xs:attribute ref="config_field"/>
  </xs:complexType>
 </xs:element>
 
diff --git a/Open-ILS/src/eg2/src/app/staff/share/admin-page/admin-page.component.ts b/Open-ILS/src/eg2/src/app/staff/share/admin-page/admin-page.component.ts
index 9c76b4d32b..665ebd6258 100644
--- a/Open-ILS/src/eg2/src/app/staff/share/admin-page/admin-page.component.ts
+++ b/Open-ILS/src/eg2/src/app/staff/share/admin-page/admin-page.component.ts
@@ -87,6 +87,7 @@ export class AdminPageComponent implements OnInit {
 
     idlClassDef: any;
     pkeyField: string;
+    configFields: string[];
 
     // True if any columns on the object support translations
     translateRowIdx: number;
@@ -113,6 +114,7 @@ export class AdminPageComponent implements OnInit {
         public toast: ToastService
     ) {
         this.translatableFields = [];
+        this.configFields = [];
     }
 
     applyOrgValues(orgId?: number) {
@@ -154,6 +156,9 @@ export class AdminPageComponent implements OnInit {
                 this.idlClassDef.table;
         }
 
+        this.configFields =
+            this.idlClassDef.fields.filter(f => f.config_field);
+
         // gridFilters are a JSON encoded string
         const filters = this.route.snapshot.queryParamMap.get('gridFilters');
         if (filters) {
diff --git a/Open-ILS/xsl/fm_IDL2js.xsl b/Open-ILS/xsl/fm_IDL2js.xsl
index aeb4573f48..cf7b7450a5 100644
--- a/Open-ILS/xsl/fm_IDL2js.xsl
+++ b/Open-ILS/xsl/fm_IDL2js.xsl
@@ -47,7 +47,7 @@ for (var c in _preload_fieldmapper_IDL) {
  
 <!-- to simplify the logic, the first and last field are assumed to
      have values (and practically always will) -->
-<xsl:template name='printField'>{name:"<xsl:value-of select="@name"/>",<xsl:if test="@reporter:label != ''">label:"<xsl:value-of select="@reporter:label"/>",</xsl:if><xsl:if test="@oils_persist:primitive = 'true'">primitive:true,</xsl:if><xsl:if test="@reporter:selector != ''">selector:"<xsl:value-of select="@reporter:selector"/>",</xsl:if><xsl:if test="@oils_persist:virtual = 'true'">virtual:true,</xsl:if><xsl:if test="@oils_obj:required = 'true'">required:true,</xsl:if><xsl:if test="@oils_persist:i18n = 'true'">i18n:true,</xsl:if><xsl:call-template name='fieldOrLink'><xsl:with-param name='f' select="."/></xsl:call-template>datatype:"<xsl:call-template name='defaultValue'><xsl:with-param name='v' select="@reporter:datatype"/><xsl:with-param name='d' select="string('text')"/></xsl:call-template>"}</xsl:template>
+<xsl:template name='printField'>{name:"<xsl:value-of select="@name"/>",<xsl:if test="@reporter:label != ''">label:"<xsl:value-of select="@reporter:label"/>",</xsl:if><xsl:if test="@oils_persist:primitive = 'true'">primitive:true,</xsl:if><xsl:if test="@reporter:selector != ''">selector:"<xsl:value-of select="@reporter:selector"/>",</xsl:if><xsl:if test="@oils_persist:virtual = 'true'">virtual:true,</xsl:if><xsl:if test="@oils_obj:required = 'true'">required:true,</xsl:if><xsl:if test="@oils_persist:i18n = 'true'">i18n:true,</xsl:if><xsl:if test="@config_field = 'true'">config_field:true,</xsl:if><xsl:call-template name='fieldOrLink'><xsl:with-param name='f' select="."/></xsl:call-template>datatype:"<xsl:call-template name='defaultValue'><xsl:with-param name='v' select="@reporter:datatype"/><xsl:with-param name='d' select="string('text')"/></xsl:call-template>"}</xsl:template>
  
 <xsl:template name="pcrudPerms">
     <xsl:if test="@permission">perms:[<xsl:for-each select="str:split(@permission,' ')">'<xsl:value-of select="./text()"/>'<xsl:if test="not(position() = last())">,</xsl:if></xsl:for-each>]</xsl:if>

-----------------------------------------------------------------------

Summary of changes:
 Open-ILS/examples/fm_IDL.xml                       |  33 +++---
 Open-ILS/examples/fm_IDL.xsd                       |   1 +
 .../app/staff/admin/basic-admin-page.component.ts  |   4 +
 .../staff/admin/local/admin-carousel.component.ts  |   6 +-
 .../share/admin-page/admin-page.component.html     |  37 ++++--
 .../staff/share/admin-page/admin-page.component.ts | 127 ++++++++++++++++++++-
 Open-ILS/xsl/fm_IDL2js.xsl                         |   2 +-
 7 files changed, 185 insertions(+), 25 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list