{# Background transfer status for one peer (Phase 6). The fragment swaps itself: while any batch is active it polls every 2s; when idle it only re-fetches on the sharingTransfersChanged trigger (fired by the routes that enqueue a batch), so an idle page costs nothing. #} {% set any_active = transfers | selectattr('active') | list | length > 0 %}
{% if transfers %}

{{ _("Transfers") }}

{% for batch in transfers %}
{{ batch.label }} {% if batch.path == 'local' %} {{ _("Local network") }} {% elif batch.path == 'direct' %} {{ _("Direct") }} {% elif batch.path == 'relay' %} {{ _("Via relay (metered)") }} {% endif %} {% if batch.state == 'collecting' %}{{ _("Collecting file list…") }} {% elif batch.state == 'running' %}{{ _("Transferring") }} {% elif batch.state == 'paused_relay_budget' %}{{ _("Paused") }} {% elif batch.state == 'completed' %}{{ _("Completed") }} {% elif batch.state == 'completed_with_errors' %}{{ _("Completed with errors") }} {% elif batch.state == 'failed' %}{{ _("Failed") }} {% elif batch.state == 'cancelled' %}{{ _("Cancelled") }} {% endif %}
{% if batch.active %} {% else %} {% endif %}
{% if batch.files_total %}
{% trans trimmed count=batch.files_total, done=batch.files_done|format_integer, total=batch.files_total|format_integer %} {{ done }} of {{ total }} file {% pluralize %} {{ done }} of {{ total }} files {% endtrans %} {% if batch.bytes_total %} — {{ batch.bytes_done | filesizeformat }} / {{ batch.bytes_total | filesizeformat }} {% endif %} {% if batch.relay_bytes %} — {{ _("%(amount)s over the relay", amount=batch.relay_bytes | filesizeformat) }} {% endif %}
{% if batch.bytes_total %}
{{ (batch.bytes_done / batch.bytes_total) | format_percent(2) }}
{% endif %} {% endif %} {% if batch.active_files %}
{{ _("Pulling:") }} {{ batch.active_files | join(', ') }}
{% endif %} {% if batch.paused_for_budget %}

{{ _("This transfer reached %(budget)s over the shared relay. Relay traffic is metered — if both devices can be on the same network, that is the free path.", budget=batch.relay_budget_bytes | filesizeformat) }}

{% endif %} {% if batch.error %}

{{ batch.error }}

{% endif %} {% if batch.failed_files %}
    {% for failure in batch.failed_files %}
  • {{ failure.name }}{% if failure.error %} — {{ failure.error }}{% endif %}
  • {% endfor %}
{% endif %}
{% endfor %}
{% endif %}