support workflow features

This commit is contained in:
takatost
2024-02-29 22:58:30 +08:00
parent 9651a208a9
commit 43b0440358
14 changed files with 211 additions and 97 deletions

View File

@ -129,6 +129,22 @@ class Workflow(db.Model):
def features_dict(self):
return self.features if not self.features else json.loads(self.features)
def user_input_form(self):
# get start node from graph
if not self.graph:
return []
graph_dict = self.graph_dict
if 'nodes' not in graph_dict:
return []
start_node = next((node for node in graph_dict['nodes'] if node['type'] == 'start'), None)
if not start_node:
return []
# get user_input_form from start node
return start_node.get('variables', [])
class WorkflowRunTriggeredFrom(Enum):
"""