{# The packet page's top, on every tab: header, action bar, tab strip (docs/packet-page.md §2.1). Import "with context" (csrf, ide, ide_web, ide_sizes). #} {% import "_pause.html" as pz with context %} {% macro top(e, card, active, work=None) -%} {% set base = "/p/" ~ (e.name|urlencode) %}

{{ e.name }} {% if card.running %}RUNNING{% endif %}{{ pz.badge(card) }} {% if card.root and card.root.state == "NEEDS_INPUT" and not card.running %}NEEDS_INPUT {% elif card.root %}{{ card.root.state }}{% endif %}

{% if e.closed %}

Closed: off every board, shown read-only{{ " from history" if e.origin }}. Reopen, delete its folder or forget it

{% endif %} {% set og = origin_of(e) %}{% if og and (og.label or og.by) %}

{% if og.label %}From {% if og.url %}{{ og.label }}{% else %}{{ og.label }}{% endif %}{% endif %}{% if og.by %}{{ " · " if og.label }}made by {% if og.by.project %}{{ og.by.name }}{% else %}{{ og.by.name }}{% endif %}{% if og.batch %} ({{ og.batch }}){% endif %}{% endif %}{% if og.pr %} · handed off as pull request #{{ og.pr.number }}{% endif %}

{% endif %} {% set dsp = dispatched|default([]) %}{% if dsp %}

Dispatched: {% for d in dsp %}{{ d.name }} {{ d.state }}{% if d.deliver %} · {{ d.deliver }}{% endif %}{{ ", " if not loop.last }}{% endfor %}{% set b0 = dsp[0] %}{% if b0.batch %} · the batch on its board{% endif %}

{% endif %} {% if og and og.deliver %}
{{ og.deliver.text }} {% if og.deliver.pending %}{% endif %}
{% endif %} {% set can_task = card.root and not card.running and card.root.state in ("COMPLETED", "NEEDS_INPUT", "PAUSED", "FAILED") %} {# data-confirm on Stop now #}
{% if card.root and card.root.state == "NEEDS_INPUT" and not card.running %}Answer{% endif %} {% if can_task or card.setup %}{{ "Set it up" if card.setup else "New task" }} {% elif not e.archived %}Compose{% endif %} {% if card.running %}Live view{% endif %} {% if not e.archived %}{{ pz.button(card, base, "btn", stop=True) }}{% endif %} {% if og and og.forge and card.root and not card.running and card.root.state in ("COMPLETED", "FAILED", "PAUSED", "NEEDS_INPUT") %}
{% if og.pr %} {% else %}{% endif %}
{% endif %} {% set dsets = docs|default([]) %}{% if dsets %}{% set d0 = dsets|selectattr("has_html")|first %} {% if d0 %}Docs{% if d0.stale %} (stale){% endif %}{% endif %} {% endif %} {% if ide.desktop or ide_web %} {% endif %}
{%- endmacro %}