Skip to content
Snippets Groups Projects
Commit 475d9977 authored by ali asaria's avatar ali asaria
Browse files

add a fake start node to all diagrams as we wait for backend to do this

parent 856ccbd6
No related branches found
No related tags found
No related merge requests found
......@@ -19,9 +19,21 @@ const nodeTypes = { customNode: CustomNode };
function generateNodes(workflow: any): any[] {
const workflowConfig = JSON.parse(workflow?.config);
const fakeStartNode = {
id: 'start',
type: 'input',
position: { x: 0, y: -70 },
data: {
id: 'start',
label: 'Start',
jobType: 'start',
template: 'start',
metadata: {},
},
};
if (workflowConfig.nodes.length == 0) {
return [];
return [fakeStartNode];
}
let out: any[] = [];
......@@ -30,6 +42,9 @@ function generateNodes(workflow: any): any[] {
// console.log(workflowConfig);
// Add a fake start node for now -- later the backend will do this
out.push(fakeStartNode);
for (let i = 0; i < workflowConfig.nodes.length; i++) {
const node = workflowConfig.nodes[i];
// console.log(node);
......@@ -56,8 +71,18 @@ function generateNodes(workflow: any): any[] {
function generateEdges(workflow: any) {
const workflowConfig = JSON.parse(workflow?.config);
if (workflowConfig.nodes.length <= 1) {
return [];
let fakeStartNodeEdge = {
id: '-100',
source: 'start',
target: null,
markerEnd: {
type: 'arrow',
},
};
if (workflowConfig.nodes.length < 1) {
return [fakeStartNodeEdge];
}
let out: any[] = [];
......@@ -66,6 +91,10 @@ function generateEdges(workflow: any) {
// console.log(workflowConfig);
// conect the fake start node to the first node:
fakeStartNodeEdge.target = currentTask;
out.push(fakeStartNodeEdge);
for (let i = 0; i < workflowConfig.nodes.length; i++) {
const currentNode = workflowConfig.nodes[i];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment