Share/Pool size calculation: show and allow percentage values

This commit is contained in:
bergware
2023-04-25 09:29:42 +02:00
parent 18268788c2
commit 327e04e882
2 changed files with 4 additions and 4 deletions

View File

@@ -43,9 +43,9 @@ function presetSpace($val) {
$units = ['KB','MB','GB','TB','PB','EB','ZB','YB'];
$base = $val>0 ? floor(log($val,1000)) : 0;
$size = round($val/pow(1000,$base),1);
return number_format($size,$size-floor($size)==0?0:1,$dot,$comma).' '._var($units,$base);
return number_format($size,$size-floor($size)?1:0,$dot,$comma).' '._var($units,$base);
} else {
return $size>0 ? number_format($size,$size-floor($size)==0?0:1,$dot,$comma).' %' : '';
return $size>0 ? number_format($size,$size-floor($size)?1:0,$dot,$comma).' %' : '';
}
}
function fsSize() {

View File

@@ -71,9 +71,9 @@ function presetSpace($val) {
$units = ['KB','MB','GB','TB','PB','EB','ZB','YB'];
$base = $val>0 ? floor(log($val,1000)) : 0;
$size = round($val/pow(1000,$base),1);
return number_format($size,$size-floor($size)==0?0:1,$dot,$comma).' '._var($units,$base);
return number_format($size,$size-floor($size)?1:0,$dot,$comma).' '._var($units,$base);
} else {
return $size>0 ? number_format($size,$size-floor($size)==0?0:1,$dot,$comma).' %' : '';
return $size>0 ? number_format($size,$size-floor($size)?1:0,$dot,$comma).' %' : '';
}
}
function fsSize() {