From e79e65f015d47e1a7255b670cdb843e8e1f61e49 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Wed, 6 May 2020 10:47:37 -0400 Subject: [PATCH] LP1847800 Admin grid filter display, default fields, IDL repairs * Indicate in the UI when grid filters are applied via URL and offer a way for the user to clear the filters. * When grid filters are applied, use them as the basis for the "Default New Record" object which seeds the fm-editor. In other words, apply default values to the fm-editor to match the grid filters. * Repair some IDL thinkos and add more 'selector' values. Signed-off-by: Bill Erickson Signed-off-by: Chris Sharp --- Open-ILS/examples/fm_IDL.xml | 8 +++--- .../admin-page/admin-page.component.html | 28 ++++++++++++++----- .../share/admin-page/admin-page.component.ts | 20 +++++++++++++ 3 files changed, 45 insertions(+), 11 deletions(-) diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml index 9a877b692e..fbef932552 100644 --- a/Open-ILS/examples/fm_IDL.xml +++ b/Open-ILS/examples/fm_IDL.xml @@ -218,7 +218,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - + @@ -340,7 +340,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA reporter:label="Import/Overlay Field Groups for Removal"> - + @@ -2583,7 +2583,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - + @@ -2777,7 +2777,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - + 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 c05a98b216..ceb9cbc001 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 @@ -16,13 +16,27 @@ Failed to create new {{idlClassDef.label}} - - - + +
+
+ + + + +
+
+
+ + Filters Applied: {{gridFilters | json}} + Clear Filters + +
+

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 f2684988cf..dfc85a23ef 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 @@ -191,6 +191,20 @@ export class AdminPageComponent implements OnInit { } catch (E) { console.error('Invalid grid filters provided: ', filters); } + + // Use the grid filters as the basis for our default + // new record (passed to fm-editor). + if (!this.defaultNewRecord) { + const rec = this.idl.create(this.idlClass); + Object.keys(this.gridFilters).forEach(field => { + // When filtering on the primary key of the current + // object type, avoid using it in the default new object. + if (rec[field] && this.pkeyField !== field) { + rec[field](this.gridFilters[field]); + } + }); + this.defaultNewRecord = rec; + } } // Limit the view org selector to orgs where the user has @@ -464,6 +478,12 @@ export class AdminPageComponent implements OnInit { idlField: col.name }); } + + clearGridFiltersUrl(): string { + const parts = this.idlClassDef.table.split(/\./); + const url = this.configLinkBasePath + '/' + parts[0] + '/' + parts[1]; + return this.ngLocation.prepareExternalUrl(url); + } } -- 2.43.2