From: Bill Erickson Date: Wed, 29 Apr 2020 21:27:23 +0000 (-0400) Subject: LP1847800 Admin page builds config_field links WIP X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=refs%2Fheads%2Fuser%2Fberick%2Flp1847800-secondary-admin-pages;p=working%2FEvergreen.git LP1847800 Admin page builds config_field links WIP Signed-off-by: Bill Erickson --- 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'; ` @@ -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/share/admin-page/admin-page.component.html b/Open-ILS/src/eg2/src/app/staff/share/admin-page/admin-page.component.html index e0ae6c3b03..bde59fd0d2 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,12 @@ + + {{col.label}} + + + + + + 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]; + const linkClass = this.idl.classes[cf['class']]; + + // cf.key is the name of the field on the linked object that + // refers back to this object. + + // The field definition on the linked class for the cf.key + // field has its own key, which refers to the name of the field on the + // on this object which provides the other end of the link between + // the two objects. This is typically the primary key field, + // but not necessarily. + const localField = linkClass.field_map[cf.key].key || this.pkeyField; + + const filter: any = {}; + filter[cf.key] = row[localField](); + + return {gridFilters : JSON.stringify(filter)}; + } }