dedalusj / cloudgram

Generate diagrams for your cloud architecture using code
https://cloudgram.dedalusone.com
Apache License 2.0
94 stars 5 forks source link

Avoid edges to overlap nodes #32

Open dedalusj opened 3 years ago

dedalusj commented 3 years ago

The layout of the nodes by dagre does not prevent edges overlapping nodes see:

graph

generated by:

diagram "image processing" [direction=lr] {
  generic.user user [label="User"];
  aws.appsync appsync [label="AWS AppSync"];
  aws.s3 bucket [label="AWS S3 Bucket"];
  aws.cognito cognito [label="AWS Cognito"];
  aws.lambdaFunction workflow [label="Start workflow"];
  generic.component resolver [label="Resolver"];

  group backend [label="Backend",style=solid,opacity=0,stroke=red,width=4] {
    aws.stepFunctions stepFunction [label="AWS Step Function"];

    aws.lambdaFunction extraction [label="Extract metadata"];
    aws.lambdaFunction detection [label="Object/Scena detection"];
    aws.lambdaFunction thumbnailing [label="Create thumbnail"];
    aws.lambdaFunction persistence [label="Persist metadata"];

    aws.dynamodb dynamo [label="AWS DynamoDB"];
    aws.rekognition rekognition [label="AWS Rekognition"];

    stepFunction -> extraction;
    stepFunction -> detection;
    stepFunction -> thumbnailing;
    stepFunction -> persistence;

    persistence -> dynamo;
    detection -> rekognition;
  }

  user -> cognito;
  user -> appsync;
  user -> bucket;
  bucket -> workflow;
  workflow -> appsync;
  appsync -> resolver;

  resolver -> stepFunction;
  resolver -> dynamo;
}
dedalusj commented 3 years ago

This has momentarily been solved in 7ca7d363115228d3b58e5ecc0ead1c8ffaf7c181 by allowing nodes to be dragged so that users can finalise the look of the graph before export.

However this functionality should be disable when embedded via iFrame for example, as the result should be reproducible, and as such the overlap problem requires a solution at the layout algorithm level.