diff --git a/flow-typed/Settings.js b/flow-typed/Settings.js index f98fa2d99..2c1b37f6c 100644 --- a/flow-typed/Settings.js +++ b/flow-typed/Settings.js @@ -8,6 +8,6 @@ declare type WalletServerDetails = { }; declare type DiskSpace = { - total: string, - free: string, + total: number, + free: number, }; diff --git a/ui/component/appStorageVisualization/view.jsx b/ui/component/appStorageVisualization/view.jsx index c8d40cbe9..51c508585 100644 --- a/ui/component/appStorageVisualization/view.jsx +++ b/ui/component/appStorageVisualization/view.jsx @@ -25,8 +25,8 @@ function StorageViz(props: Props) { ); } - const totalMB = diskSpace && Math.floor(Number(diskSpace.total) / 1024); - const freeMB = diskSpace && Math.floor(Number(diskSpace.free) / 1024); + const totalMB = diskSpace && Math.floor(diskSpace.total / 1024); + const freeMB = diskSpace && Math.floor(diskSpace.free / 1024); const otherMB = totalMB - (freeMB + viewBlobSpace + autoBlobSpace + privateBlobSpace); const autoFree = autoHostingLimit - autoBlobSpace; const viewFree = viewHostingLimit > 0 ? viewHostingLimit - viewBlobSpace : freeMB - autoFree; diff --git a/ui/component/hostingSplash/view.jsx b/ui/component/hostingSplash/view.jsx index efe9472a1..d26b83a94 100644 --- a/ui/component/hostingSplash/view.jsx +++ b/ui/component/hostingSplash/view.jsx @@ -41,8 +41,8 @@ function HostingSplash(props: Props) { handleDone, } = props; - const totalMB = diskSpace && Math.floor(Number(diskSpace.total) / 1024); - const freeMB = diskSpace && Math.floor(Number(diskSpace.free) / 1024); + const totalMB = diskSpace && Math.floor(diskSpace.total / 1024); + const freeMB = diskSpace && Math.floor(diskSpace.free / 1024); const blobSpaceUsed = viewBlobSpace + autoBlobSpace; const [hostingChoice, setHostingChoice] = React.useState('MANAGED'); diff --git a/ui/component/settingViewHosting/view.jsx b/ui/component/settingViewHosting/view.jsx index ff0a13050..e82b3b2cf 100644 --- a/ui/component/settingViewHosting/view.jsx +++ b/ui/component/settingViewHosting/view.jsx @@ -41,8 +41,8 @@ function SettingViewHosting(props: Props) { } = props; // best effort to recommend a hosting amount default for the user - const totalMB = diskSpace && Math.floor(Number(diskSpace.total) / 1024); - const freeMB = diskSpace && Math.floor(Number(diskSpace.free) / 1024); + const totalMB = diskSpace && Math.floor(diskSpace.total / 1024); + const freeMB = diskSpace && Math.floor(diskSpace.free / 1024); const getGB = (val) => (Number(val) / 1024).toFixed(2); const recommendedSpace = freeMB > totalMB * TWENTY_PERCENT // plenty of space? diff --git a/ui/util/diskspace.js b/ui/util/diskspace.js index ed9508bea..11c2b232e 100644 --- a/ui/util/diskspace.js +++ b/ui/util/diskspace.js @@ -14,8 +14,8 @@ export const diskSpaceLinux = (path) => { // C:\ 185087700 120552556 64535144 66% /mnt/c const dfResult = stdout.split('\n')[1].split(/\s+/); resolve({ - total: dfResult[1], - free: dfResult[3], + total: Number(dfResult[1]), + free: Number(dfResult[3]), }); }); }); @@ -57,8 +57,8 @@ export const diskSpaceWindows = (path) => { const [drive, freeSpace, totalSize] = driveLine.split(' ').filter((x) => x); resolve({ - total: totalSize, - free: freeSpace, + total: Math.floor(Number(totalSize) / 1024), + free: Math.floor(Number(freeSpace) / 1024), }); }); });