Skip to content
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

Hide metadata inputs for tasks in HTML visualization. #346

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -135,4 +135,4 @@ dmypy.json
tests/work
/tests/**/*.png
/tests/**/*txt
.vscode
.vscode/
10 changes: 9 additions & 1 deletion aiida_workgraph/widget/src/widget/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def from_workgraph(self, workgraph: Any) -> None:
wgdata = workgraph_to_short_json(wgdata)
self.value = wgdata

def from_node(self, node: Any) -> None:
def from_node(self, node: Any, show_metadata: bool = False) -> None:
tdata = node.to_dict()
tdata.pop("properties", None)
tdata.pop("executor", None)
Expand All @@ -46,6 +46,14 @@ def from_node(self, node: Any) -> None:
tdata["label"] = tdata["identifier"]
for input in tdata["inputs"].values():
input.pop("property")

if not show_metadata:
inputs = {}
for input_k, input_v in tdata["inputs"].items():
if not input_k.startswith("metadata"):
GeigerJ2 marked this conversation as resolved.
Show resolved Hide resolved
inputs[input_k] = input_v
tdata["inputs"] = inputs

tdata["inputs"] = list(tdata["inputs"].values())
tdata["outputs"] = list(tdata["outputs"].values())
wgdata = {"name": node.name, "nodes": {node.name: tdata}, "links": []}
Expand Down
Loading