Repository: ambari
Updated Branches:
  refs/heads/trunk fa527360b -> fb322e276


AMBARI-20040. Workflow Manager workflow rendering is broken in designer page. 
(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/fb322e27
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/fb322e27
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/fb322e27

Branch: refs/heads/trunk
Commit: fb322e2763382eb7aa6ed54fabb508482dcaebb0
Parents: fa52736
Author: Gaurav Nagar <grv...@gmail.com>
Authored: Thu Feb 16 18:31:00 2017 +0530
Committer: Gaurav Nagar <grv...@gmail.com>
Committed: Thu Feb 16 18:31:00 2017 +0530

----------------------------------------------------------------------
 .../ui/app/domain/cytoscape-flow-renderer.js    | 43 ++++++++++++++------
 .../resources/ui/app/domain/cytoscape-style.js  |  6 +++
 .../app/validators/duplicate-data-node-name.js  |  2 +-
 3 files changed, 38 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/fb322e27/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 4194d5e..6f46fdc 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
@@ -75,26 +75,28 @@ var CytoscapeRenderer= Ember.Object.extend({
       case 'end' :
       case 'kill' :
       case 'placeholder' :
-        return 'ellipse';
+      return 'ellipse';
       case 'action' :
-        return 'roundrectangle';
+      return 'roundrectangle';
       case 'fork' :
       case 'join' :
-        return 'roundrectangle';
+      return 'roundrectangle';
       case 'decision' :
-        return 'diamond';
+      return 'diamond';
       default :
-        return 'star';
+      return 'star';
     }
   },
 
   _getCyDataNodes(workflow){
     this.get('dataNodes').clear();
     var self=this;
+    var errorNodeCounter=1;
     workflow.nodeVisitor.process(workflow.startNode, function(node) {
       if (node.type === 'kill') {
         return;
       }
+
       self.get('dataNodes').pushObject({
         data: {
           id: node.id, name: node.name, type: node.type,
@@ -106,20 +108,37 @@ var CytoscapeRenderer= Ember.Object.extend({
       });
       if (node.transitions.length > 0) {
         node.transitions.forEach(function(transition){
-          if (transition.isOnError()|| transition.targetNode.isKillNode()){
+          //if (transition.isOnError()|| transition.targetNode.isKillNode()){
+          if ((transition.isOnError() && 
transition.getTargetNode().isKillNode())){
             return;
           }
+          var targetNodeId=transition.targetNode.id;
+          if (transition.targetNode.isKillNode()){
+            errorNodeCounter++;
+            var errorNode=transition.targetNode;
+            targetNodeId=errorNode.id+errorNodeCounter;
+            self.get('dataNodes').pushObject({
+              data: {
+                id: targetNodeId, name: errorNode.name, type: errorNode.type,
+                shape: self._getShape(errorNode.type),
+                type : errorNode.type,
+                node: errorNode
+              },
+              dataNodeName: Ember.computed.alias('errorNode.node.name')
+            });
+          }
           self.get('dataNodes').pushObject(
             {
               data: {
-                id: transition.sourceNodeId + '_to_' + 
transition.targetNode.id,
+                id: transition.sourceNodeId + '_to_' + targetNodeId,
                 source:transition.sourceNodeId,
-                target: transition.targetNode.id,
+                target: targetNodeId,
                 transition: transition,
                 transitionCount: node.getOkTransitionCount()
               }
             }
           );
+
         });
       }
     });
@@ -192,7 +211,7 @@ var CytoscapeRenderer= Ember.Object.extend({
       var node = event.cyTarget;
       var nodeObj = cy.$('#' + node.id());
       this._showNodeEditor(node, nodeObj);
-      if (!(node.data().type === 'start' || node.data().type === 'end' || 
node.data().type === 'placeholder')) {
+      if (!(node.data().type === 'start' || node.data().type === 'end' || 
node.data().type === 'placeholder' ||  node.data().type === 'kill')) {
         this.get("context").$(".overlay-node-actions, 
.overlay-trash-icon").show();
       }
       if (node.data().type === 'action' || node.data().type === 'decision') {
@@ -226,9 +245,9 @@ var CytoscapeRenderer= Ember.Object.extend({
         left: event.originalEvent.offsetX + 15
       });
       if (event.cyTarget.data().transitionCount>1){
-            this.get("context").$(".overlay-trash-transition-icon").show();
+        this.get("context").$(".overlay-trash-transition-icon").show();
       }else{
-          this.get("context").$(".overlay-trash-transition-icon").hide();
+        this.get("context").$(".overlay-trash-transition-icon").hide();
       }
       
this.get("context").$(".overlay-transition-content").data("sourceNode",event.cyTarget.source().data("node"));
       
this.get("context").$(".overlay-transition-content").data("targetNode",event.cyTarget.target().data("node"));
@@ -276,7 +295,7 @@ var CytoscapeRenderer= Ember.Object.extend({
           if (incomingTran.targetNode.id===currentNodeId){
             incomingTran.sourceNode=incomingNode;
             transitionList=transitionList.concat(incomingTran);
-           }
+          }
         }
       }
       
this.get("context").deleteWorkflowNode(this.get("context").$(".overlay-trash-icon").data("node"),transitionList);

http://git-wip-us.apache.org/repos/asf/ambari/blob/fb322e27/contrib/views/wfmanager/src/main/resources/ui/app/domain/cytoscape-style.js
----------------------------------------------------------------------
diff --git 
a/contrib/views/wfmanager/src/main/resources/ui/app/domain/cytoscape-style.js 
b/contrib/views/wfmanager/src/main/resources/ui/app/domain/cytoscape-style.js
index 5a074df..2eb01d1 100644
--- 
a/contrib/views/wfmanager/src/main/resources/ui/app/domain/cytoscape-style.js
+++ 
b/contrib/views/wfmanager/src/main/resources/ui/app/domain/cytoscape-style.js
@@ -83,6 +83,12 @@ export default Ember.Object.create({
       }
     },
     {
+      selector: 'node[type = "kill"]',
+      style: {
+        'color': '#a52a2a'
+      }
+    },
+    {
       selector: 'node[type = "placeholder"]',
       style: {
         width: 1,

http://git-wip-us.apache.org/repos/asf/ambari/blob/fb322e27/contrib/views/wfmanager/src/main/resources/ui/app/validators/duplicate-data-node-name.js
----------------------------------------------------------------------
diff --git 
a/contrib/views/wfmanager/src/main/resources/ui/app/validators/duplicate-data-node-name.js
 
b/contrib/views/wfmanager/src/main/resources/ui/app/validators/duplicate-data-node-name.js
index 5282544..86e5182 100644
--- 
a/contrib/views/wfmanager/src/main/resources/ui/app/validators/duplicate-data-node-name.js
+++ 
b/contrib/views/wfmanager/src/main/resources/ui/app/validators/duplicate-data-node-name.js
@@ -25,7 +25,7 @@ const DuplicateDataNodeName = BaseValidator.extend({
       model.get('dataNodes').forEach((item)=>{
         if (item.data.node && item.data.node.name) {
           Ember.set(item.data.node, "errors", false);
-          if(nodeNames.get(item.data.node.name)){
+          if(nodeNames.get(item.data.node.name) && 
item.data.node.type!=='kill'){
             Ember.set(item.data.node, "errors", true);
             
model.get("validationErrors").pushObject({node:item.data,message:"Node name 
should be unique"});
           }else{

Reply via email to