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":
|
if element.type == "condition":
|
||||||
# Policy passes, link policy yes to next stage
|
# Policy passes, link policy yes to next stage
|
||||||
footer.append(f"{element.identifier}(yes, right)->{body[index + 1].identifier}")
|
footer.append(f"{element.identifier}(yes, right)->{body[index + 1].identifier}")
|
||||||
# Policy doesn't pass, go to stage after next stage
|
# For policies bound to the flow itself, if they deny,
|
||||||
no_element = body[index + 1]
|
# the flow doesn't get executed, hence directly to the end
|
||||||
if no_element.type != "end":
|
if element.identifier.startswith("flow_policy_"):
|
||||||
no_element = body[index + 2]
|
footer.append(f"{element.identifier}(no, bottom)->e")
|
||||||
footer.append(f"{element.identifier}(no, bottom)->{no_element.identifier}")
|
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":
|
elif element.type == "operation":
|
||||||
footer.append(f"{element.identifier}(bottom)->{body[index + 1].identifier}")
|
footer.append(f"{element.identifier}(bottom)->{body[index + 1].identifier}")
|
||||||
diagram = "\n".join([str(x) for x in header + body + footer])
|
diagram = "\n".join([str(x) for x in header + body + footer])
|
||||||
|
|
Reference in a new issue