flows: fix incorrect diagram for policies bound to flows
closes #3534 Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
34e71351a6
commit
2a4679e390
|
@ -277,11 +277,16 @@ class FlowViewSet(UsedByMixin, ModelViewSet):
|
|||
if element.type == "condition":
|
||||
# Policy passes, link policy yes to next stage
|
||||
footer.append(f"{element.identifier}(yes, right)->{body[index + 1].identifier}")
|
||||
# Policy doesn't pass, go to stage after next stage
|
||||
no_element = body[index + 1]
|
||||
if no_element.type != "end":
|
||||
no_element = body[index + 2]
|
||||
footer.append(f"{element.identifier}(no, bottom)->{no_element.identifier}")
|
||||
# For policies bound to the flow itself, if they deny,
|
||||
# the flow doesn't get executed, hence directly to the end
|
||||
if element.identifier.startswith("flow_policy_"):
|
||||
footer.append(f"{element.identifier}(no, bottom)->e")
|
||||
else:
|
||||
# Policy doesn't pass, go to stage after next stage
|
||||
no_element = body[index + 1]
|
||||
if no_element.type != "end":
|
||||
no_element = body[index + 2]
|
||||
footer.append(f"{element.identifier}(no, bottom)->{no_element.identifier}")
|
||||
elif element.type == "operation":
|
||||
footer.append(f"{element.identifier}(bottom)->{body[index + 1].identifier}")
|
||||
diagram = "\n".join([str(x) for x in header + body + footer])
|
||||
|
|
Reference in New Issue