From: Bill Erickson Date: Mon, 6 Aug 2018 14:33:40 +0000 (-0400) Subject: LP#1775466 Admin grid persist key options X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=d9194bb092852a562691bda02cffc9b765066c15;p=working%2FEvergreen.git LP#1775466 Admin grid persist key options 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 aa24cc7773..ccbc847076 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 @@ -10,13 +10,15 @@ import {IdlService} from '@eg/core/idl.service'; template: ` - + ` }) export class BasicAdminPageComponent implements OnInit { + idlClass: string; classLabel: string; + persistKeyPfx: string; constructor( private route: ActivatedRoute, @@ -33,6 +35,10 @@ export class BasicAdminPageComponent implements OnInit { } const table = schema + '.' + this.route.snapshot.paramMap.get('table'); + // Set the prefix to "server", "local", "workstation", + // extracted from the URL path. + this.persistKeyPfx = this.route.snapshot.parent.url[0].path; + Object.keys(this.idl.classes).forEach(class_ => { const classDef = this.idl.classes[class_]; if (classDef.table === table) { 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 003a2daaff..29d0545246 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 @@ -51,12 +51,20 @@ export class AdminPageComponent implements OnInit { // Ditto includeOrgAncestors, but descendants. @Input() includeOrgDescendants: boolean; + // Optional grid persist key. This is the part of the key + // following eg.grid. + @Input() persistKey: string; + + // Optional path component to add to the generated grid persist key, + // formatted as (for example): + // 'eg.grid.admin.${persistKeyPfx}.config.billing_type' + @Input() persistKeyPfx: string; + @ViewChild('grid') grid: GridComponent; @ViewChild('editDialog') editDialog: FmRecordEditorComponent; @ViewChild('successString') successString: StringComponent; @ViewChild('createString') createString: StringComponent; - persistKey: string; idlClassDef: any; pkeyField: string; createNew: () => void; @@ -101,7 +109,13 @@ export class AdminPageComponent implements OnInit { ngOnInit() { this.idlClassDef = this.idl.classes[this.idlClass]; this.pkeyField = this.idlClassDef.pkey || 'id'; - this.persistKey = 'admin.' + this.idlClassDef.table; + + if (!this.persistKey) { + this.persistKey = + 'admin.' + + (this.persistKeyPfx ? this.persistKeyPfx + '.' : '') + + this.idlClassDef.table; + } // Limit the view org selector to orgs where the user has // permacrud-encoded view permissions.