cleanup: sélection multiple + page dédiée (/admin/cleanup.php)

- cleanup-tmp.php: accepte les arrays filepond_dirs[] et trash_files[] pour suppression en lot
- cleanup-stats-fragment.php: ajout checkboxes + barre d'actions groupées + formulaire bulk HTMX
- admin-cleanup-bulk.js: module JS pour toggleAll, updateBulk, bulkDelete
- Nouvelle page /admin/cleanup.php remplace la modale (tmp-cleanup.php supprimé)
- Bouton Nettoyer dans index.php devient un lien vers la page dédiée
This commit is contained in:
Pontoporeia
2026-07-03 17:06:23 +02:00
parent a5f658ce0c
commit a1f32acaa1
9 changed files with 183 additions and 55 deletions
+38
View File
@@ -0,0 +1,38 @@
<main id="main-content" class="admin-main--list">
<div class="admin-list-toolbar admin-list-toolbar--list" style="margin-bottom:var(--space-m)">
<div class="admin-toolbar-top">
<div class="admin-toolbar-title-row">
<h1>
<a href="/admin/" class="admin-back-btn" title="Retour à la liste"><?= icon('arrow-left-circle') ?></a>
Nettoyer les fichiers temporaires
</h1>
</div>
</div>
</div>
<div class="n-grid" id="cleanup-grid-parent">
<!-- ═══════ FilePond / Trash ═══════ -->
<div id="tmp-cleanup-stats-wrapper"
hx-get="/admin/actions/cleanup-stats-fragment.php"
hx-trigger="load"
hx-swap="outerHTML"
hx-indicator="#tmp-cleanup-stats-wrapper">
<details class="n-section" open>
<summary>
<?= icon('paint-brush-household') ?>
Fichiers temporaires
</summary>
<p style="margin:0;color:var(--text-secondary)">Chargement…</p>
</details>
</div>
<!-- ═══════ PeerTube ═══════ -->
<div id="peertube-orphans-fragment" style="display:contents"
hx-get="/admin/actions/peertube-orphans-fragment.php"
hx-trigger="load"
hx-swap="outerHTML"
hx-indicator="#peertube-orphans-fragment">
<p style="margin:0;color:var(--text-secondary)">Chargement…</p>
</div>
</div>
</main>
+2 -5
View File
@@ -29,10 +29,9 @@
</a>
<?php endif; ?>
<?php if ($tmpTotalCount > 0): ?>
<button type="button" class="btn btn--sm btn--secondary" id="tmp-cleanup-btn"
onclick="document.getElementById('tmp-cleanup-dialog').showModal(); htmx.trigger('#tmp-cleanup-stats-wrapper','loadStats'); htmx.trigger('#peertube-orphans-fragment','loadPeertube')">
<a href="/admin/cleanup.php" class="btn btn--sm btn--secondary">
<?= icon('trash') ?> Nettoyer (<?= $tmpTotalCount ?>)
</button>
</a>
<?php endif; ?>
<button type="button" class="btn btn--primary btn--sm" id="import-dialog-btn"
onclick="document.getElementById('import-dialog').showModal(); window.XamxamInitFilePonds()">
@@ -93,8 +92,6 @@
<?php include APP_ROOT . '/templates/admin/partials/dialogs/import.php'; ?>
<?php include APP_ROOT . '/templates/admin/partials/dialogs/tmp-cleanup.php'; ?>
<?php if ($importMessage || !empty($importErrors)): ?>
<script>document.getElementById('import-dialog').showModal();</script>
<?php endif; ?>
@@ -1,34 +0,0 @@
<dialog id="tmp-cleanup-dialog" class="admin-dialog admin-dialog--sheet" aria-labelledby="tmp-cleanup-title">
<div class="admin-dialog__header">
<h3 id="tmp-cleanup-title">Nettoyer les fichiers temporaires</h3>
<button type="button" class="admin-dialog__close" aria-label="Fermer"
onclick="document.getElementById('tmp-cleanup-dialog').close()">&#x2715;</button>
</div>
<div class="admin-dialog__body">
<div id="tmp-cleanup-result" style="display:none;margin-bottom:var(--space-sm)"></div>
<div class="n-grid" id="cleanup-grid-parent">
<!-- ═══════ FilePond / Trash ═══════ -->
<div id="tmp-cleanup-stats-wrapper"
hx-get="/admin/actions/cleanup-stats-fragment.php"
hx-trigger="loadStats"
hx-swap="outerHTML"
hx-indicator="#tmp-cleanup-stats-wrapper">
<details class="n-section" open>
<summary>
<?= icon('paint-brush-household') ?>
Fichiers temporaires
</summary>
<p style="margin:0;color:var(--text-secondary)">Chargement…</p>
</details>
</div>
<!-- ═══════ PeerTube ═══════ -->
<div id="peertube-orphans-fragment" style="display:contents"
hx-get="/admin/actions/peertube-orphans-fragment.php"
hx-trigger="loadPeertube"
hx-swap="outerHTML"
hx-indicator="#peertube-orphans-fragment">
<p style="margin:0;color:var(--text-secondary)">Chargement…</p>
</div>
</div>
</div>
</dialog>