fix diskspace windows bytes (#7601)

This commit is contained in:
jessopb 2022-06-05 12:10:12 -04:00 committed by GitHub
parent 7b0d38eca7
commit dd6a156d7c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 12 additions and 12 deletions

View file

@ -8,6 +8,6 @@ declare type WalletServerDetails = {
};
declare type DiskSpace = {
total: string,
free: string,
total: number,
free: number,
};

View file

@ -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;

View file

@ -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');

View file

@ -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?

View file

@ -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),
});
});
});