Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 96CFC200C15 for ; Wed, 8 Feb 2017 12:05:19 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 95491160B5A; Wed, 8 Feb 2017 11:05:19 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id B8320160B4E for ; Wed, 8 Feb 2017 12:05:18 +0100 (CET) Received: (qmail 52509 invoked by uid 500); 8 Feb 2017 11:05:18 -0000 Mailing-List: contact commits-help@ambari.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: ambari-dev@ambari.apache.org Delivered-To: mailing list commits@ambari.apache.org Received: (qmail 52500 invoked by uid 99); 8 Feb 2017 11:05:17 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 08 Feb 2017 11:05:17 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id D28FFDFB0E; Wed, 8 Feb 2017 11:05:17 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: pallavkul@apache.org To: commits@ambari.apache.org Message-Id: <3803d507b1dc4bc389d1a85aa2308323@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: ambari git commit: AMBARI-19889. Workflow Manager Should be able to handle fork with single path. (Belliraj via pallavkul) Date: Wed, 8 Feb 2017 11:05:17 +0000 (UTC) archived-at: Wed, 08 Feb 2017 11:05:19 -0000 Repository: ambari Updated Branches: refs/heads/branch-2.5 9eb8d2f76 -> a5d3f4229 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/a5d3f422 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/a5d3f422 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/a5d3f422 Branch: refs/heads/branch-2.5 Commit: a5d3f4229f7f51fa0b21b6be7e0411105ab30060 Parents: 9eb8d2f Author: pallavkul Authored: Wed Feb 8 16:33:19 2017 +0530 Committer: pallavkul Committed: Wed Feb 8 16:35:01 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/a5d3f422/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/a5d3f422/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/a5d3f422/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/a5d3f422/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; }