From: Bill Erickson Date: Tue, 11 Aug 2020 15:07:04 +0000 (-0400) Subject: LP1839562 Ang Vandelay Match Set Replace Mode X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=345134aac6cb4af9be1464a148d491a3102bc651;p=evergreen%2Fequinox.git LP1839562 Ang Vandelay Match Set Replace Mode Recover "Replace Mode" functionality in the Vandelay Match Set editor interface, so existing nodes (e.g. And) may be replaced with other nodes (e.g. Or) without modifying the rest of the tree structure. Values (Record Attrs / MARC Fields) can replace other values. Booleans can replace any type of tree node. Signed-off-by: Bill Erickson Signed-off-by: Mary Llewellyn Signed-off-by: Christine Morgan Signed-off-by: Galen Charlton --- 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 9a5ee0ce19..004b7c1cb3 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 @@ -35,6 +35,13 @@ [disabled]="!selectedIsBool()" i18n> Add To Selected Node + + +
    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 891b01a5ff..86c4b76bd1 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 @@ -161,16 +161,27 @@ export class MatchSetExpressionComponent implements OnInit { return false; } - addChildNode() { + addChildNode(replace?: boolean) { this.changesMade = true; - const pnode = this.tree.selectedNode(); - const point = this.idl.create('vmsp'); - point.id(this.newId--); - point.isnew(true); - point.parent(pnode.id); - point.match_set(this.matchSet_.id()); - point.children([]); + const targetNode: TreeNode = this.tree.selectedNode(); + let point; + + if (replace) { + point = targetNode.callerData.point; + point.ischanged(true); + // Clear previous data + ['bool_op', 'svf', 'tag', 'subfield', 'heading'] + .forEach(f => point[f](null)); + + } else { + point = this.idl.create('vmsp'); + point.id(this.newId--); + point.isnew(true); + point.parent(targetNode.id); + point.match_set(this.matchSet_.id()); + point.children([]); + } const ptype = this.newPoint.values.pointType; @@ -193,13 +204,22 @@ export class MatchSetExpressionComponent implements OnInit { point.quality(this.newPoint.values.matchScore); } - const node: TreeNode = new TreeNode({ - id: point.id(), - callerData: {point: point} - }); + if (replace) { + + targetNode.label = null; + this.setNodeLabel(targetNode, point); + + } else { - // Match points are added to the DB only when the tree is saved. - this.setNodeLabel(node, point).then(() => pnode.children.push(node)); + const node: TreeNode = new TreeNode({ + id: point.id(), + callerData: {point: point} + }); + + // Match points are added to the DB only when the tree is saved. + this.setNodeLabel(node, point) + .then(() => targetNode.children.push(node)); + } } expressionAsString(): string {