fix 'NaN%' when max value is 0
when we get a max value of 0 (for example when a storage is not active) the render function would show: 'NaN% (0B of 0B)' because of a division by 0 this patch simply returns 'N/A' because a max value of 0 should never be valid Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
parent
ccba60877b
commit
be285dea66
@ -1003,6 +1003,9 @@ Ext.define('PVE.Utils', { utilities: {
|
||||
},
|
||||
|
||||
render_size_usage: function(val, max) {
|
||||
if (max === 0) {
|
||||
return gettext('N/A');
|
||||
}
|
||||
return (val*100/max).toFixed(2) + '% '+ '(' +
|
||||
Ext.String.format(gettext('{0} of {1}'),
|
||||
PVE.Utils.render_size(val), PVE.Utils.render_size(max)) + ')';
|
||||
|
Loading…
x
Reference in New Issue
Block a user