fix: restore missing progress bar width update in setPhase + cleanup debug logs
The fill.style.width = pct + '%' line was lost during a previous edit, so the progress bar element was found but never visually updated. Events fired, label updated, but bar stayed at 0%.
This commit is contained in:
parent
0f69e725a5
commit
c31ad3409a
1 changed files with 1 additions and 3 deletions
|
|
@ -81,6 +81,7 @@ function setPhase(label, pct, isSpinner) {
|
||||||
const el = document.getElementById('phase-label');
|
const el = document.getElementById('phase-label');
|
||||||
const fill = document.getElementById('progress-fill');
|
const fill = document.getElementById('progress-fill');
|
||||||
if (el) el.innerHTML = (isSpinner ? '<span class="spinner"></span> ' : '') + label;
|
if (el) el.innerHTML = (isSpinner ? '<span class="spinner"></span> ' : '') + label;
|
||||||
|
if (fill) { fill.style.width = pct + '%'; fill.textContent = pct > 0 ? pct + '%' : ''; }
|
||||||
}
|
}
|
||||||
|
|
||||||
function showError(msg) {
|
function showError(msg) {
|
||||||
|
|
@ -137,7 +138,6 @@ async function startSession(e) {
|
||||||
btn.disabled = false;
|
btn.disabled = false;
|
||||||
}
|
}
|
||||||
async function handleUpload(formData) {
|
async function handleUpload(formData) {
|
||||||
console.log('handleUpload called, file:', formData.get('source_file')?.name);
|
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
const xhr = new XMLHttpRequest();
|
const xhr = new XMLHttpRequest();
|
||||||
const file = formData.get('source_file');
|
const file = formData.get('source_file');
|
||||||
|
|
@ -152,7 +152,6 @@ async function handleUpload(formData) {
|
||||||
xhr.setRequestHeader('X-VM-Name', vmName);
|
xhr.setRequestHeader('X-VM-Name', vmName);
|
||||||
|
|
||||||
xhr.upload.addEventListener('progress', (e) => {
|
xhr.upload.addEventListener('progress', (e) => {
|
||||||
console.log('progress', e.loaded, '/', e.total, 'computable:', e.lengthComputable);
|
|
||||||
if (e.lengthComputable) {
|
if (e.lengthComputable) {
|
||||||
const pct = Math.round((e.loaded / e.total) * 100);
|
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);
|
||||||
|
|
@ -163,7 +162,6 @@ async function handleUpload(formData) {
|
||||||
});
|
});
|
||||||
|
|
||||||
xhr.addEventListener('loadstart', () => {
|
xhr.addEventListener('loadstart', () => {
|
||||||
console.log('loadstart');
|
|
||||||
setPhase('Uploading source file...', 0, true);
|
setPhase('Uploading source file...', 0, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue