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 = {
|
declare type DiskSpace = {
|
||||||
total: string,
|
total: number,
|
||||||
free: string,
|
free: number,
|
||||||
};
|
};
|
||||||
|
|
|
@ -25,8 +25,8 @@ function StorageViz(props: Props) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const totalMB = diskSpace && Math.floor(Number(diskSpace.total) / 1024);
|
const totalMB = diskSpace && Math.floor(diskSpace.total / 1024);
|
||||||
const freeMB = diskSpace && Math.floor(Number(diskSpace.free) / 1024);
|
const freeMB = diskSpace && Math.floor(diskSpace.free / 1024);
|
||||||
const otherMB = totalMB - (freeMB + viewBlobSpace + autoBlobSpace + privateBlobSpace);
|
const otherMB = totalMB - (freeMB + viewBlobSpace + autoBlobSpace + privateBlobSpace);
|
||||||
const autoFree = autoHostingLimit - autoBlobSpace;
|
const autoFree = autoHostingLimit - autoBlobSpace;
|
||||||
const viewFree = viewHostingLimit > 0 ? viewHostingLimit - viewBlobSpace : freeMB - autoFree;
|
const viewFree = viewHostingLimit > 0 ? viewHostingLimit - viewBlobSpace : freeMB - autoFree;
|
||||||
|
|
|
@ -41,8 +41,8 @@ function HostingSplash(props: Props) {
|
||||||
handleDone,
|
handleDone,
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
const totalMB = diskSpace && Math.floor(Number(diskSpace.total) / 1024);
|
const totalMB = diskSpace && Math.floor(diskSpace.total / 1024);
|
||||||
const freeMB = diskSpace && Math.floor(Number(diskSpace.free) / 1024);
|
const freeMB = diskSpace && Math.floor(diskSpace.free / 1024);
|
||||||
const blobSpaceUsed = viewBlobSpace + autoBlobSpace;
|
const blobSpaceUsed = viewBlobSpace + autoBlobSpace;
|
||||||
|
|
||||||
const [hostingChoice, setHostingChoice] = React.useState('MANAGED');
|
const [hostingChoice, setHostingChoice] = React.useState('MANAGED');
|
||||||
|
|
|
@ -41,8 +41,8 @@ function SettingViewHosting(props: Props) {
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
// best effort to recommend a hosting amount default for the user
|
// best effort to recommend a hosting amount default for the user
|
||||||
const totalMB = diskSpace && Math.floor(Number(diskSpace.total) / 1024);
|
const totalMB = diskSpace && Math.floor(diskSpace.total / 1024);
|
||||||
const freeMB = diskSpace && Math.floor(Number(diskSpace.free) / 1024);
|
const freeMB = diskSpace && Math.floor(diskSpace.free / 1024);
|
||||||
const getGB = (val) => (Number(val) / 1024).toFixed(2);
|
const getGB = (val) => (Number(val) / 1024).toFixed(2);
|
||||||
const recommendedSpace =
|
const recommendedSpace =
|
||||||
freeMB > totalMB * TWENTY_PERCENT // plenty of space?
|
freeMB > totalMB * TWENTY_PERCENT // plenty of space?
|
||||||
|
|
|
@ -14,8 +14,8 @@ export const diskSpaceLinux = (path) => {
|
||||||
// C:\ 185087700 120552556 64535144 66% /mnt/c
|
// C:\ 185087700 120552556 64535144 66% /mnt/c
|
||||||
const dfResult = stdout.split('\n')[1].split(/\s+/);
|
const dfResult = stdout.split('\n')[1].split(/\s+/);
|
||||||
resolve({
|
resolve({
|
||||||
total: dfResult[1],
|
total: Number(dfResult[1]),
|
||||||
free: dfResult[3],
|
free: Number(dfResult[3]),
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -57,8 +57,8 @@ export const diskSpaceWindows = (path) => {
|
||||||
const [drive, freeSpace, totalSize] = driveLine.split(' ').filter((x) => x);
|
const [drive, freeSpace, totalSize] = driveLine.split(' ').filter((x) => x);
|
||||||
|
|
||||||
resolve({
|
resolve({
|
||||||
total: totalSize,
|
total: Math.floor(Number(totalSize) / 1024),
|
||||||
free: freeSpace,
|
free: Math.floor(Number(freeSpace) / 1024),
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue