ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gna...@apache.org
Subject ambari git commit: AMBARI-20084. Cut Node feature is broken in workflow manager.(Padma Priya N via gauravn7)
Date Tue, 21 Feb 2017 10:42:21 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 6a7d91939 -> 4719b2425


AMBARI-20084. Cut Node feature is broken in workflow manager.(Padma Priya N via gauravn7)


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

Branch: refs/heads/trunk
Commit: 4719b242560326230dc1e10473ddcd535e29c0af
Parents: 6a7d919
Author: Gaurav Nagar <grvngr@gmail.com>
Authored: Tue Feb 21 16:12:08 2017 +0530
Committer: Gaurav Nagar <grvngr@gmail.com>
Committed: Tue Feb 21 16:12:08 2017 +0530

----------------------------------------------------------------------
 .../ui/app/components/flow-designer.js          |  4 +--
 .../ui/app/domain/cytoscape-flow-renderer.js    | 34 ++++++++++++--------
 2 files changed, 22 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/4719b242/contrib/views/wfmanager/src/main/resources/ui/app/components/flow-designer.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/components/flow-designer.js
b/contrib/views/wfmanager/src/main/resources/ui/app/components/flow-designer.js
index c1bd4be..190bb1a 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/components/flow-designer.js
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/components/flow-designer.js
@@ -670,9 +670,9 @@ export default Ember.Component.extend(FindNodeMixin, Validations, {
   copyNode(node){
     this.get('clipboardService').setContent(node, 'copy');
   },
-  cutNode(node){
+  cutNode(node, transitionsList){
     this.get('clipboardService').setContent(node, 'cut');
-    this.deleteWorkflowNode(node);
+    this.deleteWorkflowNode(node, transitionsList);
   },
   replaceNode(node){
     var clipboardContent = this.get('clipboardService').getContent();

http://git-wip-us.apache.org/repos/asf/ambari/blob/4719b242/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 6f46fdc..51e0461 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
@@ -287,18 +287,7 @@ var CytoscapeRenderer= Ember.Object.extend({
 
     this.get("context").$('.overlay-trash-icon i').off('click');
     this.get("context").$('.overlay-trash-icon i').on('click',function(){
-      var incomingNodes=this.get("currentCyNode").incomers("node").jsons().mapBy("data.node");
-      var transitionList=[];
-      var currentNodeId=this.get("currentCyNode").json().data.id;
-      for (var incomingNode of incomingNodes) {
-        for (var incomingTran of incomingNode.transitions ){
-          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);
+      this.get("context").deleteWorkflowNode(this.get("context").$(".overlay-trash-icon").data("node"),
this.getIncomingTransitions(this.get("currentCyNode")));
       this.get("context").$('.overlay-node-actions').hide();
     }.bind(this));
 
@@ -316,7 +305,7 @@ var CytoscapeRenderer= Ember.Object.extend({
 
     this.get("context").$('.overlay-cut-icon i').off('click');
     this.get("context").$('.overlay-cut-icon i').on('click',function(){
-      this.get("context").cutNode(this.get("context").$(".overlay-cut-icon").data("node"));
+      this.get("context").cutNode(this.get("context").$(".overlay-cut-icon").data("node"),
this.getIncomingTransitions(this.get("currentCyNode")));
       this.get("context").$('.overlay-node-actions').hide();
     }.bind(this));
 
@@ -344,8 +333,22 @@ var CytoscapeRenderer= Ember.Object.extend({
       this.get("context").$('.overlay-node-actions').hide();
     }.bind(this));
   },
+  getIncomingTransitions(node){
+    var incomingNodes=node.incomers("node").jsons().mapBy("data.node");
+    var transitionList=[];
+    var currentNodeId=this.get("currentCyNode").json().data.id;
+    for (var incomingNode of incomingNodes) {
+      for (var incomingTran of incomingNode.transitions ){
+        if (incomingTran.targetNode.id===currentNodeId){
+          incomingTran.sourceNode=incomingNode;
+          transitionList=transitionList.concat(incomingTran);
+        }
+      }
+    }
+    return transitionList;
+  },
   populateOkToandErrorTONodes(node){
-    let alternatePathNodes = this.cy.$('#'+node.id).predecessors("node[name][type='decision']").union(this.cy.$('#'+node.id).predecessors("node[name][type='decision']"));
+    let alternatePathNodes = this.cy.$('#'+node.id).predecessors("node[name][type='decision']").union(this.cy.$('#'+node.id).predecessors("node[name][type='fork']"));
     let descendantNodes = [];
     if(alternatePathNodes.length > 0){
       alternatePathNodes.forEach(childNode =>{
@@ -370,6 +373,9 @@ var CytoscapeRenderer= Ember.Object.extend({
     node.set('validOkToNodes', okToNodes);
     node.set('validErrorToNodes', errorToNodes);
   },
+  isWorkflowValid(){
+    return this.cy.nodes("node[name][type='start']").successors("node[name]").intersection(this.cy.nodes("node[name][type='end']").length
> 0);
+  },
   renderWorkflow(workflow){
     this._getCyDataNodes(workflow);
     this.cy.startBatch();


Mime
View raw message