From 740fdaf5466d82d3214053d7d128a92ce1355d67 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Thu, 31 May 2018 16:29:33 -0400 Subject: [PATCH] LP#1775466 admin ui org selector descendants/ancestors Signed-off-by: Bill Erickson --- Open-ILS/src/eg2/src/app/share/grid/grid.ts | 11 ++++++--- .../share/admin-page/admin-page.component.html | 12 +++++----- .../staff/share/admin-page/admin-page.component.ts | 26 +++++++++++++++++++--- 3 files changed, 37 insertions(+), 12 deletions(-) diff --git a/Open-ILS/src/eg2/src/app/share/grid/grid.ts b/Open-ILS/src/eg2/src/app/share/grid/grid.ts index e6a2defbf4..805c5db675 100644 --- a/Open-ILS/src/eg2/src/app/share/grid/grid.ts +++ b/Open-ILS/src/eg2/src/app/share/grid/grid.ts @@ -316,9 +316,14 @@ export class EgGridContext { } reload() { - this.pager.reset(); - this.dataSource.reset(); - this.dataSource.requestPage(this.pager); + // Give the UI time to settle before reloading grid data. + // This can help when data retrieval depends on a value + // getting modified by an angular digest cycle. + setTimeout(() => { + this.pager.reset(); + this.dataSource.reset(); + this.dataSource.requestPage(this.pager); + }); } // Subscribe or unsubscribe to page-change events from the pager. diff --git a/Open-ILS/src/eg2/src/app/staff/share/admin-page/admin-page.component.html b/Open-ILS/src/eg2/src/app/staff/share/admin-page/admin-page.component.html index be72a23a52..1480593c61 100644 --- a/Open-ILS/src/eg2/src/app/staff/share/admin-page/admin-page.component.html +++ b/Open-ILS/src/eg2/src/app/staff/share/admin-page/admin-page.component.html @@ -19,14 +19,14 @@
- - + +
-
-
- - + +
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 48b938f07b..a9b4fccd2f 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 @@ -44,6 +44,13 @@ export class EgAdminPageComponent implements OnInit { // Disable the auto-matic org unit field filter @Input() disableOrgFilter: boolean; + // Include objects linking to org units which are ancestors + // of the selected org unit. + @Input() includeOrgAncestors: boolean; + + // Ditto includeOrgAncestors, but descendants. + @Input() includeOrgDescendants: boolean; + @ViewChild('grid') grid: EgGridComponent; @ViewChild('editDialog') editDialog: FmRecordEditorComponent; @ViewChild('successString') successString: EgStringComponent; @@ -165,10 +172,23 @@ export class EgAdminPageComponent implements OnInit { }; if (this.contextOrg) { - // TODO: does the org path need to be configurable? + // Filter rows by those linking to the context org and + // optionally ancestor and descendant org units. + + let orgs = [this.contextOrg.id()]; + + if (this.includeOrgAncestors) { + orgs = this.org.ancestors(this.contextOrg, true); + } + + if (this.includeOrgDescendants) { + // can result in duplicate workstation org IDs... meh + orgs = orgs.concat( + this.org.descendants(this.contextOrg, true)); + } + const search = {}; - search[this.orgField] = - this.org.fullPath(this.contextOrg, true); + search[this.orgField] = orgs; return this.pcrud.search(this.idlClass, search, searchOps); } -- 2.11.0