From 7f35119bb46e6600e112eb36eead92e539db3dbe Mon Sep 17 00:00:00 2001 From: Thorsten Scherler Date: Tue, 5 Jan 2016 14:21:55 +0100 Subject: [PATCH] [noIssue] Adding comment about refactoring needed --- src/main/jsx/PipelineEditor.jsx | 34 ++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/src/main/jsx/PipelineEditor.jsx b/src/main/jsx/PipelineEditor.jsx index caed0d3..69a6574 100644 --- a/src/main/jsx/PipelineEditor.jsx +++ b/src/main/jsx/PipelineEditor.jsx @@ -1,3 +1,7 @@ +/* FIXME: +* This file should be splited. Rule of thumb is to have a file for each +* React component. +*/ var lines = require('./svg/svg'); var wf = require('./WorkflowStore.js'); @@ -8,9 +12,9 @@ window.disconnect = function() { window.connect = function() { lines.init({strokeWidth: 2}); lines.set('strokeColor', '#999'); - + var parent = $('.pipeline-visual-editor')[0]; - + var connections = []; $('.stage').each(function() { var $stages = $(this).find('.stage-block'); @@ -18,22 +22,22 @@ window.connect = function() { if(connections.length > 0 && connections[connections.length-1].length > 1 && $stages.length > 1) { connections.push([$(this).find('.connect-between')[0]]); } - + var blocks = []; connections.push(blocks); $stages.each(function() { blocks.push(this); }); }); - + for(var i = 1; i < connections.length; i++) { var prev = connections[i-1]; var curr = connections[i]; - + for(var p = 0; p < prev.length; p++) { lines.on(parent, prev[p], curr[0]); } - + for(var n = 1; n < curr.length; n++) { lines.on(parent, prev[0], curr[n]); } @@ -97,7 +101,7 @@ var StageBlock = React.createClass({ Remove - + @@ -128,7 +132,7 @@ var StageBlockContainer = React.createClass({ name: this.refs.newBranchName.val(), steps: [] }); - + this.setState({showAddBranch: false}); }, toggleParallel: function() { @@ -145,9 +149,9 @@ var StageBlockContainer = React.createClass({
- +
- +
{ui.when(!wf.isParallelStage(this.props.stage), function() { return ; @@ -161,7 +165,7 @@ var StageBlockContainer = React.createClass({ ; }.bind(this))}
- + Parallel}> @@ -302,7 +306,7 @@ var StepList = React.createClass({ }, onStepTypeSelected: function(stepType) { console.log('stepType set: ' + json.stringify(stepType)); - + this.setState({ stepData: {type: stepType} }); @@ -313,11 +317,11 @@ var StepList = React.createClass({ {ui.map(this.props.stage.steps, function(step,i) { return ; }.bind(this))} - + }>
- @@ -360,7 +364,7 @@ lib.PipelineEditor = React.createClass({
- +
{wf.toWorkflow(this.props.workflow)}