Pools: show "Minimum free space" as absolute number instead of percentage

This commit is contained in:
bergware
2023-07-19 11:42:30 +02:00
parent dd503c9552
commit 4ee1b3e9d1
+4 -7
View File
@@ -39,13 +39,10 @@ function presetSpace($val) {
sanitize($val);
$size = _var($disk,'fsSize',0);
$size = $size>0 ? round(100*$val/$size,1) : 0;
$unit = '%';
if ($size < 1) {
$units = ['KB','MB','GB','TB','PB','EB','ZB','YB'];
$base = $val>0 ? floor(log($val,1000)) : 0;
$size = round($val/pow(1000,$base),1);
$unit = _var($units,$base);
}
$units = ['KB','MB','GB','TB','PB','EB','ZB','YB'];
$base = $val>0 ? floor(log($val,1000)) : 0;
$size = round($val/pow(1000,$base),1);
$unit = _var($units,$base);
[$dot,$comma] = str_split(_var($display,'number','.,'));
return $size>0 ? number_format($size,$size-floor($size)?1:0,$dot,$comma).' '.$unit : '';
}