diff --git a/test/e2e/ui/ui-wacky-workflow.yaml b/test/e2e/ui/ui-wacky-workflow.yaml new file mode 100644 index 000000000000..59add4e2ce0b --- /dev/null +++ b/test/e2e/ui/ui-wacky-workflow.yaml @@ -0,0 +1,128 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Workflow +metadata: + generateName: loops-param-result- +spec: + entrypoint: loop-param-result-example + templates: + - name: loop-param-result-example + dag: + tasks: + - name: start + template: sleep-n-sec + arguments: + parameters: + - name: seconds + value: 1 + - name: generate1 + template: gen-number-list1 + dependencies: + - start + - name: generate2 + template: gen-number-list2 + dependencies: + - start + - name: generate3 + template: gen-number-list3 + dependencies: + - start + # Iterate over the list of numbers generated by the generate step above + - name: sleep1 + template: sleep-n-sec-then-echo + arguments: + parameters: + - name: seconds + value: "{{item}}" + withParam: "{{tasks.generate1.outputs.result}}" + dependencies: + - generate1 + - name: sleep2 + template: sleep-n-sec-then-echo + arguments: + parameters: + - name: seconds + value: "{{item}}" + withParam: "{{tasks.generate2.outputs.result}}" + dependencies: + - generate2 + - name: wait-before-sleep3 + template: sleep-n-sec + arguments: + parameters: + - name: seconds + value: 3 + dependencies: + - generate3 + - name: sleep3 + template: sleep-n-sec-then-echo + arguments: + parameters: + - name: seconds + value: "{{item}}" + withParam: "{{tasks.generate3.outputs.result}}" + dependencies: + - wait-before-sleep3 + + # Generate a list of numbers in JSON format + - name: gen-number-list1 + script: + image: python:alpine3.6 + command: [python] + source: | + import json + import sys + json.dump([i for i in range(1, 10)], sys.stdout) + + - name: gen-number-list2 + script: + image: python:alpine3.6 + command: [python] + source: | + import json + import sys + json.dump([i for i in range(1, 6)], sys.stdout) + + - name: gen-number-list3 + script: + image: python:alpine3.6 + command: [python] + source: | + import json + import sys + json.dump([i for i in range(1, 20)], sys.stdout) + + - name: sleep-n-sec-then-echo + inputs: + parameters: + - name: seconds + steps: + - - name: sleeping + template: sleep-n-sec + arguments: + parameters: + - name: seconds + value: "{{inputs.parameters.seconds}}" + - - name: echoing + template: echo-n-sec + arguments: + parameters: + - name: seconds + value: "{{inputs.parameters.seconds}}" + + - name: sleep-n-sec + inputs: + parameters: + - name: seconds + container: + image: alpine:latest + command: [sh, -c] + args: ["echo sleeping for {{inputs.parameters.seconds}} seconds; sleep {{inputs.parameters.seconds}}; echo done"] + + - name: echo-n-sec + inputs: + parameters: + - name: seconds + container: + image: alpine:latest + command: [sh, -c] + args: ["echo input was {{inputs.parameters.seconds}} seconds; echo done"] diff --git a/ui/src/app/workflows/components/workflow-dag/workflow-dag.tsx b/ui/src/app/workflows/components/workflow-dag/workflow-dag.tsx index 145aafe9f8bc..dc32c18d37e0 100644 --- a/ui/src/app/workflows/components/workflow-dag/workflow-dag.tsx +++ b/ui/src/app/workflows/components/workflow-dag/workflow-dag.tsx @@ -40,12 +40,8 @@ export class WorkflowDag extends React.Component @@ -210,7 +206,7 @@ export class WorkflowDag extends React.Component - + {this.graph.edges.map(edge => { const points = edge.points.map((p, i) => (i === 0 ? `M ${p.x} ${p.y} ` : `L ${p.x} ${p.y}`)).join(' '); return ; @@ -231,6 +227,7 @@ export class WorkflowDag extends React.Component this.selectNode(nodeId)} className='node'> + {label} ({})); @@ -423,11 +420,13 @@ export class WorkflowDag extends React.Component { - const node = graph.node(id); - this.graph.nodes.set(node.label, {x: node.x, y: node.y}); - }); - graph.edges().map((edge: Edge) => { + graph + .nodes() + .map(id => graph.node(id)) + .forEach(node => { + this.graph.nodes.set(node.label, {x: node.x, y: node.y}); + }); + graph.edges().forEach((edge: Edge) => { this.graph.edges.push(this.generateEdge(edge)); }); } @@ -443,13 +442,6 @@ export class WorkflowDag extends React.Component { if (this.state.horizontal) { - this.graph.height = Math.max(this.graph.height, level.length * this.vgap * 2); + this.graph.height = Math.max(this.graph.height, level.length * this.gap * 2); } else { - this.graph.width = Math.max(this.graph.width, level.length * this.hgap * 2); + this.graph.width = Math.max(this.graph.width, level.length * this.gap * 2); } }); layers.forEach((level, i) => { level.forEach((node, j) => { - const l = this.state.horizontal ? 0 : this.graph.width / 2 - level.length * this.hgap; - const t = !this.state.horizontal ? 0 : this.graph.height / 2 - level.length * this.vgap; + const l = this.state.horizontal ? 0 : this.graph.width / 2 - level.length * this.gap; + const t = !this.state.horizontal ? 0 : this.graph.height / 2 - level.length * this.gap; this.graph.nodes.set(node, { - x: (this.state.horizontal ? i : j) * this.hgap * 2 + l, - y: (this.state.horizontal ? j : i) * this.vgap * 2 + t + x: (this.state.horizontal ? i : j) * this.gap * 2 + l, + y: (this.state.horizontal ? j : i) * this.gap * 2 + t }); }); }); @@ -568,6 +560,12 @@ export class WorkflowDag extends React.Component