LP1811288 Admin grids preload combobox values
authorBill Erickson <berickxx@gmail.com>
Fri, 22 Mar 2019 21:43:34 +0000 (14:43 -0700)
committerDan Wells <dbw2@calvin.edu>
Mon, 25 Mar 2019 20:59:00 +0000 (16:59 -0400)
Adds a global option to the fieldmapper editor component to preload
linked selector values by default.  Update the basic admin pages to use
the new flag to preload comboboxes.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Jane Sandberg <sandbej@linnbenton.edu>
Signed-off-by: Dan Wells <dbw2@calvin.edu>
Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor.component.ts
Open-ILS/src/eg2/src/app/staff/share/admin-page/admin-page.component.html

index ec8d0b1..3e41fa2 100644 (file)
@@ -117,6 +117,10 @@ export class FmRecordEditorComponent
     // IDL record display label.  Defaults to the IDL label.
     @Input() recordLabel: string;
 
+    // When true at the component level, pre-fetch the combobox data
+    // for all combobox fields.  See also FmFieldOptions.
+    @Input() preloadLinkedValues: boolean;
+
     // Emit the modified object when the save action completes.
     @Output() onSave$ = new EventEmitter<IdlObject>();
 
@@ -368,6 +372,13 @@ export class FmRecordEditorComponent
 
         const fieldOptions = this.fieldOptions[field.name] || {};
 
+        // globally preloading unless a field-specific value is set.
+        if (this.preloadLinkedValues) {
+            if (!('preloadLinkedValues' in fieldOptions)) {
+                fieldOptions.preloadLinkedValues = true;
+            }
+        }
+
         const selector = fieldOptions.linkedSearchField ||
             this.getClassSelector(field.class);
 
index 95819f0..7a47a3d 100644 (file)
@@ -62,7 +62,8 @@
   </eg-grid-toolbar-action>
 </eg-grid>
 
-<eg-fm-record-editor #editDialog idlClass="{{idlClass}}" readonlyFields="{{readonlyFields}}">
+<eg-fm-record-editor #editDialog idlClass="{{idlClass}}" 
+    [preloadLinkedValues]="true" readonlyFields="{{readonlyFields}}">
 </eg-fm-record-editor>