diff --git a/site/templates/upload.html b/site/templates/upload.html index eac9241..6eda210 100644 --- a/site/templates/upload.html +++ b/site/templates/upload.html @@ -59,7 +59,7 @@
Nubes - Сверка договоров v3.0.1 + Сверка договоров v3.1.1
@@ -159,6 +159,7 @@ function uploadFile(file, onProgress) { return new Promise(function(resolve, reject) { + var startTime = Date.now(); var fd = new FormData(); fd.append('files', file); if (contractId) fd.append('cid', contractId); @@ -167,7 +168,7 @@ xhr.open('POST', '/'); xhr.upload.onprogress = function(e) { if (e.lengthComputable && onProgress) { - onProgress(Math.round(e.loaded / e.total * 100)); + onProgress({pct: Math.round(e.loaded / e.total * 100), elapsed: (Date.now() - startTime) / 1000}); } }; xhr.onload = function() { @@ -205,8 +206,8 @@ var startTime = Date.now(); try { - var resp = await uploadFile(f, function(pct) { - fileQueue[rowIdx].status = '↑ ' + pct + '%'; + var resp = await uploadFile(f, function(info) { + fileQueue[rowIdx].status = '↑ ' + info.elapsed.toFixed(1) + 'с ' + info.pct + '%'; renderTable(); }); if (resp && resp.contract_id) contractId = resp.contract_id;