LP1857910 add org family selector to field doc UI
authorJason Etheridge <jason@EquinoxOLI.org>
Thu, 7 Apr 2022 16:06:17 +0000 (12:06 -0400)
committerJane Sandberg <js7389@princeton.edu>
Fri, 20 May 2022 00:16:46 +0000 (18:16 -0600)
If we want this to default to workstation org or something, we can do that, though I was having trouble
getting that to work.  Right now it'll include all orgs in its default unselected state.  I'm also not
sure about i18n-labelText and whether that works with eg-org-family-select.

Signed-off-by: Jason Etheridge <jason@EquinoxOLI.org>
Signed-off-by: Jane Sandberg <js7389@princeton.edu>
Open-ILS/src/eg2/src/app/staff/admin/local/field-documentation/field-documentation.component.html
Open-ILS/src/eg2/src/app/staff/admin/local/field-documentation/field-documentation.component.ts

index 25474a7..2227625 100644 (file)
       </div>
     </div>
   </div>
-  
+  <div class="col-md-3">
+    <eg-org-family-select
+      labelText="Owner"
+      [(ngModel)]="owning_libs"
+      (ngModelChange)="setGrid()" i18n-labelText>
+    </eg-org-family-select>
+  </div>
 </div>
 
 <div class='w-11 mt-3'>
index 664f990..62539dc 100644 (file)
@@ -11,6 +11,7 @@ import {IdlObject, IdlService} from '@eg/core/idl.service';
 import {PcrudService} from '@eg/core/pcrud.service';
 import {StringComponent} from '@eg/share/string/string.component';
 import {ToastService} from '@eg/share/toast/toast.service';
+import {OrgFamily} from '@eg/share/org-family-select/org-family-select.component';
 
 @Component({
     templateUrl: './field-documentation.component.html'
@@ -20,6 +21,7 @@ export class FieldDocumentationComponent implements OnInit {
 
     idlEntries: any[] = [];
     fieldOptions: any = {};
+    owning_libs: any[] = [];
     @Input() selectedClass: any;
     @Input() fields: [] = [];
     gridDataSource: GridDataSource;
@@ -120,14 +122,20 @@ export class FieldDocumentationComponent implements OnInit {
                     // Sort specified from grid
                     orderBy['fdoc'] = sort[0].name + ' ' + sort[0].dir;
                 }
+                const search: any = new Array();
+                const orgFilter: any = {};
+                orgFilter['owner'] = this.owning_libs['orgIds'];
+                if (orgFilter['owner'] && orgFilter['owner'][0]) {
+                    search.push(orgFilter);
+                }
+                search.push({fm_class: this.selectedClass.id});
 
                 const searchOps = {
-                    fm_class: this.selectedClass.id,
                     offset: pager.offset,
                     limit: pager.limit,
                     order_by: orderBy
                 };
-                return this.pcrud.retrieveAll('fdoc', searchOps, {fleshSelectors: true});
+                return this.pcrud.search('fdoc', search, searchOps, {fleshSelectors: true});
             };
             this.fieldDocGrid.reload();
         }