def get_action_mapping(workflow):
from .registry import PHASES
# Maps action names to the phase they originate from
transitions = defaultdict(lambda: {"display": "", "transitions": []})
if workflow:
phases = workflow.items()
else:
phases = PHASES
for _phase_name, phase in phases:
for transition_name, transition in phase.transitions.items():
transition_display = transition["display"]
transition_key = slugify(transition_display)
transitions[transition_key]["transitions"].append(transition_name)
transitions[transition_key]["display"] = transition_display
return transitions