mirror of
https://github.com/immich-app/immich.git
synced 2025-01-12 15:32:36 +02:00
fix(web): storage decimals (#5363)
This commit is contained in:
parent
5781ae9d82
commit
9483c456d4
@ -21,7 +21,8 @@
|
|||||||
return '0'.repeat(zeroLength);
|
return '0'.repeat(zeroLength);
|
||||||
};
|
};
|
||||||
|
|
||||||
$: [statsUsage, statsUsageUnit] = getBytesWithUnit(stats.usage, 0);
|
const TiB = 1024 ** 4;
|
||||||
|
$: [statsUsage, statsUsageUnit] = getBytesWithUnit(stats.usage, stats.usage > TiB ? 2 : 0);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="flex flex-col gap-5">
|
<div class="flex flex-col gap-5">
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
* @returns size (number) and unit (string)
|
* @returns size (number) and unit (string)
|
||||||
*/
|
*/
|
||||||
export function getBytesWithUnit(bytes: number, maxPrecision = 1): [number, string] {
|
export function getBytesWithUnit(bytes: number, maxPrecision = 1): [number, string] {
|
||||||
const units = ['B', 'KiB', 'MiB', 'GiB'];
|
const units = ['B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB'];
|
||||||
|
|
||||||
let magnitude = 0;
|
let magnitude = 0;
|
||||||
let remainder = bytes;
|
let remainder = bytes;
|
||||||
|
Loading…
Reference in New Issue
Block a user