From 5658504b9033aca858daaef14de62a2216662976 Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Fri, 21 May 2021 12:20:39 +0200 Subject: [PATCH] dashboard statistics: prepare a more graceful error handling in datastore-usage Signed-off-by: Thomas Lamprecht --- www/dashboard/DataStoreStatistics.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/www/dashboard/DataStoreStatistics.js b/www/dashboard/DataStoreStatistics.js index 7a0cb3dd..44c2089b 100644 --- a/www/dashboard/DataStoreStatistics.js +++ b/www/dashboard/DataStoreStatistics.js @@ -6,6 +6,9 @@ Ext.define('pbs-datastore-statistics', { { name: 'history', convert: function(values) { + if (!values) { + return []; + } let last = null; return values.map(v => { if (v !== undefined && v !== null) { @@ -63,21 +66,21 @@ Ext.define('PBS.DatastoreStatistics', { dataIndex: 'total', sortable: true, width: 90, - renderer: Proxmox.Utils.format_size, + renderer: v => v === undefined || v < 0 ? '-' : Proxmox.Utils.format_size(v), }, { text: gettext('Used'), dataIndex: 'used', sortable: true, width: 90, - renderer: Proxmox.Utils.format_size, + renderer: v => v === undefined || v < 0 ? '-' : Proxmox.Utils.format_size(v), }, { text: gettext('Available'), dataIndex: 'avail', sortable: true, width: 90, - renderer: Proxmox.Utils.format_size, + renderer: v => v === undefined || v < 0 ? '-' : Proxmox.Utils.format_size(v), }, { text: gettext('Usage %'),