Skip to content

Commit

Permalink
fix: don't save and display empty controls
Browse files Browse the repository at this point in the history
  • Loading branch information
leon-schmid committed Oct 26, 2024
1 parent 158f27d commit 522984e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
7 changes: 6 additions & 1 deletion admyral/compiler/workflow_compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,18 @@ def _into_dag(self, workflow: "Workflow") -> WorkflowDAG:
return WorkflowDAG(
name=workflow.name,
description=workflow.description,
controls=workflow.controls,
controls=self._filter_empty_controls(workflow.controls),
start=WorkflowStart(
triggers=self._handle_triggers(workflow),
),
dag=self.nodes,
)

def _filter_empty_controls(self, controls: list[str] | None) -> list[str] | None:
if not controls:
return None
return [control for control in controls if control]

def _compute_unique_node_id(self, base: str) -> str:
if base not in self.nodes:
return base
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ export default function SaveWorkflowButton() {
return;
}

if (workflow.controls) {
workflow.controls = workflow.controls.filter(
(control) => control.trim() !== "",
);
}

// Make sure that we only save args which are present in the current
// action definition. If an action is updated and an argument is
// removed, we want to clean it up here.
Expand Down

0 comments on commit 522984e

Please sign in to comment.