Closed dandelany closed 1 year ago
Closing and reopening to re-trigger CI.
Ah - just took a peek at the failing tests from the CI build - I didn't realize they were there & my changes likely broke them because I changed which <script>
s are included in the HTML template (some are loaded via import
now). I can push a fix tomorrow or feel free to do it without me.
@LeStarch yes that's correct, all of the files in lib/elkjs
are copied from elkjs
without any modifications - thanks for checking.
Looking at it again, we may not need to include the elk-api.js
and elk-worker.js
files since I think they are both included in the elk.bundled.js
file. All of the .d.ts
files are still useful to include, though, since they give you type hints in the IDE.
Works nicely!
This PR adds a new layout method for graphs which uses the open source ELK/elkjs graph layout library. I've attached slides from a presentation I gave to the F' team describing the rationale for this effort: FPrimeVisualELKPresentation.pdf.
In short, this enables intelligent graph layout and edge routing, so that graphs may be rendered with fewer confusing visual artifacts, such as connection lines overlapping each other or drawn on top of boxes. Example old layout:
New layout:
Notes
src/fprime_visual/flask/static/js/renderers/render-elk.js
elkjs
is really the only dependency, I decided to just include a bundled version of it in our repo (insrc/fprime_visual/flask/static/js/lib/elkjs
) rather than introducenpm
dependency management.import
statements for more predictable scoping etc.render
function, so we can add additional future layouts with this pattern if we want.Future work
Things I didn't get to...
config
option passed to the renderer. The user should also be able to select between the different available color themes, which already exist.Please let me know if you have any questions, happy to discuss it further. Thanks!