LP1837059 Basic admin page can propagate disableOrgFilter
[Evergreen.git] / Open-ILS / src / eg2 / src / app / staff / admin / basic-admin-page.component.ts
index d47d92a..ceed287 100644 (file)
@@ -8,9 +8,13 @@ import {IdlService} from '@eg/core/idl.service';
 
 @Component({
     template: `
+      <eg-title i18n-prefix prefix="{{classLabel}} Administration">
+      </eg-title>
       <eg-staff-banner bannerText="{{classLabel}} Configuration" i18n-bannerText>
       </eg-staff-banner>
-      <eg-admin-page persistKeyPfx="{{persistKeyPfx}}" idlClass="{{idlClass}}" readonlyFields="{{readonlyFields}}"></eg-admin-page>
+      <eg-admin-page persistKeyPfx="{{persistKeyPfx}}" idlClass="{{idlClass}}"
+        readonlyFields="{{readonlyFields}}"
+        [disableOrgFilter]="disableOrgFilter"></eg-admin-page>
     `
 })
 
@@ -21,6 +25,9 @@ export class BasicAdminPageComponent implements OnInit {
     persistKeyPfx: string;
     readonlyFields = '';
 
+    // Tell the admin page to disable and hide the automagic org unit filter
+    disableOrgFilter: boolean;
+
     constructor(
         private route: ActivatedRoute,
         private idl: IdlService
@@ -55,12 +62,18 @@ export class BasicAdminPageComponent implements OnInit {
         }
 
         // Pass the readonlyFields param if available
-        if (this.route.snapshot.data &&
-            this.route.snapshot.data.length &&
-            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_];