{% if op.stages %}{% include "liveops/_stages.html" with op=op %}{% endif %}
{% if op.get_state == "FINISHED_OK" %}
{% render_op_result op %}
{% elif op.get_state == "FINISHED_ERROR" %}
{% include "liveops/_error.html" with message=op.traceback %}
{% elif op.get_state == "CANCELLED" %}
{% include "liveops/_cancelled.html" with op=op %}
{% endif %}
{% url 'liveops:cancel' op_type=op.op_type_key pk=op.pk as cancel_url %}
{% url 'liveops:restart' op_type=op.op_type_key pk=op.pk as restart_url %}
{# Cancel/restart are htmx buttons (no full-page reload). CSRF travels as an #}
{# X-CSRFToken header injected from the cookie by liveops.js, so no rendered #}
{# token is needed — this also works on WS-pushed chained containers, which #}
{# have no request context. liveops.js flips visibility on liveop_finished. #}
{% if cancel_url %}
{% endif %}
{% if restart_url %}
{% endif %}