You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by pp...@apache.org on 2017/04/28 01:50:10 UTC
ambari git commit: AMBARI-20867.Cleanup Jsplumb specific code from
WFM.(padmapriyanitt)
Repository: ambari
Updated Branches:
refs/heads/trunk 57a9af324 -> 8e61c55ed
AMBARI-20867.Cleanup Jsplumb specific code from WFM.(padmapriyanitt)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/8e61c55e
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/8e61c55e
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/8e61c55e
Branch: refs/heads/trunk
Commit: 8e61c55ed315cdda60ea1ea3ca2e38b755b010de
Parents: 57a9af3
Author: padmapriyanitt <pa...@gmail.com>
Authored: Fri Apr 28 07:20:10 2017 +0530
Committer: padmapriyanitt <pa...@gmail.com>
Committed: Fri Apr 28 07:20:10 2017 +0530
----------------------------------------------------------------------
.../ui/app/components/flow-designer.js | 1 -
.../ui/app/domain/jsplumb-flow-renderer.js | 194 -------------------
.../resources/ui/app/domain/layout-manager1.js | 88 ---------
.../resources/ui/app/domain/layout-manager2.js | 87 ---------
.../wfmanager/src/main/resources/ui/bower.json | 1 -
5 files changed, 371 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/8e61c55e/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 17f21ee..1cfe755 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
@@ -22,7 +22,6 @@ import {WorkflowGenerator} from '../domain/workflow-xml-generator';
import {WorkflowImporter} from '../domain/workflow-importer';
import {WorkflowJsonImporter} from '../domain/workflow-json-importer';
import {WorkflowContext} from '../domain/workflow-context';
-import {JSPlumbRenderer} from '../domain/jsplumb-flow-renderer';
import {CytoscapeRenderer} from '../domain/cytoscape-flow-renderer';
import {FindNodeMixin} from '../domain/findnode-mixin';
import { validator, buildValidations } from 'ember-cp-validations';
http://git-wip-us.apache.org/repos/asf/ambari/blob/8e61c55e/contrib/views/wfmanager/src/main/resources/ui/app/domain/jsplumb-flow-renderer.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/domain/jsplumb-flow-renderer.js b/contrib/views/wfmanager/src/main/resources/ui/app/domain/jsplumb-flow-renderer.js
deleted file mode 100644
index c3e3133..0000000
--- a/contrib/views/wfmanager/src/main/resources/ui/app/domain/jsplumb-flow-renderer.js
+++ /dev/null
@@ -1,194 +0,0 @@
-/*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements. See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to You under the Apache License, Version 2.0
-* (the "License"); you may not use this file except in compliance with
-* the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-import Ember from 'ember';
-import Constants from '../utils/constants';
-import {DefaultLayoutManager as LayoutManager} from '../domain/default-layout-manager';
-var JSPlumbRenderer= Ember.Object.extend({
- designerPlumb:null,
- flattenedNodes:null,
- _createConnection(sourceNode,target,transition){
- var connectionColor="#777";
- var lineWidth=1;
- if (transition.condition){
- if(transition.condition==="default"){
- lineWidth=2;
- }else if (transition.condition==="error"|| transition.errorPath){
- connectionColor=Constants.globalSetting.errorTransitionColor;
- }
- }
- var connectionObj={
- source:sourceNode.id,
- target:target.id,
- connector:["Straight"],
- paintStyle:{lineWidth:lineWidth,strokeStyle:connectionColor},
- endpointStyle:{fillStyle:'rgb(243,229,0)'},
- endpoint: ["Dot", {
- radius: 1
- }],
- alwaysRespectStubs:true,
- anchors: [["Bottom"],["Top"]],
- overlays:[]
- };
- return connectionObj;
- },
- _getAddNodeOverlay(context,sourceNode,target,transition){
- var location=target.type==="placeholder"?1:0.5;
- var transitionCount=sourceNode.transitions.length;
- return {
- id: sourceNode.id+"_"+target.id+"_"+"connector",
- location:location,
- /* jshint unused:vars */
- create:function(component) {
- var container=Ember.$('<div />');
- var plus= Ember.$('<div class="fa fa-plus connector_overlay_new"></div>');
- if ((sourceNode.isDecisionNode() && transitionCount>1 ||sourceNode.isForkNode() && transitionCount>2 ) &&
- target.isPlaceholder() &&
- !transition.isDefaultCasePath()){
- var trash=Ember.$('<div class="node_actions node_left"><i class="fa fa-trash-o"></i></div>');
- trash.on("click",function(){
- context.deleteTransition(transition);
- });
- plus.append(trash);
- }
- container.append(plus);
- return container;
- },
- events:{
- click:function(labelOverlay, originalEvent) {
- var element = originalEvent.target;
- context.set('popOverElement', element);
- context.setCurrentTransition(transition);
- context.showWorkflowActionSelect(element);
- }
- }
- };
- },
-
- _renderNodes(node,visitedNodes){
- if (!node || node.isKillNode()){
- return;
- }
- if (visitedNodes.contains(node)){
- return;
- }
- visitedNodes.push(node);
- if(!this.get("flattenedNodes").contains(node)){
- this.get("flattenedNodes").pushObject(node);
- }
- if (node.transitions.length > 0){
- node.transitions.forEach(function(transition) {
- var target = transition.targetNode;
- this._renderNodes(target,visitedNodes);
- }.bind(this));
- }
- },
- _connectNodes(context,sourceNode){
- var connections=[];
- var visitedNodes=[];
- this._renderTransitions(sourceNode,connections,visitedNodes,context);
- this._layout(connections);
- this.designerPlumb.setSuspendDrawing(true);
- this.designerPlumb.batch(function(){
- connections.forEach(function(conn){
- this.designerPlumb.connect(conn);
- }.bind(this));
- }.bind(this));
- this.designerPlumb.setSuspendDrawing(false,true);
-
- },
- _renderTransitions(sourceNode,connections,visitedNodes,context){
- var self=this;
- if(!sourceNode){
- return;
- }
- if (visitedNodes.contains(sourceNode)){
- return;
- }
- if (sourceNode.hasTransition() ){
- sourceNode.transitions.forEach(function(transition) {
- var target = transition.targetNode;
- if (target.isKillNode() || !Constants.showErrorTransitions && transition.isOnError()){
- return;
- }
- var connectionObj=self._createConnection(sourceNode,target,transition);
-
- if (transition.condition){
- var conditionHTML = "<div class='decision-condition' title='"+transition.condition+"'>"+ transition.condition+"</div>";
- connectionObj.overlays.push([ "Label", {label:conditionHTML, location:0.75, id:"myLabel" } ]);
- }
- if (!target.isPlaceholder()){
- connectionObj.overlays.push(["PlainArrow",{location:-0.1,width: 7,length: 7}]);
- }
- if (!(sourceNode.isPlaceholder() || target.isKillNode())){
- var addNodeoverlay=["Custom" , self._getAddNodeOverlay(context,sourceNode,target,transition)];
- connectionObj.overlays.push(addNodeoverlay);
- }
- connections.push(connectionObj);
- self._renderTransitions(target,connections,visitedNodes,context);
- });
- }
- },
- _layout(edges){
- var nodes = Ember.$(".nodecontainer");
- this.layoutManager.doLayout(this.get("context"),nodes,edges,this.get("workflow"));
- },
- initRenderer(callback,settings){
- this.designerPlumb=jsPlumb.getInstance({});
- this.layoutManager=LayoutManager.create({});
- this.context=settings.context;
- this.flattenedNodes=settings.flattenedNodes;
- this.designerPlumb.ready(function() {
- callback();
- }.bind(this));
- return this.designerPlumb;
- },
- refresh(){
- this.designerPlumb.repaintEverything();
- },
- reset(){
- if(!this.get('flattenedNodes')){
- return;
- }
- this.get("flattenedNodes").clear();
- this.designerPlumb.reset();
- },
- cleanup(){
- if(!this.get('flattenedNodes')){
- return;
- }
- this.get('flattenedNodes').clear();
- this.designerPlumb.detachEveryConnection();
- },
- onDidUpdate(){
- this._connectNodes(this.get("context"),this.get("workflow").startNode,this.get("workflow"));
- },
- renderWorkflow(workflow){
- var visitedNodes=[];
- this.set("workflow",workflow);
- this._renderNodes(this.get("workflow").startNode,visitedNodes);
- },
-
- getBottomPosition(){
- return {
- top : this.get("context").$(".nodeEnd").offset().top,
- left : this.get("context").$(".nodeEnd").offset().left
- };
- }
-
-});
-export {JSPlumbRenderer};
http://git-wip-us.apache.org/repos/asf/ambari/blob/8e61c55e/contrib/views/wfmanager/src/main/resources/ui/app/domain/layout-manager1.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/domain/layout-manager1.js b/contrib/views/wfmanager/src/main/resources/ui/app/domain/layout-manager1.js
deleted file mode 100644
index 0cd306a..0000000
--- a/contrib/views/wfmanager/src/main/resources/ui/app/domain/layout-manager1.js
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements. See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to You under the Apache License, Version 2.0
-* (the "License"); you may not use this file except in compliance with
-* the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-import Ember from 'ember';
-var LayoutManager1= Ember.Object.extend({
- doLayout(component,nodes,edges,workflow){
- var levelMatrix = [];
- var adjancencyMatrix = {};
- for (var i = 0; i < edges.length; i++) {
- var c = edges[i];
- if(!adjancencyMatrix[c.source.id]){
- adjancencyMatrix[c.source.id] = [];
- }
- adjancencyMatrix[c.source.id].push(c.target.id);
- }
- var bfsArray = this.doBFS(nodes[0].id, adjancencyMatrix);
- var level = 0;
- bfsArray.forEach((item, index)=>{
- if(!adjancencyMatrix[item]){
- return;
- }
- adjancencyMatrix[item].forEach((value)=>{
- if(!levelMatrix[level]){
- levelMatrix[level] = [];
- }
- levelMatrix[level].push(value);
- });
- level++;
- });
- var startNodeOffset = component.$("#node-start").offset();
- var top = Math.floor(startNodeOffset.top);
- var left = Math.floor(startNodeOffset.left);
- levelMatrix.forEach((nodeArray, level)=>{
- var levelLength = nodeArray.length;
- var levelSplit = left/levelLength;
- nodeArray.forEach((node, idx, array)=>{
- if(levelLength == 1){
- Ember.$("#" + node).css("top", top+(level*100)+ "px");
- }else{
- Ember.$("#" + node).css("top", top+ "px");
- if(idx < levelLength/2){
- Ember.$("#" + node).css("left", left-(idx*100) + "px");
- }else if(idx === levelLength/2){
- Ember.$("#" + node).css("left", left + "px");
- }else{
- Ember.$("#" + node).css("left", left+(idx*100) + "px");
- }
- }
- });
- });
- },
- doBFS (root, adjancencyMatrix){
- var bfsResult = [];
- var level = 0;
- var visited = {};
- visited[root] = true;
- var queue = [];
- queue.push(root);
- while(queue.length !== 0){
- root = queue.shift();
- bfsResult.push(root);
- if(!adjancencyMatrix[root]){
- continue;
- }
- adjancencyMatrix[root].forEach(function(node){
- if(!visited[node]){
- visited[node] = true;
- queue.push(node);
- }
- });
- }
- return bfsResult;
- },
-});
-export {LayoutManager1};
http://git-wip-us.apache.org/repos/asf/ambari/blob/8e61c55e/contrib/views/wfmanager/src/main/resources/ui/app/domain/layout-manager2.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/domain/layout-manager2.js b/contrib/views/wfmanager/src/main/resources/ui/app/domain/layout-manager2.js
deleted file mode 100644
index d82b89e..0000000
--- a/contrib/views/wfmanager/src/main/resources/ui/app/domain/layout-manager2.js
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements. See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to You under the Apache License, Version 2.0
-* (the "License"); you may not use this file except in compliance with
-* the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-import Ember from 'ember';
-var LayoutManager1= Ember.Object.extend({
- doLayout(component,nodes,edges,workflow){
- var levelMatrix = [];
- var adjancencyMatrix = {};
- for (var i = 0; i < edges.length; i++) {
- var c = edges[i];
- if(!adjancencyMatrix[c.source.id]){
- adjancencyMatrix[c.source.id] = [];
- }
- adjancencyMatrix[c.source.id].push(c.target.id);
- }
- var bfsArray = this.doBFS(nodes[0].id, adjancencyMatrix);
- var level = 0;
- levelMatrix[level] = [];
- levelMatrix[level++].push(nodes[0].id);
- bfsArray.forEach((item, index)=>{
- if(!adjancencyMatrix[item]){
- return;
- }
- adjancencyMatrix[item].forEach((value)=>{
- if(!levelMatrix[level]){
- levelMatrix[level] = [];
- }
- levelMatrix[level].push(value);
- });
- level++;
- });
- var top = 0;
- var left = 400;
- var startNodeWidth = component.$("#"+nodes[0].id).width();
- var center = left+(150-Math.floor(startNodeWidth/2));
- levelMatrix.forEach((nodeArray, level)=>{
- var levelLength = nodeArray.length;
- nodeArray.forEach((node, idx, array)=>{
- Ember.$("#" + node).css("top", top+(level*100)+ "px");
- var nodeWidth=Math.round(component.$("#" + node).width()/10) * 10;
- var avgPositionChange = 0;
- var totalPositions = ((levelLength-1)*(levelLength)/2)*100;
- var displacement = 150-Math.floor(nodeWidth/2);
- var avgPositionChange = (totalPositions/levelLength);
- var eltPosition = idx*100 - avgPositionChange;
- var total = left + eltPosition + displacement;
- Ember.$("#" + node).css("left", total + "px");
- });
- });
- },
- doBFS (root, adjancencyMatrix){
- var bfsResult = [];
- var level = 0;
- var visited = {};
- visited[root] = true;
- var queue = [];
- queue.push(root);
- while(queue.length !== 0){
- root = queue.shift();
- bfsResult.push(root);
- if(!adjancencyMatrix[root]){
- continue;
- }
- adjancencyMatrix[root].forEach(function(node){
- if(!visited[node]){
- visited[node] = true;
- queue.push(node);
- }
- });
- }
- return bfsResult;
- },
-});
-export {LayoutManager1};
http://git-wip-us.apache.org/repos/asf/ambari/blob/8e61c55e/contrib/views/wfmanager/src/main/resources/ui/bower.json
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/bower.json b/contrib/views/wfmanager/src/main/resources/ui/bower.json
index 7e1709b..75ac7a7 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/bower.json
+++ b/contrib/views/wfmanager/src/main/resources/ui/bower.json
@@ -7,7 +7,6 @@
"ember-qunit-notifications": "0.1.0",
"bootstrap": "~3.3.6",
"font-awesome": "fontawesome#~4.5.0",
- "jsPlumb": "2.0.7",
"jquery-ui": "~1.11.4",
"dagre": "~0.7.4",
"x2js": "~1.2.0",