LP1860468 Org unit admin interface sorting
authorBill Erickson <berickxx@gmail.com>
Wed, 22 Jan 2020 15:10:20 +0000 (10:10 -0500)
committerBill Erickson <berickxx@gmail.com>
Tue, 18 Feb 2020 16:08:58 +0000 (11:08 -0500)
Sort org units by name alphabetically in the Angular Org Unit admin
interface navigation tree.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Lynn Floyd <lfloyd1@library.in.gov>
Open-ILS/src/eg2/src/app/staff/admin/server/org-unit.component.ts

index 20321b9..ff5a184 100644 (file)
@@ -96,7 +96,12 @@ export class OrgUnitComponent implements OnInit {
                 'admin.server.org_unit.treenode', {org: orgNode}
             ).then(label => treeNode.label = label);
 
-            orgNode.children().forEach(childNode =>
+            // Tree node labels are "name -- shortname".  Sorting
+            // by name suffices and bypasses the need the wait
+            // for all of the labels to interpolate.
+            orgNode.children()
+            .sort((a, b) => a.name() < b.name() ? -1 : 1)
+            .forEach(childNode =>
                 treeNode.children.push(handleNode(childNode))
             );