This repository was archived by the owner on Oct 21, 2025. It is now read-only.
Add optional node annotations and editor modes#42
Merged
Conversation
…ome icon on hover
Collaborator
Author
|
Here's also an version of the current default start diagram with two added annotations. |
Member
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

This PR adds two things interacting with each other:
Node Annotations
Adds optional annotation to DFD nodes.
These include a mandatory message, optional color and optional (FontAwesome Free) icon.
For nodes that have an annotation a popup will open when hovering over them.
This popup shows the annotated message. This could be an analysis warning/error or pretty much anything.
When the icon is set the FontAwesome icon with the provided id will be prepended to the annotation message.
When the color of the annotation is set, the node will have a border in that color and a background with a dimmed version of that color.
The only way to add an annotation to a node is to set the
annotationobject inside the JSON object for the node.These can be included when generating the diagram from other sources. There is no way to add annotations using the editor itself, that is (currently) not an intended use case.
Here's an example annotation:
messagemust always be set whenannotationis set to an object.iconcan be the id of any FontAwesome Free icon. Note that always the solid version of the icon is used, all other versions are only available with FontAwesome Pro at the point of writing, so you couldn't use the other versions anyway.colorcan be undefined/not included or any color. Theoretically the current implementation would allow any valid CSS color definition, likeredorrgba(...)but for stability it is recommended to only use hex definitions of RGB colors (like shown above). Only those are guaranteed to be supported in the future. When no color is provided the node will have the default color like not annotated nodes, meaning white/black depending on white/dark mode.Editor Modes
Another thing this PR adds are three editor modes:
edit: the functionality like before this PR. You can view the diagram, change labels, move elements, create new nodes/ports/edges, etc.annotated: This is the intended mode for viewing node annotations that are introduced above. With this mode the model is in a readonly state. However there is a button in the UI that allows to change the diagram toeditmode. This will delete all annotations and make the model editable. Intended for viewing errors/validation messages from the DFD analysis. After viewing the annotations the user can delete them and perform the necessary fixes in the diagram.readonly: Similar toannotated. The model is in a readonly state, however there is no UI button to change the editor to theeditmode. Intended for generated diagrams from other sources.When the model is in a readonly state the user cannot create new elements, delete elements, change the DFD or node labels, etc. However the user can still look around the diagram, view DFD output port behaviors, view node annotations by hovering on the respective nodes, etc.
The editor mode is saved inside the model JSON as an extra top level field.
E.g.
When there is no editor mode set in the JSON representation of the model, the
editmode is used for backwards compability.