You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ja...@apache.org on 2017/04/11 18:29:09 UTC
[21/50] [abbrv] ambari git commit: AMBARI-20677.Centering workflows
for zoom breaks when multiple tabs exists(M Madhan Mohan Reddy via
padmapriyanitt)
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/8e15ba6a
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/8e15ba6a
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/8e15ba6a
Branch: refs/heads/ambari-rest-api-explorer
Commit: 8e15ba6ad3ee9e8ce653ca717f4fa97e2d09889a
Parents: 2ee12f4
Author: padmapriyanitt <pa...@gmail.com>
Authored: Thu Apr 6 12:16:39 2017 +0530
Committer: padmapriyanitt <pa...@gmail.com>
Committed: Thu Apr 6 12:16:39 2017 +0530
----------------------------------------------------------------------
.../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/8e15ba6a/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/8e15ba6a/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/8e15ba6a/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){