Skip to content

Implement the drawing algorithm for yaml viz

Frédéric Caplette requested to merge fc-draw-lines-for-yml-visualization into master

What does this MR do?

This is part 2 of a series of MR to implement a graph preview of ci yaml configurations.

Behind a feature flag gitlab_ci_yml_preview

Draw the lines between dependant nodes in the yaml visualization graph that was added on ci config files. Because we initially render the stage and job pills in vue, to draw the lines we use D3 to create an svg that we apply on top of it, like a thin film. This MR calculates what it takes to draw that film and add it on top of our graph to connect needs jobs.

Couples of notes:

  • This part of the feature can't really be seriously tested imo. It relies on a lot of DOM element to be present to calculate bounding rects and the like. If reviewers have suggestions on tests that could be added, let me know.
  • I have added the error handling inside the graph itself, not the gitlab_ci_yaml_visualization.vue component (which is the view container) because the graph itself as a component will be reused in the future and these errors should also live there I feel (if the lines fail to be drawn for example, you would want to see the error regardless of which page you are on)
  • No changelog required, it is still behind a disabled feature flag
  • I moved some util files that were used for the DAG to a higher level folder since they have become shared

Below are a couple of examples for different configurations

Screenshots

Screen_Shot_2020-09-29_at_2.27.25_PM

Screen_Shot_2020-09-29_at_2.14.25_PM

Screen_Shot_2020-09-29_at_2.41.24_PM

Screen_Shot_2020-09-29_at_2.26.34_PM

Screen_Shot_2020-09-30_at_3.05.02_PM

Does this MR meet the acceptance criteria?

Conformity

Edited by Frédéric Caplette

Merge request reports