-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add dedicated "minimal" mode for templates #1754
Merged
Merged
Conversation
This file contains 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
fabiencastan
requested changes
Aug 25, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.
If an attribute is a link, when checking whether its value is the default value, only the resolved value should be compared with the default one. Otherwise, the attribute's "isDefault" property will always evaluate to True, even when a non-default link has been provided. This issue was especially evident with input File attributes, for which the default value is generally '' (empty string); if a link was set as a value (thus non-empty), its unresolved value would still be '', thus setting the "isDefault" property to True.
cbentejac
force-pushed
the
dev/minModeTemplates
branch
from
September 1, 2022 15:32
74aec0a
to
3aa97bf
Compare
fabiencastan
reviewed
Sep 5, 2022
Add a specific option to save a graph as a template ("Save As Template") in "minimal" mode. This mode only saves, for each node in the graph, the input and output attributes whose values differ from the default ones. Any attribute that is not serialized in the saved template file is assumed to have its default value. If a conflict is detected on a node when opening the template file, it is logged but solved automatically. The goal of this minimal mode is to prevent template files from needing an update every single time a modification (may it be minor or major) is done on a node description. Templates can thus follow node changes and still be usable.
cbentejac
force-pushed
the
dev/minModeTemplates
branch
from
September 6, 2022 08:26
3aa97bf
to
ac4cb11
Compare
fabiencastan
approved these changes
Sep 6, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Following #1727, project files can be used as templates, with the .mg files containing the entire description of the graph. This implies that if there is a single node whose description is modified (parameters added, parameters removed, etc.), description conflicts will arise when opening a template containing such a node. For these conflicts to be resolved, the template would need to be saved again with the upgraded version of the node every single time there is a change, which defeats the purpose of having templates.
This PR adds a "minimal" mode to save and load templates. Instead of saving the entire graph description, the minimal mode only saves the modified input/output parameters. When that template is opened, conflicts are detected only on the saved parameters (with non-default values) and automatically solved. This makes templates robust to changes in node descriptions.
Features list
Implementation remarks