AMBARI-19603. Issue with delete action node operation. (Belliraj HB via gauravn7)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/d38fed3d Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/d38fed3d Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/d38fed3d Branch: refs/heads/branch-dev-patch-upgrade Commit: d38fed3d470e5a7e2cb36625bc7c9b3d568e6b5c Parents: d2862fc Author: Gaurav Nagar <grv...@gmail.com> Authored: Fri Jan 27 11:28:47 2017 +0530 Committer: Gaurav Nagar <grv...@gmail.com> Committed: Fri Jan 27 11:28:47 2017 +0530 ---------------------------------------------------------------------- .../ui/app/domain/cytoscape-flow-renderer.js | 2 +- .../src/main/resources/ui/app/domain/node.js | 45 +++++++++++++++++--- .../main/resources/ui/app/domain/workflow.js | 2 +- 3 files changed, 42 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/d38fed3d/contrib/views/wfmanager/src/main/resources/ui/app/domain/cytoscape-flow-renderer.js ---------------------------------------------------------------------- diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/domain/cytoscape-flow-renderer.js b/contrib/views/wfmanager/src/main/resources/ui/app/domain/cytoscape-flow-renderer.js index 96426ce..17fb4a0 100644 --- a/contrib/views/wfmanager/src/main/resources/ui/app/domain/cytoscape-flow-renderer.js +++ b/contrib/views/wfmanager/src/main/resources/ui/app/domain/cytoscape-flow-renderer.js @@ -104,7 +104,7 @@ var CytoscapeRenderer= Ember.Object.extend({ }); if (node.transitions.length > 0) { node.transitions.forEach(function(transition){ - if (transition.isOnError()){ + if (transition.isOnError()|| transition.targetNode.isKillNode()){ return; } self.get('dataNodes').pushObject( http://git-wip-us.apache.org/repos/asf/ambari/blob/d38fed3d/contrib/views/wfmanager/src/main/resources/ui/app/domain/node.js ---------------------------------------------------------------------- diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/domain/node.js b/contrib/views/wfmanager/src/main/resources/ui/app/domain/node.js index cda7609..db5bf1e 100644 --- a/contrib/views/wfmanager/src/main/resources/ui/app/domain/node.js +++ b/contrib/views/wfmanager/src/main/resources/ui/app/domain/node.js @@ -151,6 +151,33 @@ var Node = Ember.Object.extend(FindNodeMixin,{ }); return count; }, + getDefaultConditionTarget(){ + var target; + var transitions=this.get("transitions"); + transitions.forEach(function(tran){ + if (tran.condition==="default"){ + target=tran.targetNode; + } + }); + return target; + }, + getNonKillNodeTarget(){ + var nonKillNodeCount=0; + var nonKillNode; + var transitions=this.get("transitions"); + transitions.forEach(function(tran){ + if (!tran.targetNode.isKillNode()){ + nonKillNodeCount++; + nonKillNode=tran.targetNode; + } + }); + if (nonKillNodeCount>0){ + return nonKillNode; + }else{ + console.log("no non kill nodes transitions."); + return null; + } + }, getDefaultTransitionTarget(){ if (this.isForkNode()){ return this.findNodeById(this,"join_"+this.get("id")); @@ -161,12 +188,17 @@ var Node = Ember.Object.extend(FindNodeMixin,{ }else if (transitions.length===1){ return transitions[0].targetNode; } - var target=transitions[0].targetNode; - transitions.forEach(function(tran){ - if (tran.condition==="default"){ - target=tran.targetNode; + var target; + if (this.isDecisionNode()){ + var defaultTarget=this.getDefaultConditionTarget(); + if (defaultTarget.isKillNode()){ + target=this.getNonKillNodeTarget(); + }else{ + target=defaultTarget; } - }); + }else{ + target=transitions[0].targetNode; + } if (target.isPlaceholder()){ return target.getDefaultTransitionTarget(); } @@ -206,6 +238,9 @@ var Node = Ember.Object.extend(FindNodeMixin,{ }, isDefaultKillNode(){ return this.isKillNode() && this.get("name")===Constants.defaultKillNodeName; + }, + isEndNode(){ + return this.get("type")==="end"; } }); export {Node}; http://git-wip-us.apache.org/repos/asf/ambari/blob/d38fed3d/contrib/views/wfmanager/src/main/resources/ui/app/domain/workflow.js ---------------------------------------------------------------------- diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/domain/workflow.js b/contrib/views/wfmanager/src/main/resources/ui/app/domain/workflow.js index 9040bb8..900d692 100644 --- a/contrib/views/wfmanager/src/main/resources/ui/app/domain/workflow.js +++ b/contrib/views/wfmanager/src/main/resources/ui/app/domain/workflow.js @@ -168,7 +168,7 @@ var Workflow= Ember.Object.extend(FindNodeMixin,{ deleteNode(node){ var self=this; var target=node.getDefaultTransitionTarget(); - if (node.isForkNode()|| node.isDecisionNode()){ + if (!target.isEndNode() && (node.isForkNode()|| node.isDecisionNode())){ target=this.findJoinNode(node); if (!target){//A bug will give target as null if the decision has single path. target=node.getDefaultTransitionTarget();