[open-ils-commits] [GIT] Evergreen ILS branch rel_3_4 updated. 12ae55c06e54c1631f1d4d6d5f578940da2fa895

Evergreen Git git at git.evergreen-ils.org
Mon Dec 30 10:17:40 EST 2019


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, rel_3_4 has been updated
       via  12ae55c06e54c1631f1d4d6d5f578940da2fa895 (commit)
       via  b26e29d6ada7b194a1226ba8d6813cdc45aba49d (commit)
      from  7fe992abef62c3beb6438b9c7af0801ed175ff69 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 12ae55c06e54c1631f1d4d6d5f578940da2fa895
Author: Galen Charlton <gmc at equinoxinitiative.org>
Date:   Fri Dec 27 17:50:08 2019 -0500

    LP#1857350: (follow-up) fix lint issue
    
    Signed-off-by: Galen Charlton <gmc at equinoxinitiative.org>
    Signed-off-by: Bill Erickson <berickxx at gmail.com>

diff --git a/Open-ILS/src/eg2/src/app/share/org-select/org-select.component.ts b/Open-ILS/src/eg2/src/app/share/org-select/org-select.component.ts
index a02b0c08e4..81d1f6469a 100644
--- a/Open-ILS/src/eg2/src/app/share/org-select/org-select.component.ts
+++ b/Open-ILS/src/eg2/src/app/share/org-select/org-select.component.ts
@@ -100,6 +100,8 @@ export class OrgSelectComponent implements OnInit {
     // Does not fire on initialOrg
     @Output() onChange = new EventEmitter<IdlObject>();
 
+    sortedOrgs: IdlObject[] = [];
+
     // convenience method to get an IdlObject representing the current
     // selected org unit. One way of invoking this is via a template
     // reference variable.
@@ -110,8 +112,6 @@ export class OrgSelectComponent implements OnInit {
         return this.org.get(this.selected.id);
     }
 
-    sortedOrgs: IdlObject[] = [];
-
     constructor(
       private auth: AuthService,
       private store: StoreService,

commit b26e29d6ada7b194a1226ba8d6813cdc45aba49d
Author: Bill Erickson <berickxx at gmail.com>
Date:   Thu Dec 26 13:18:26 2019 -0500

    LP1857350 Org selector sorts by display value
    
    When displaying the org unit selector, sort each set of children by the
    display label (defaults to shortname).
    
    Fixes issues with the org server sortTree function and adds a unit test
    to test the repaired sort function.
    
    Signed-off-by: Bill Erickson <berickxx at gmail.com>
    Signed-off-by: Galen Charlton <gmc at equinoxinitiative.org>

diff --git a/Open-ILS/src/eg2/src/app/core/org.service.ts b/Open-ILS/src/eg2/src/app/core/org.service.ts
index 6615851312..2a2a59dfd7 100644
--- a/Open-ILS/src/eg2/src/app/core/org.service.ts
+++ b/Open-ILS/src/eg2/src/app/core/org.service.ts
@@ -161,11 +161,11 @@ export class OrgService {
         if (!sortField) { sortField = 'shortname'; }
         if (!node) { node = this.orgTree; }
         node.children(
-            node.children.sort((a, b) => {
+            node.children().sort((a, b) => {
                 return a[sortField]() < b[sortField]() ? -1 : 1;
             })
         );
-        node.children.forEach(n => this.sortTree(n));
+        node.children().forEach(n => this.sortTree(sortField, n));
     }
 
     absorbTree(node?: IdlObject): void {
diff --git a/Open-ILS/src/eg2/src/app/core/org.spec.ts b/Open-ILS/src/eg2/src/app/core/org.spec.ts
index 90c5ac599f..9ebb028f12 100644
--- a/Open-ILS/src/eg2/src/app/core/org.spec.ts
+++ b/Open-ILS/src/eg2/src/app/core/org.spec.ts
@@ -64,6 +64,12 @@ describe('OrgService', () => {
         expect(orgService.root().id()).toEqual(1);
     });
 
+    it('should sort tree by shortname', () => {
+        initTestData();
+        orgService.sortTree('shortname');
+        expect(orgService.root().children()[0].shortname()).toEqual('A');
+    });
+
 });
 
 
diff --git a/Open-ILS/src/eg2/src/app/share/org-select/org-select.component.ts b/Open-ILS/src/eg2/src/app/share/org-select/org-select.component.ts
index dc14debcbf..a02b0c08e4 100644
--- a/Open-ILS/src/eg2/src/app/share/org-select/org-select.component.ts
+++ b/Open-ILS/src/eg2/src/app/share/org-select/org-select.component.ts
@@ -110,6 +110,8 @@ export class OrgSelectComponent implements OnInit {
         return this.org.get(this.selected.id);
     }
 
+    sortedOrgs: IdlObject[] = [];
+
     constructor(
       private auth: AuthService,
       private store: StoreService,
@@ -119,6 +121,14 @@ export class OrgSelectComponent implements OnInit {
 
     ngOnInit() {
 
+        // Sort the tree and reabsorb to propagate the sorted nodes to the
+        // org.list() used by this component.
+        this.org.sortTree(this.displayField);
+        this.org.absorbTree();
+        // Maintain our own copy of the org list in case the org service
+        // is sorted in a different manner by other parts of the code.
+        this.sortedOrgs = this.org.list();
+
         // Apply a default org unit if desired and possible.
         if (!this.startOrg && this.applyDefault && this.auth.user()) {
             // note: ws_ou defaults to home_ou on the server
@@ -201,7 +211,7 @@ export class OrgSelectComponent implements OnInit {
             ),
             map(term => {
 
-                let orgs = this.org.list().filter(org =>
+                let orgs = this.sortedOrgs.filter(org =>
                     this.hidden.filter(id => org.id() === id).length === 0
                 );
 
diff --git a/Open-ILS/src/eg2/src/test_data/eg_mock.js b/Open-ILS/src/eg2/src/test_data/eg_mock.js
index 3db357974f..d0588f5c06 100644
--- a/Open-ILS/src/eg2/src/test_data/eg_mock.js
+++ b/Open-ILS/src/eg2/src/test_data/eg_mock.js
@@ -30,11 +30,13 @@ window._eg_mock_data = {
         org2.id(2); 
         org2.parent_ou(1);
         org2.ou_type(type2);
+        org2.shortname('B'); // to test sorting
 
         var org3 = idlService.create('aou'); 
         org3.id(3); 
         org3.parent_ou(1);
         org3.ou_type(type2);
+        org3.shortname('A'); // to test sorting
 
         var org4 = idlService.create('aou'); 
         org4.id(4); 

-----------------------------------------------------------------------

Summary of changes:
 Open-ILS/src/eg2/src/app/core/org.service.ts                 |  4 ++--
 Open-ILS/src/eg2/src/app/core/org.spec.ts                    |  6 ++++++
 .../src/eg2/src/app/share/org-select/org-select.component.ts | 12 +++++++++++-
 Open-ILS/src/eg2/src/test_data/eg_mock.js                    |  2 ++
 4 files changed, 21 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list