ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aonis...@apache.org
Subject [01/41] ambari git commit: AMBARI-20677.Centering workflows for zoom breaks when multiple tabs exists(M Madhan Mohan Reddy via padmapriyanitt)
Date Thu, 06 Apr 2017 09:33:22 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-3.0-perf 8bef3b489 -> 8de3961b6


AMBARI-20677.Centering workflows for zoom breaks when multiple tabs exists(M Madhan Mohan
Reddy via padmapriyanitt)


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

Branch: refs/heads/branch-3.0-perf
Commit: fb4637b33df2c511b1d5be17ef63fdeb887e7ee9
Parents: 8c58e67
Author: padmapriyanitt <padmapriyanitt@gmail.com>
Authored: Thu Apr 6 12:16:39 2017 +0530
Committer: Andrew Onishuk <aonishuk@hortonworks.com>
Committed: Thu Apr 6 12:32:56 2017 +0300

----------------------------------------------------------------------
 .../resources/ui/app/components/designer-workspace.js  |  1 +
 .../main/resources/ui/app/components/flow-designer.js  |  3 +++
 .../resources/ui/app/domain/cytoscape-flow-renderer.js | 13 ++++++++++---
 3 files changed, 14 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/fb4637b3/contrib/views/wfmanager/src/main/resources/ui/app/components/designer-workspace.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/components/designer-workspace.js
b/contrib/views/wfmanager/src/main/resources/ui/app/components/designer-workspace.js
index 980904f..de1eb0e 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/components/designer-workspace.js
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/components/designer-workspace.js
@@ -305,6 +305,7 @@ export default Ember.Component.extend({
       if(tab.type === 'wf' && tab.context){
         CommonUtils.setTestContext(tab.context);
         tab.context.resize();
+        tab.context.centerGraph();
       }else if(tab.type === 'dashboard'){
         this.sendAction('showDashboard');
       }

http://git-wip-us.apache.org/repos/asf/ambari/blob/fb4637b3/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 fa7c861..cccf6d0 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
@@ -248,6 +248,9 @@ export default Ember.Component.extend(FindNodeMixin, Validations, {
   resize(){
     this.flowRenderer.resize();
   },
+  centerGraph(){
+    this.flowRenderer.setGraphCenter();
+  },
   cleanupFlowRenderer:function(){
     this.set('renderNodeTransitions',false);
     this.flowRenderer.cleanup();

http://git-wip-us.apache.org/repos/asf/ambari/blob/fb4637b3/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 af84f86..03f0ae1 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
@@ -67,11 +67,18 @@ var CytoscapeRenderer= Ember.Object.extend({
   _setCyOverflow() {
     Ember.set(this.get("cyOverflow"), "overflown", this.cy.elements().renderedBoundingBox().y2
> this.cy.height());
   },
-  _setGraphCenter() {
+  setGraphCenter() {
+    if (this.cy && !this.centered){
+      Ember.run.later(this, function() {
+        this._setGraphCenterOnStartNode();
+      },50);
+    }
+  },
+  _setGraphCenterOnStartNode() {
     var startDataNode = this.get("dataNodes").filterBy("data.type", "start");
     if (startDataNode[0] && startDataNode[0].data.id) {
       var startNode = this.cy.$("#" + startDataNode[0].data.id);
-      this.cy.center();
+      this.cy.center(startNode);
       this.cy.pan({y:50});
     }
   },
@@ -400,7 +407,7 @@ var CytoscapeRenderer= Ember.Object.extend({
     this.cy.endBatch();
     this.cy.layout(this.get("layoutConfigs"));
     this._setCyOverflow();
-    this._setGraphCenter();
+    this._setGraphCenterOnStartNode();
   },
 
   initRenderer(callback, settings){


Mime
View raw message