Browse Source

[Fix][UI] Fix bytesToSize function calculation error. (#10627)

(cherry picked from commit a6fc70cdd1)
3.0.0/version-upgrade
Amy0104 2 years ago committed by Jiajie Zhong
parent
commit
6b8e040443
  1. 3
      dolphinscheduler-ui/src/common/common.ts

3
dolphinscheduler-ui/src/common/common.ts

@ -46,8 +46,7 @@ export const bytesToSize = (bytes: number) => {
const k = 1024 // or 1024 const k = 1024 // or 1024
const sizes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'] const sizes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']
const i = Math.floor(Math.log(bytes) / Math.log(k)) const i = Math.floor(Math.log(bytes) / Math.log(k))
return parseFloat((bytes / Math.pow(k, i)).toPrecision(3)) + ' ' + sizes[i]
return parseInt((bytes / Math.pow(k, i)).toPrecision(3)) + ' ' + sizes[i]
} }
export const fileTypeArr = [ export const fileTypeArr = [

Loading…
Cancel
Save