{% extends "admin/layout.html" %} {% block title %}File Management – Admin{% endblock %} {% block body %} {# ─── URL / sort macros ─────────────────────────────────────────────────────── #} {% macro up_page_url(p) %}?tab=uploads&search={{ search|urlencode }}&sort_by={{ sort_by }}&sort_dir={{ sort_dir }}&per_page={{ per_page }}&deleted={{ '1' if include_deleted else '0' }}&page={{ p }}{% endmacro %} {% macro up_sort_url(col) %}{% set nd = 'asc' if (sort_by == col and sort_dir == 'desc') else 'desc' %}?tab=uploads&search={{ search|urlencode }}&sort_by={{ col }}&sort_dir={{ nd }}&per_page={{ per_page }}&deleted={{ '1' if include_deleted else '0' }}&page=1{% endmacro %} {% macro up_sort_icon(col) %}{% if sort_by == col %}{% else %}{% endif %}{% endmacro %} {% macro conv_page_url(p) %}?tab=conversions&conv_search={{ conv_search|urlencode }}&conv_sort_by={{ conv_sort_by }}&conv_sort_dir={{ conv_sort_dir }}&conv_per_page={{ conv_per_page }}&conv_deleted={{ '1' if include_deleted_convs else '0' }}&conv_page={{ p }}{% endmacro %} {% macro conv_sort_url(col) %}{% set nd = 'asc' if (conv_sort_by == col and conv_sort_dir == 'desc') else 'desc' %}?tab=conversions&conv_search={{ conv_search|urlencode }}&conv_sort_by={{ col }}&conv_sort_dir={{ nd }}&conv_per_page={{ conv_per_page }}&conv_deleted={{ '1' if include_deleted_convs else '0' }}&conv_page=1{% endmacro %} {% macro conv_sort_icon(col) %}{% if conv_sort_by == col %}{% else %}{% endif %}{% endmacro %}

{% trans %}File Management{% endtrans %}

{% trans %}Uploads:{% endtrans %} {{ total }} {% trans %} ·  Conversions:{% endtrans %} {{ conv_total }}

{% if include_deleted %}{% trans %}Hide Deleted{% endtrans %}{% else %}{% trans %}Show Deleted{% endtrans %}{% endif %}
{% if storage %}
{% trans %}Uploads Storage{% endtrans %}
{{ fmt_bytes(storage.uploads_bytes) }}
{% trans %}Conversions Storage{% endtrans %}
{{ fmt_bytes(storage.conversions_bytes) }}
{% trans %}Total Storage Used{% endtrans %}
{{ fmt_bytes((storage.uploads_bytes or 0) + (storage.conversions_bytes or 0)) }}
{% endif %}
{% trans %}Reset{% endtrans %}
{% if files %}
{% for f in files %} {% endfor %}
{% trans %}File{% endtrans %}{{ up_sort_icon('file_name') }} {% trans %}User{% endtrans %}{{ up_sort_icon('username') }} {% trans %}Size{% endtrans %}{{ up_sort_icon('file_size') }} {% trans %}Status{% endtrans %} {% trans %}Date{% endtrans %}{{ up_sort_icon('uploaded_at') }} {% trans %}Actions{% endtrans %}
{{ f.file_name or '—' }}
{% if f.get('input_format') or f.get('output_format') %}
{{ f.get('input_format','?') }}{{ f.get('output_format','?') }}
{% endif %}
{% if f.user_id %} {{ f.get('username','#' + (f.user_id|string)) }} {% else %} {% trans %}Guest{% endtrans %} {% endif %} {{ fmt_bytes(f.file_size) if f.get('file_size') else '—' }} {% if f.deleted_at %}{% trans %}deleted{% endtrans %}{% else %}{{ f.get('status','—') }}{% endif %} {{ (f.uploaded_at or f.get('created_at','—'))[:16] }}
{% if not f.deleted_at %} {% endif %} {% if f.get('conv_id') and f.get('conv_output_path') %} {% endif %} {% if not f.deleted_at %}
{% else %}
{% endif %}
{# ── Uploads numbered pagination ── #} {% set _us = (page - 1) * per_page + 1 %}{% set _ue = [page * per_page, total]|min %}
{% if total > 0 %}{% trans %}Showing{% endtrans %} {{ _us }}–{{ _ue }} {% trans %}of{% endtrans %} {{ total }}{% else %}{% trans %}No results{% endtrans %}{% endif %} {% if total_pages > 1 %}
{% if page > 1 %} « ‹ {% trans %}Prev{% endtrans %} {% endif %} {% set _lo = [1, page - 2]|max %}{% set _hi = [total_pages, page + 2]|min %} {% if _lo > 1 %}{% endif %} {% for p in range(_lo, _hi + 1) %} {{ p }} {% endfor %} {% if _hi < total_pages %}{% endif %} {% if page < total_pages %} {% trans %}Next{% endtrans %} › » {% endif %}
{% endif %}
{% else %}
{% trans %}No uploads found.{% endtrans %}
{% endif %}
{% if conversions %}
{% for c in conversions %} {% endfor %}
{% trans %}ID{% endtrans %}{{ conv_sort_icon('id') }} {% trans %}File{% endtrans %} {% trans %}Input{% endtrans %}{{ conv_sort_icon('input_format') }} {% trans %}Output{% endtrans %}{{ conv_sort_icon('output_format') }} {% trans %}User{% endtrans %}{{ conv_sort_icon('username') }} {% trans %}Status{% endtrans %}{{ conv_sort_icon('status') }} {% trans %}Date{% endtrans %}{{ conv_sort_icon('created_at') }} {% trans %}Actions{% endtrans %}
#{{ c.id }}
{{ c.get('file_name') or c.get('input_file','—') }}
{% if c.get('file_size') %}
{{ fmt_bytes(c.file_size) }}
{% endif %}
{{ c.get('input_format','?') }} {{ c.get('output_format','?') }} {% if c.get('user_id') %} {{ c.get('username','#' + (c.user_id|string)) }} {% else %} {% trans %}Guest{% endtrans %} {% endif %} {{ c.get('status','—') }} {% if c.get('status') != 'deleted' and not c.get('upload_id') %}{% trans %}Upload del{% endtrans %}{% endif %} {% if c.get('status') not in ['deleted','expired','cancelled'] and c.get('upload_id') and not c.get('output_path') %}{% trans %}Output del{% endtrans %}{% endif %} {{ (c.get('created_at','—'))[:16] }}
{% if c.get('output_path') and c.get('status') not in ['deleted', 'expired'] %} {% endif %} {% if c.get('status') == 'failed' and c.get('upload_id') %}
{% endif %}
{# ── Conversions numbered pagination ── #} {% set _cs = (conv_page - 1) * conv_per_page + 1 %}{% set _ce = [conv_page * conv_per_page, conv_total]|min %}
{% if conv_total > 0 %}{% trans %}Showing{% endtrans %} {{ _cs }}–{{ _ce }} {% trans %}of{% endtrans %} {{ conv_total }}{% else %}{% trans %}No results{% endtrans %}{% endif %} {% if conv_total_pages > 1 %}
{% if conv_page > 1 %} « ‹ {% trans %}Prev{% endtrans %} {% endif %} {% set _clo = [1, conv_page - 2]|max %}{% set _chi = [conv_total_pages, conv_page + 2]|min %} {% if _clo > 1 %}{% endif %} {% for p in range(_clo, _chi + 1) %} {{ p }} {% endfor %} {% if _chi < conv_total_pages %}{% endif %} {% if conv_page < conv_total_pages %} {% trans %}Next{% endtrans %} › » {% endif %}
{% endif %}
{% else %}
{% trans %}No conversions found.{% endtrans %}
{% endif %}
{% endblock %}