From c9fb0f38870773f09eb0a34022433de7c6fd355f Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Fri, 27 May 2022 10:58:38 +0200 Subject: [PATCH] ui: datastore summary: cope with optional gc-stats Signed-off-by: Thomas Lamprecht --- www/datastore/Summary.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/www/datastore/Summary.js b/www/datastore/Summary.js index bed53844..d13ea640 100644 --- a/www/datastore/Summary.js +++ b/www/datastore/Summary.js @@ -73,20 +73,20 @@ Ext.define('PBS.DataStoreInfo', { vm.set('usagetext', usage); vm.set('usage', used/total); - let gcstatus = store.getById('gc-status').data.value; - - let dedup = PBS.Utils.calculate_dedup_factor(gcstatus); - let countstext = function(count) { count = count || {}; return `${count.groups || 0} ${gettext('Groups')}, ${count.snapshots || 0} ${gettext('Snapshots')}`; }; + let gcstatus = store.getById('gc-status')?.data.value; + if (gcstatus) { + let dedup = PBS.Utils.calculate_dedup_factor(gcstatus); + vm.set('deduplication', dedup.toFixed(2)); + vm.set('stillbad', gcstatus['still-bad']); + } vm.set('ctcount', countstext(counts.ct)); vm.set('vmcount', countstext(counts.vm)); vm.set('hostcount', countstext(counts.host)); - vm.set('deduplication', dedup.toFixed(2)); - vm.set('stillbad', gcstatus['still-bad']); }, startStore: function() { this.store.startUpdate(); },