Clean up cleanup dialog

- Remove duplicate 'Téléversements abandonnés' heading already communicated by the summary
- Replace #peertube-orphans-wrapper with display:contents wrapper so PeerTube details sit as direct grid siblings
- Add hx-confirm to all delete buttons (filepond, trash, PeerTube orphans)
This commit is contained in:
Pontoporeia
2026-06-21 17:52:30 +02:00
parent dfde88eaa5
commit 6aee5ec131
4 changed files with 12 additions and 13 deletions

View File

@@ -61,10 +61,6 @@ if ($totalStale === 0 && $totalFiles === 0): ?>
</summary> </summary>
<?php if ($fpStale > 0): ?> <?php if ($fpStale > 0): ?>
<p class="n-heading">
<?= icon('paint-brush-household') ?>
Téléversements abandonnés
</p>
<table class="n-table"> <table class="n-table">
<thead><tr><th>Nom</th><th>Taille</th><th>Âge</th><th width="1%"></th></tr></thead> <thead><tr><th>Nom</th><th>Taille</th><th>Âge</th><th width="1%"></th></tr></thead>
<tbody> <tbody>
@@ -76,6 +72,7 @@ if ($totalStale === 0 && $totalFiles === 0): ?>
<td style="white-space:nowrap"> <td style="white-space:nowrap">
<button type="button" class="btn btn--sm btn--danger" style="font-size:0.85em;padding:2px var(--space-xs)" <button type="button" class="btn btn--sm btn--danger" style="font-size:0.85em;padding:2px var(--space-xs)"
hx-post="/admin/actions/cleanup-tmp.php" hx-post="/admin/actions/cleanup-tmp.php"
hx-confirm="Supprimer définitivement ce téléversement abandonné ?"
hx-vals='{"csrf_token":"<?= htmlspecialchars($_SESSION['csrf_token']) ?>","filepond_dir":"<?= htmlspecialchars($f['name']) ?>"}' hx-vals='{"csrf_token":"<?= htmlspecialchars($_SESSION['csrf_token']) ?>","filepond_dir":"<?= htmlspecialchars($f['name']) ?>"}'
hx-target="#tmp-cleanup-stats-wrapper" hx-target="#tmp-cleanup-stats-wrapper"
hx-swap="outerHTML" hx-swap="outerHTML"
@@ -106,6 +103,7 @@ if ($totalStale === 0 && $totalFiles === 0): ?>
<td style="white-space:nowrap"> <td style="white-space:nowrap">
<button type="button" class="btn btn--sm btn--danger" style="font-size:0.85em;padding:2px var(--space-xs)" <button type="button" class="btn btn--sm btn--danger" style="font-size:0.85em;padding:2px var(--space-xs)"
hx-post="/admin/actions/cleanup-tmp.php" hx-post="/admin/actions/cleanup-tmp.php"
hx-confirm="Supprimer définitivement ce fichier de la corbeille ?"
hx-vals='{"csrf_token":"<?= htmlspecialchars($_SESSION['csrf_token']) ?>","trash_file":"<?= htmlspecialchars($f['name']) ?>"}' hx-vals='{"csrf_token":"<?= htmlspecialchars($_SESSION['csrf_token']) ?>","trash_file":"<?= htmlspecialchars($f['name']) ?>"}'
hx-target="#tmp-cleanup-stats-wrapper" hx-target="#tmp-cleanup-stats-wrapper"
hx-swap="outerHTML" hx-swap="outerHTML"

View File

@@ -4,7 +4,7 @@
* *
* GET /admin/actions/peertube-orphans-fragment.php * GET /admin/actions/peertube-orphans-fragment.php
* *
* Returns an HTML fragment ready for HTMX swap into #peertube-orphans-wrapper. * Returns an HTML fragment ready for HTMX swap into #peertube-orphans-fragment.
*/ */
require_once __DIR__ . '/../../../bootstrap.php'; require_once __DIR__ . '/../../../bootstrap.php';
require_once __DIR__ . '/../../../src/AdminAuth.php'; require_once __DIR__ . '/../../../src/AdminAuth.php';
@@ -17,7 +17,7 @@ $json = ob_get_clean();
$d = json_decode($json, true); $d = json_decode($json, true);
if (!($d['configured'] ?? false)): ?> if (!($d['configured'] ?? false)): ?>
<div id="peertube-orphans-wrapper"> <div id="peertube-orphans-fragment" style="display:contents">
<details id="peertube-orphans-col" class="n-section" open> <details id="peertube-orphans-col" class="n-section" open>
<summary> <summary>
<?= icon('video') ?> <?= icon('video') ?>
@@ -31,7 +31,7 @@ if (!($d['configured'] ?? false)): ?>
<?php return; endif; ?> <?php return; endif; ?>
<?php if (!empty($d['error'])): ?> <?php if (!empty($d['error'])): ?>
<div id="peertube-orphans-wrapper"> <div id="peertube-orphans-fragment" style="display:contents">
<details id="peertube-orphans-col" class="n-section" open> <details id="peertube-orphans-col" class="n-section" open>
<summary> <summary>
<?= icon('video') ?> <?= icon('video') ?>
@@ -44,7 +44,7 @@ if (!($d['configured'] ?? false)): ?>
</div> </div>
<?php return; endif; ?> <?php return; endif; ?>
<div id="peertube-orphans-wrapper"> <div id="peertube-orphans-fragment" style="display:contents">
<details id="peertube-orphans-col" class="n-section" open> <details id="peertube-orphans-col" class="n-section" open>
<summary> <summary>
<?= icon('video') ?> <?= icon('video') ?>
@@ -65,11 +65,12 @@ if (!($d['configured'] ?? false)): ?>
<td style="white-space:nowrap"> <td style="white-space:nowrap">
<button type="button" class="btn btn--sm btn--danger" style="font-size:0.85em;padding:2px var(--space-xs)" <button type="button" class="btn btn--sm btn--danger" style="font-size:0.85em;padding:2px var(--space-xs)"
hx-post="/admin/actions/peertube-delete.php" hx-post="/admin/actions/peertube-delete.php"
hx-confirm="Supprimer définitivement cette vidéo de PeerTube ?"
hx-vals='{"csrf_token":"<?= htmlspecialchars($_SESSION['csrf_token']) ?>","uuid":"<?= htmlspecialchars($v['uuid']) ?>"}' hx-vals='{"csrf_token":"<?= htmlspecialchars($_SESSION['csrf_token']) ?>","uuid":"<?= htmlspecialchars($v['uuid']) ?>"}'
hx-target="#peertube-orphans-wrapper" hx-target="#peertube-orphans-fragment"
hx-swap="outerHTML" hx-swap="outerHTML"
hx-trigger="click" hx-trigger="click"
hx-indicator="#peertube-orphans-wrapper"> hx-indicator="#peertube-orphans-fragment">
<?= icon('trash') ?> <?= icon('trash') ?>
Supprimer Supprimer
</button> </button>

View File

@@ -41,7 +41,7 @@ document.addEventListener('htmx:afterSwap',()=>{document.querySelectorAll('input
<?php endif; ?> <?php endif; ?>
<?php if ($tmpTotalCount > 0): ?> <?php if ($tmpTotalCount > 0): ?>
<button type="button" class="btn btn--sm btn--secondary" id="tmp-cleanup-btn" <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-wrapper','loadPeertube')"> onclick="document.getElementById('tmp-cleanup-dialog').showModal(); htmx.trigger('#tmp-cleanup-stats-wrapper','loadStats'); htmx.trigger('#peertube-orphans-fragment','loadPeertube')">
<?= icon('trash') ?> Nettoyer (<?= $tmpTotalCount ?>) <?= icon('trash') ?> Nettoyer (<?= $tmpTotalCount ?>)
</button> </button>
<?php endif; ?> <?php endif; ?>

View File

@@ -22,11 +22,11 @@
</details> </details>
</div> </div>
<!-- ═══════ PeerTube ═══════ --> <!-- ═══════ PeerTube ═══════ -->
<div id="peertube-orphans-wrapper" <div id="peertube-orphans-fragment" style="display:contents"
hx-get="/admin/actions/peertube-orphans-fragment.php" hx-get="/admin/actions/peertube-orphans-fragment.php"
hx-trigger="loadPeertube" hx-trigger="loadPeertube"
hx-swap="outerHTML" hx-swap="outerHTML"
hx-indicator="#peertube-orphans-wrapper"> hx-indicator="#peertube-orphans-fragment">
<p style="margin:0;color:var(--text-secondary)">Chargement…</p> <p style="margin:0;color:var(--text-secondary)">Chargement…</p>
</div> </div>
</div> </div>