You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by zh...@apache.org on 2022/08/03 11:57:26 UTC

[dolphinscheduler] 06/16: [Fix][UI] Fix bytesToSize function calculation error. (#10627)

This is an automated email from the ASF dual-hosted git repository.

zhongjiajie pushed a commit to branch 3.0.0-prepare
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git

commit 6b8e040443e2f3a249ac317164f7e5ff8ce1404f
Author: Amy0104 <97...@users.noreply.github.com>
AuthorDate: Mon Jun 27 13:55:37 2022 +0800

    [Fix][UI] Fix bytesToSize function calculation error. (#10627)
    
    (cherry picked from commit a6fc70cdd111a52a1342ff78953f5c3948e8add1)
---
 dolphinscheduler-ui/src/common/common.ts | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/dolphinscheduler-ui/src/common/common.ts b/dolphinscheduler-ui/src/common/common.ts
index ae644aeb01..2f5ed4d709 100644
--- a/dolphinscheduler-ui/src/common/common.ts
+++ b/dolphinscheduler-ui/src/common/common.ts
@@ -46,8 +46,7 @@ export const bytesToSize = (bytes: number) => {
   const k = 1024 // or 1024
   const sizes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']
   const i = Math.floor(Math.log(bytes) / Math.log(k))
-
-  return parseInt((bytes / Math.pow(k, i)).toPrecision(3)) + ' ' + sizes[i]
+  return parseFloat((bytes / Math.pow(k, i)).toPrecision(3)) + ' ' + sizes[i]
 }
 
 export const fileTypeArr = [