template: `
<eg-staff-banner bannerText="{{classLabel}} Configuration" i18n-bannerText>
</eg-staff-banner>
- <eg-admin-page idlClass="{{idlClass}}"></eg-admin-page>
+ <eg-admin-page persistKeyPfx="{{persistKeyPfx}}" idlClass="{{idlClass}}"></eg-admin-page>
`
})
export class BasicAdminPageComponent implements OnInit {
+
idlClass: string;
classLabel: string;
+ persistKeyPfx: string;
constructor(
private route: ActivatedRoute,
}
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) {
// 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;
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.