Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Hide metadata inputs for tasks in HTML visualization. #346

Merged
merged 8 commits into from
Dec 2, 2024
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."):
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