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>
'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))
);