From 8e4dd14de0bc5f7a12ecd4ea11b9303e3b3e1062 Mon Sep 17 00:00:00 2001 From: Kirill Lakhov Date: Mon, 10 Jan 2022 23:14:31 +0300 Subject: [PATCH] Fix task data upload progress bar (#4134) * fix progressbar * updated changelog, changed progress check --- CHANGELOG.md | 1 + cvat-core/src/server-proxy.js | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d6f3b2a..b34f8929 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -47,6 +47,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Added information to export CVAT_HOST when performing local installation for accessing over network () - Fixed possible color collisions in the generated colormap () - Original pdf file is deleted when using share() +- Fixed task data upload progressbar() ### Security - Updated ELK to 6.8.22 which uses log4j 2.17.0 () diff --git a/cvat-core/src/server-proxy.js b/cvat-core/src/server-proxy.js index ec6e0204..40786a63 100644 --- a/cvat-core/src/server-proxy.js +++ b/cvat-core/src/server-proxy.js @@ -840,8 +840,8 @@ }, onProgress(bytesUploaded) { const currentUploadedSize = totalSentSize + bytesUploaded; - const percentage = ((currentUploadedSize / totalSize) * 100).toFixed(2); - onUpdate(`The data are being uploaded to the server ${percentage}%`); + const percentage = currentUploadedSize / totalSize; + onUpdate('The data are being uploaded to the server', percentage); }, onSuccess() { totalSentSize += file.size; @@ -869,8 +869,8 @@ for (const [idx, element] of fileBulks[currentChunkNumber].files.entries()) { taskData.append(`client_files[${idx}]`, element); } - onUpdate(`The data are being uploaded to the server - ${((totalSentSize / totalSize) * 100).toFixed(2)}%`); + const percentage = totalSentSize / totalSize; + onUpdate('The data are being uploaded to the server', percentage); await Axios.post(`${backendAPI}/tasks/${taskId}/data`, taskData, { ...params, proxy: config.proxy,