LP1837059 Basic admin page can propagate disableOrgFilter
authorBill Erickson <berickxx@gmail.com>
Wed, 17 Jul 2019 22:02:39 +0000 (18:02 -0400)
committerGalen Charlton <gmc@equinoxinitiative.org>
Tue, 6 Aug 2019 00:56:48 +0000 (20:56 -0400)
Allow admin pages to hide the automagic org unit filter by passing the
value in via the route.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Open-ILS/src/eg2/src/app/staff/admin/basic-admin-page.component.ts

index 472245c..ceed287 100644 (file)
@@ -13,7 +13,8 @@ import {IdlService} from '@eg/core/idl.service';
       <eg-staff-banner bannerText="{{classLabel}} Configuration" i18n-bannerText>
       </eg-staff-banner>
       <eg-admin-page persistKeyPfx="{{persistKeyPfx}}" idlClass="{{idlClass}}"
       <eg-staff-banner bannerText="{{classLabel}} Configuration" i18n-bannerText>
       </eg-staff-banner>
       <eg-admin-page persistKeyPfx="{{persistKeyPfx}}" idlClass="{{idlClass}}"
-        readonlyFields="{{readonlyFields}}"></eg-admin-page>
+        readonlyFields="{{readonlyFields}}"
+        [disableOrgFilter]="disableOrgFilter"></eg-admin-page>
     `
 })
 
     `
 })
 
@@ -24,6 +25,9 @@ export class BasicAdminPageComponent implements OnInit {
     persistKeyPfx: string;
     readonlyFields = '';
 
     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
     constructor(
         private route: ActivatedRoute,
         private idl: IdlService
@@ -58,10 +62,17 @@ export class BasicAdminPageComponent implements OnInit {
         }
 
         // Pass the readonlyFields param if available
         }
 
         // Pass the readonlyFields param if available
-        if (this.route.snapshot.data &&
-            this.route.snapshot.data[0] && // snapshot.data is a HASH.
-            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_ => {
         }
 
         Object.keys(this.idl.classes).forEach(class_ => {