From e53fcacaa6e6429386e5d6030726f252f65541b1 Mon Sep 17 00:00:00 2001 From: Claus Lohmar Date: Mon, 27 Jul 2026 07:52:48 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20show=20all=20leftover=20sessions=20?= =?UTF-8?q?=E2=80=94=20resumable=20ones=20get=20Resume,=20stale=20ones=20g?= =?UTF-8?q?et=20Clean=20Up?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app.py | 3 +-- frontend/templates/index.html | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/backend/app.py b/backend/app.py index 10ccb5c..4f11834 100644 --- a/backend/app.py +++ b/backend/app.py @@ -166,13 +166,12 @@ def list_sessions(): continue archives = {".7z", ".zip", ".rar", ".tar.gz", ".tgz", ".tar", ".gz", ".bz2", ".xz", ".ova"} has_source = has_disks or any(f["name"].lower().endswith(tuple(archives)) for f in session_files) - if not has_source: - continue sessions.append({ "session_id": entry.name, "files": session_files[:10], "total_size_gb": round(total_bytes / (1024**3), 1), "has_disks": has_disks, + "resumable": has_source, }) except Exception: pass diff --git a/frontend/templates/index.html b/frontend/templates/index.html index f964f7f..501718e 100644 --- a/frontend/templates/index.html +++ b/frontend/templates/index.html @@ -109,7 +109,11 @@ async function loadSessions() { html += '
' + s.session_id.substring(0, 8) + ' — ' + fileNames + ' (' + s.total_size_gb + ' GiB)'; if (s.has_disks) html += ' extracted'; html += '
'; - html += ''; + if (s.resumable) { + html += ''; + } else { + html += ''; + } html += ''; } list.innerHTML = html; @@ -139,6 +143,17 @@ function resumeSession(sessionId, firstFile) { document.getElementById('source-url').required = false; } +function cleanupSession(sessionId, btn) { + if (!confirm('Delete session ' + sessionId.substring(0, 8) + '?')) return; + btn.disabled = true; + btn.textContent = '...'; + fetch('/session/cleanup/cleanup_' + sessionId, { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ delete_staging_files: true, session_id: sessionId }) + }).then(function() { loadSessions(); }); +} + function setPhase(label, pct, isSpinner) { const el = document.getElementById('phase-label'); const fill = document.getElementById('pve-progress-bar');