fix: show MB during upload for values <100MB, GiB after
0.00008 GiB rounded to 0.0 — looked like no progress. Now shows '16 MB' → '128 MB' → '0.5 GiB' → '1.9 GiB' as upload progresses.
This commit is contained in:
parent
39cf91cbc4
commit
5f2cb3dc64
2 changed files with 7 additions and 6 deletions
4
clean.sh
4
clean.sh
|
|
@ -1,7 +1,5 @@
|
|||
#!/bin/bash
|
||||
/mnt/converter tree
|
||||
rm -rf /mnt/converter/in/*
|
||||
rm -rf /mnt/converter/out/*
|
||||
rm -rf /mnt/converter/tmp/*
|
||||
rm -rf /mnt/converter/backend/__pycache__/
|
||||
systemctl restart vm-bench-backend.service
|
||||
systemctl status vm-bench-backend.service
|
||||
|
|
|
|||
|
|
@ -159,10 +159,13 @@ async function handleUpload(formData) {
|
|||
xhr.upload.addEventListener('progress', (e) => {
|
||||
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);
|
||||
const mb = (e.loaded / (1024**2)).toFixed(0);
|
||||
const gb = (e.loaded / (1024**3)).toFixed(1);
|
||||
const size = e.loaded > 100*1024*1024 ? gb + ' GiB' : mb + ' MB';
|
||||
setPhase('Uploading source file... ' + size, pct, false);
|
||||
} else {
|
||||
// Fallback: show bytes uploaded even without total
|
||||
setPhase('Uploading source file... ' + (e.loaded / (1024**3)).toFixed(1) + ' GiB', 0, true);
|
||||
const mb = (e.loaded / (1024**2)).toFixed(0);
|
||||
setPhase('Uploading source file... ' + mb + ' MB', 0, true);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue