[open-ils-commits] [GIT] Evergreen ILS branch rel_3_3 updated. 9a9ddad891cb3ce898b94566ce6cb907ba781363

Evergreen Git git at git.evergreen-ils.org
Fri May 10 14:03:09 EDT 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_3 has been updated
       via  9a9ddad891cb3ce898b94566ce6cb907ba781363 (commit)
      from  8eadece4af39f78d5fb0b9b012ad1a5b085bf303 (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 9a9ddad891cb3ce898b94566ce6cb907ba781363
Author: Bill Erickson <berickxx at gmail.com>
Date:   Tue Apr 9 11:43:10 2019 -0400

    LP1823982 Vandelay Match Set new tree repair
    
    When creating a new Match Set expression, provide a default root
    'AND' node upon which new nodes may be added.
    
    Signed-off-by: Bill Erickson <berickxx at gmail.com>
    Signed-off-by: Jane Sandberg <sandbej at linnbenton.edu>

diff --git a/Open-ILS/src/eg2/src/app/staff/cat/vandelay/match-set-expression.component.html b/Open-ILS/src/eg2/src/app/staff/cat/vandelay/match-set-expression.component.html
index fe7d8171c9..9a5ee0ce19 100644
--- a/Open-ILS/src/eg2/src/app/staff/cat/vandelay/match-set-expression.component.html
+++ b/Open-ILS/src/eg2/src/app/staff/cat/vandelay/match-set-expression.component.html
@@ -49,7 +49,7 @@
     <ng-container *ngIf="tree">
       <div class="d-flex">
         <button class="btn btn-warning mr-1" (click)="deleteNode()" 
-          [disabled]="!hasSelectedNode()" i18n>
+          [disabled]="!hasSelectedNode() || isRootNode()" i18n>
           Remove Selected Node
         </button>
         <button class="btn btn-success mr-1" (click)="saveTree()"
diff --git a/Open-ILS/src/eg2/src/app/staff/cat/vandelay/match-set-expression.component.ts b/Open-ILS/src/eg2/src/app/staff/cat/vandelay/match-set-expression.component.ts
index f02ab214ba..f93c1e7d41 100644
--- a/Open-ILS/src/eg2/src/app/staff/cat/vandelay/match-set-expression.component.ts
+++ b/Open-ILS/src/eg2/src/app/staff/cat/vandelay/match-set-expression.component.ts
@@ -56,9 +56,36 @@ export class MatchSetExpressionComponent implements OnInit {
         return this.pcrud.search('vmsp',
             {match_set: this.matchSet_.id()}, {},
             {atomic: true, authoritative: true}
-        ).toPromise().then(points => this.ingestMatchPoints(points));
+        ).toPromise().then(points => {
+            if (points.length > 0) {
+                this.ingestMatchPoints(points);
+            } else {
+                this.addRootNode();
+            }
+        });
+    }
+
+    // When creating a new tree, add a stub boolean node
+    // as the root so the tree has something to render.
+    addRootNode() {
+
+        const point = this.idl.create('vmsp');
+        point.id(this.newId--);
+        point.isnew(true);
+        point.match_set(this.matchSet_.id());
+        point.children([]);
+        point.bool_op('AND');
+
+        const node: TreeNode = new TreeNode({
+            id: point.id(),
+            callerData: {point: point}
+        });
+
+        this.tree = new Tree(node);
+        this.setNodeLabel(node, point);
     }
 
+    // Tree-ify a set of match points.
     ingestMatchPoints(points: IdlObject[]) {
         const nodes = [];
         const idmap: any = {};
@@ -118,6 +145,14 @@ export class MatchSetExpressionComponent implements OnInit {
         return Boolean(this.tree.selectedNode());
     }
 
+    isRootNode(): boolean {
+        const node = this.tree.selectedNode();
+        if (node && this.tree.findParentNode(node) === null) {
+            return true;
+        }
+        return false;
+    }
+
     selectedIsBool(): boolean {
         if (this.tree) {
             const node = this.tree.selectedNode();

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

Summary of changes:
 .../vandelay/match-set-expression.component.html   |  2 +-
 .../cat/vandelay/match-set-expression.component.ts | 37 +++++++++++++++++++++-
 2 files changed, 37 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list