mirror of
git://git.proxmox.com/git/proxmox-backup.git
synced 2025-01-10 01:18:06 +03:00
ui: datastore summary handle non-existent values
Correctly display missing 'avail' and 'used' attributes in the datatstore summary. This simply sets it to 0, so that we don't get any errors in the console. Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
This commit is contained in:
parent
1e3ed74be5
commit
0cac699e0c
@ -52,12 +52,20 @@ Ext.define('PBS.datastore.DataStoreListSummary', {
|
||||
vm.set('maintenance', '');
|
||||
}
|
||||
|
||||
let total = statusData.avail + statusData.used;
|
||||
let usage = statusData.used / total;
|
||||
let usagetext = Ext.String.format(gettext('{0} of {1}'),
|
||||
Proxmox.Utils.format_size(statusData.used, true),
|
||||
Proxmox.Utils.format_size(total, true),
|
||||
);
|
||||
let usagetext;
|
||||
let usage;
|
||||
|
||||
if (Object.hasOwn(statusData, 'avail') && Object.hasOwn(statusData, 'used')) {
|
||||
let total = statusData.avail + statusData.used;
|
||||
usage = statusData.used / total;
|
||||
usagetext = Ext.String.format(gettext('{0} of {1}'),
|
||||
Proxmox.Utils.format_size(statusData.used, true),
|
||||
Proxmox.Utils.format_size(total, true),
|
||||
);
|
||||
} else {
|
||||
usagetext = Ext.String.format(gettext('{0} of {1}'), 0, 0);
|
||||
usage = 0;
|
||||
}
|
||||
|
||||
let usagePanel = me.lookup('usage');
|
||||
usagePanel.updateValue(usage, usagetext);
|
||||
|
Loading…
Reference in New Issue
Block a user