ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pallav...@apache.org
Subject ambari git commit: AMBARI-19889. Workflow Manager Should be able to handle fork with single path. (Belliraj via pallavkul)
Date Wed, 08 Feb 2017 11:04:08 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk af781d1ac -> 43f70c8d0


AMBARI-19889. Workflow Manager Should be able to handle fork with single path. (Belliraj via
pallavkul)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/43f70c8d
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/43f70c8d
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/43f70c8d

Branch: refs/heads/trunk
Commit: 43f70c8d0af543adece7196118b1e65a404f470a
Parents: af781d1
Author: pallavkul <pallav.kul@gmail.com>
Authored: Wed Feb 8 16:33:19 2017 +0530
Committer: pallavkul <pallav.kul@gmail.com>
Committed: Wed Feb 8 16:33:19 2017 +0530

----------------------------------------------------------------------
 .../src/main/resources/ui/app/domain/findnode-mixin.js    | 10 ++++++++--
 .../src/main/resources/ui/app/domain/node-handler.js      | 10 +++++++---
 .../wfmanager/src/main/resources/ui/app/domain/node.js    |  2 +-
 .../src/main/resources/ui/app/domain/workflow.js          |  5 ++---
 4 files changed, 18 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/43f70c8d/contrib/views/wfmanager/src/main/resources/ui/app/domain/findnode-mixin.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/domain/findnode-mixin.js b/contrib/views/wfmanager/src/main/resources/ui/app/domain/findnode-mixin.js
index c770fb0..fd84208 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/domain/findnode-mixin.js
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/domain/findnode-mixin.js
@@ -20,6 +20,9 @@ var FindNodeMixin= Ember.Mixin.create({
   findNodeById(startNode,id){
     return this._findNodeById(startNode,id);
   },
+  findNodeByType(startNode,type){
+    return this._findNodeByAttr(startNode,type,"type");
+  },
   findTransition(startNode,sourceId,targetId){
     return this._findTransition(startNode,sourceId,targetId);
   },
@@ -63,15 +66,18 @@ var FindNodeMixin= Ember.Mixin.create({
     return res;
   },
   _findNodeById(node,id){
+    return this._findNodeByAttr(node,id,"id");
+  },
+  _findNodeByAttr(node,id,attrType){
     var self=this;
-    if (node.get("id")===id){
+    if (node.get(attrType)===id){
       return node;
     }else{
       if (node.transitions){
         var res;
         for (var i = 0; i < node.transitions.length; i++) {
           var transition=node.transitions[i];
-          res= self._findNodeById(transition.getTargetNode(false),id);
+          res= self._findNodeByAttr(transition.getTargetNode(false),id,attrType);
           if (res){
             break;
           }

http://git-wip-us.apache.org/repos/asf/ambari/blob/43f70c8d/contrib/views/wfmanager/src/main/resources/ui/app/domain/node-handler.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/domain/node-handler.js b/contrib/views/wfmanager/src/main/resources/ui/app/domain/node-handler.js
index 28ea527..12d12d2 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/domain/node-handler.js
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/domain/node-handler.js
@@ -164,8 +164,10 @@ var DecisionNodeHandler= NodeHandler.extend({
     return this.nodeFactory.createEmptyDecisionNode(node._name);
   },
   handleImportTransitions(node,json,nodeMap){
+    var self=this;
     var defaultPath=json.switch.default._to;
-    node.addTransitionTo(nodeMap.get(defaultPath).node,"default");
+    var placeholder=self.nodeFactory.createPlaceholderNode(nodeMap.get(defaultPath).node);
+    node.addTransitionTo(placeholder,"default");
     var cases=[];
     if (Ember.isArray(json.switch.case)){
       cases=json.switch.case;
@@ -173,7 +175,8 @@ var DecisionNodeHandler= NodeHandler.extend({
       cases.push(json.switch.case);
     }
     cases.forEach(function(caseExpr){
-      node.addTransitionTo(nodeMap.get(caseExpr._to).node,caseExpr.__text);
+      var placeholder=self.nodeFactory.createPlaceholderNode(nodeMap.get(caseExpr._to).node);
+      node.addTransitionTo(placeholder,caseExpr.__text);
     });
   }
 });
@@ -190,7 +193,8 @@ var ForkNodeHandler= NodeHandler.extend({
     return this.nodeFactory.createEmptyForkNode(node._name);
   },
   handleImportTransitions(node,json,nodeMap){
-    json.path.forEach(function(path){
+    var paths=Ember.isArray(json.path)?json.path:[json.path];
+    paths.forEach(function(path){
       node.addTransitionTo(nodeMap.get(path._start).node);
     });
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/43f70c8d/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 db5bf1e..d815df1 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
@@ -180,7 +180,7 @@ var Node = Ember.Object.extend(FindNodeMixin,{
   },
   getDefaultTransitionTarget(){
     if (this.isForkNode()){
-      return this.findNodeById(this,"join_"+this.get("id"));
+      return this.findNodeByType(this,"join");
     }
     var transitions=this.get("transitions");
     if (transitions.length===0){

http://git-wip-us.apache.org/repos/asf/ambari/blob/43f70c8d/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 900d692..3ca20d2 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
@@ -70,11 +70,10 @@ var Workflow= Ember.Object.extend(FindNodeMixin,{
   },
 
   findJoinNode(node){
-    if (node.isDecisionNode() || node.isForkNode()){
+    if (node.isDecisionNode()){
       return this.findCommonTargetNode(this.startNode,node);
     }else if (node.isForkNode()) {
-      //TODO find join node by id if it is efficient later..
-      return this.findCommonTargetNode(this.startNode,node);
+      return node.getDefaultTransitionTarget();
     }else{
       return null;
     }


Mime
View raw message