debug: add console.log to upload handlers to diagnose missing progress

This commit is contained in:
Claus Lohmar 2026-07-21 19:46:08 +00:00
parent 5ff0635aa5
commit f032c546e1

View file

@ -69,9 +69,9 @@ function toggleSourceInput(e) {
// ── Progress helpers ────────────────────────────────────────────── // ── Progress helpers ──────────────────────────────────────────────
function setPhase(label, pct, isSpinner) { function setPhase(label, pct, isSpinner) {
const el = document.getElementById('phase-label'); const el = document.getElementById('phase-label');
if (el) el.innerHTML = (isSpinner ? '<span class="spinner"></span> ' : '') + label;
const fill = document.getElementById('progress-fill'); const fill = document.getElementById('progress-fill');
if (fill) { fill.style.width = pct + '%'; fill.textContent = pct > 0 ? pct + '%' : ''; } console.log('[setPhase] el:', !!el, 'fill:', !!fill, 'label:', label, 'pct:', pct);
if (el) el.innerHTML = (isSpinner ? '<span class="spinner"></span> ' : '') + label;
} }
function showError(msg) { function showError(msg) {
@ -135,8 +135,8 @@ async function handleUpload(formData) {
xhr.timeout = 7200000; // 2 hour timeout for very large uploads xhr.timeout = 7200000; // 2 hour timeout for very large uploads
xhr.upload.addEventListener('progress', (e) => { xhr.upload.addEventListener('progress', (e) => {
console.log('[upload] progress', e.loaded, e.total, e.lengthComputable);
if (e.lengthComputable) { if (e.lengthComputable) {
const pct = Math.round((e.loaded / e.total) * 100);
setPhase('Uploading source file... ' + (e.loaded / (1024**3)).toFixed(1) + ' GiB', pct, false); setPhase('Uploading source file... ' + (e.loaded / (1024**3)).toFixed(1) + ' GiB', pct, false);
} else { } else {
// Fallback: show bytes uploaded even without total // Fallback: show bytes uploaded even without total
@ -145,6 +145,7 @@ async function handleUpload(formData) {
}); });
xhr.addEventListener('loadstart', () => { xhr.addEventListener('loadstart', () => {
console.log('[upload] loadstart');
setPhase('Uploading source file...', 0, true); setPhase('Uploading source file...', 0, true);
}); });