-
Notifications
You must be signed in to change notification settings - Fork 16
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
Update linking of the outputs and inputs #301
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
d77f7dc
WIP 1
sameeul f093baa
Some refactoring
sameeul 23f41a9
updating other multistep tests
sameeul ae03663
Update tests
sameeul 67b6b70
WIP2
sameeul cb3da6b
fix lints
sameeul 1419363
FIx name
sameeul 89e3d36
Keep supporting old tests
sameeul 8db4023
Minor refactoring
sameeul ea9b59b
WIP3
sameeul 5563296
WIP 4
sameeul 8114a4d
drop uuid from workflow name
sameeul File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
def is_directory(input_dict: dict) -> bool: | ||
"""Check if the given input dictionary represents a directory. | ||
|
||
Args: | ||
input_dict (dict): The input dictionary containing type and name. | ||
|
||
Returns: | ||
bool: True if the input represents a directory, False otherwise. | ||
""" | ||
|
||
is_dir: bool = input_dict.get("type", "") == "directory" \ | ||
or input_dict.get("type", "") == "file" \ | ||
or input_dict.get("type", "") == "path" \ | ||
or input_dict.get("type", "") == "collection" \ | ||
or input_dict.get("type", "") == "csvCollection" \ | ||
or input_dict.get("name", "").lower() == "file" \ | ||
or input_dict.get("name", "").lower().endswith("path") \ | ||
or input_dict.get("name", "").lower().endswith("dir") | ||
|
||
return is_dir | ||
|
||
|
||
def get_node_config(plugin: dict) -> dict: | ||
"""Get the UI configuration for a specific plugin. | ||
|
||
Args: | ||
plugin (dict): The plugin dictionary containing UI and inputs. | ||
|
||
Returns: | ||
dict: A dictionary containing UI inputs, non-UI inputs, and outputs. | ||
""" | ||
uis = plugin.get("ui", []) | ||
plugin_inputs = plugin.get("inputs", []) | ||
|
||
# split inputs into UI (form) and non-UI (circle inlets) | ||
non_ui_inputs = [] # circle inlets on the left side of the node | ||
ui_inputs = [] # UI inputs such as text fields, checkboxes, etc. | ||
|
||
for i in range(len(plugin_inputs) - 1, -1, -1): | ||
input = plugin_inputs[i] | ||
|
||
# find the UI element that corresponds to this input | ||
ui_input = next( | ||
(x for x in uis if "key" in x and x["key"] == "inputs." + input["name"]), | ||
None, | ||
) | ||
is_dir = is_directory(input) | ||
|
||
# if input is a directory - move it to the non-UI section | ||
if is_dir: | ||
non_ui_inputs.append(input) | ||
|
||
# in some cases UI is missing for the input, so we need to create it | ||
# but only if it's not a directory | ||
if not ui_input and not is_dir: | ||
calculated_ui_input = { | ||
"key": "inputs." + input["name"], | ||
"type": input["type"], | ||
"title": input["name"], | ||
"required": input["required"], | ||
"format": input["format"], | ||
} | ||
|
||
ui_inputs.append(calculated_ui_input) | ||
|
||
if ui_input and not is_dir: | ||
ui_input["required"] = input["required"] | ||
ui_input["format"] = input["format"] | ||
ui_inputs.append(ui_input) | ||
|
||
outputs = plugin.get("outputs", []) | ||
|
||
# if output has UI - move it to the UI section | ||
# this is mostly for internal nodes such as Input Data Directory | ||
for output in outputs: | ||
ui_output = next( | ||
(x for x in uis if "key" in x and x["key"] == "outputs." + output["name"]), | ||
None, | ||
) | ||
if ui_output: | ||
ui_inputs.append(ui_output) | ||
|
||
result = {"ui": ui_inputs, "inputs": non_ui_inputs, "outputs": outputs} | ||
return result |
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
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.
why was removing uuuid from workflow name necessary?
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.
yes. There is a limitation on the WFB side for the length of the name. They are also adding a UUID, so we are dropping it. See the Slack discussion.