X-Git-Url: https://git.evergreen-ils.org/?p=Evergreen.git;a=blobdiff_plain;f=Open-ILS%2Fsrc%2Feg2%2Fsrc%2Fapp%2Fstaff%2Fadmin%2Fbasic-admin-page.component.ts;h=ceed28792dfc070752367aaa30bc2e6bdfc5b8d2;hp=0427646abc4b41674057a152570596a8ac68557b;hb=fe1ff53dba6dffc9fdcbf5665128553e265e5e6b;hpb=2e60910340c3d7c55685e6421f4749f86092e19c
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 0427646abc..ceed28792d 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
@@ -8,9 +8,13 @@ import {IdlService} from '@eg/core/idl.service';
@Component({
template: `
+
+
-
+
`
})
@@ -19,7 +23,10 @@ export class BasicAdminPageComponent implements OnInit {
idlClass: string;
classLabel: string;
persistKeyPfx: string;
- readonlyFields: string = '';
+ readonlyFields = '';
+
+ // Tell the admin page to disable and hide the automagic org unit filter
+ disableOrgFilter: boolean;
constructor(
private route: ActivatedRoute,
@@ -39,34 +46,45 @@ export class BasicAdminPageComponent implements OnInit {
const data = this.route.snapshot.data[0];
if (data) { table = data.table; }
}
- const full_table = schema + '.' + table;
-
+ const fullTable = schema + '.' + table;
// Set the prefix to "server", "local", "workstation",
// extracted from the URL path.
+ // For admin pages that use none of these, avoid setting
+ // the prefix because that will cause it to double-up.
+ // e.g. eg.grid.acq.acq.cancel_reason
this.persistKeyPfx = this.route.snapshot.parent.url[0].path;
- if (this.persistKeyPfx === 'acq') {
- // ACQ is a special case, becaus unlike 'server', 'local',
+ const selfPrefixers = ['acq', 'booking'];
+ if (selfPrefixers.indexOf(this.persistKeyPfx) > -1) {
+ // ACQ is a special case, because unlike 'server', 'local',
// 'workstation', the schema ('acq') is the root of the path.
this.persistKeyPfx = '';
}
// Pass the readonlyFields param if available
- if (this.route.snapshot.data[0].readonlyFields) {
- this.readonlyFields = this.route.snapshot.data[0].readonlyFields;
- }
+ if (this.route.snapshot.data && this.route.snapshot.data[0]) {
+ // snapshot.data is a HASH.
+ const data = this.route.snapshot.data[0];
+ if (data.readonlyFields) {
+ this.readonlyFields = data.readonlyFields;
+ }
+
+ if (data.disableOrgFilter) {
+ this.disableOrgFilter = true;
+ }
+ }
Object.keys(this.idl.classes).forEach(class_ => {
const classDef = this.idl.classes[class_];
- if (classDef.table === full_table) {
+ if (classDef.table === fullTable) {
this.idlClass = class_;
this.classLabel = classDef.label;
}
});
if (!this.idlClass) {
- throw new Error('Unable to find IDL class for table ' + full_table);
+ throw new Error('Unable to find IDL class for table ' + fullTable);
}
}
}