fix diskspace windows bytes (#7601)
This commit is contained in:
parent
7b0d38eca7
commit
dd6a156d7c
5 changed files with 12 additions and 12 deletions
4
flow-typed/Settings.js
vendored
4
flow-typed/Settings.js
vendored
|
@ -8,6 +8,6 @@ declare type WalletServerDetails = {
|
|||
};
|
||||
|
||||
declare type DiskSpace = {
|
||||
total: string,
|
||||
free: string,
|
||||
total: number,
|
||||
free: number,
|
||||
};
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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');
|
||||
|
|
|
@ -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?
|
||||
|
|
|
@ -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),
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue