feat: Add media cleanup functionality with UI and backend support for unused media management

This commit is contained in:
Ross
2026-05-11 12:58:41 +01:00
parent c3131564e6
commit 8da8f27433
7 changed files with 392 additions and 3 deletions
@@ -0,0 +1,60 @@
{% if ran %}
<div class="card border-0 shadow-sm">
<div class="card-body">
<div class="d-flex flex-wrap align-items-center gap-2 mb-2">
{% if success %}
<span class="badge bg-success">Completed</span>
{% else %}
<span class="badge bg-danger">Failed</span>
{% endif %}
{% if dry_run %}
<span class="badge bg-info text-dark">Dry run</span>
{% else %}
<span class="badge bg-warning text-dark">Live cleanup</span>
{% endif %}
</div>
<div class="small text-muted mb-3">
minimum_file_age={{ minimum_file_age }}
{% if remove_empty_dirs %} | remove_empty_dirs=on{% else %} | remove_empty_dirs=off{% endif %}
{% if exclude %} | exclude masks provided{% endif %}
</div>
<div class="row g-2 mb-3">
<div class="col-12 col-md-4">
<div class="border rounded p-2 small">
<div class="text-muted">Media size before</div>
<div><strong>{{ media_size_before|filesizeformat }}</strong></div>
</div>
</div>
<div class="col-12 col-md-4">
<div class="border rounded p-2 small">
<div class="text-muted">Media size after</div>
<div><strong>{{ media_size_after|filesizeformat }}</strong></div>
</div>
</div>
<div class="col-12 col-md-4">
<div class="border rounded p-2 small">
<div class="text-muted">Recovered space</div>
<div><strong>{{ recovered_size|filesizeformat }}</strong></div>
</div>
</div>
</div>
{% if error_message %}
<div class="alert alert-danger py-2">{{ error_message }}</div>
{% endif %}
{% if output %}
<pre class="mb-0 p-3 border rounded small" style="max-height: 28rem; overflow-y: auto;">{{ output }}</pre>
{% else %}
<div class="alert alert-secondary mb-0 py-2">No output was returned by the command.</div>
{% endif %}
</div>
</div>
{% else %}
<div class="alert alert-secondary mb-0">
Use <strong>Preview unused files</strong> first, then run deletion when you are happy with the output.
</div>
{% endif %}