From 9594362e350305f1e7b0543c6a5c2079db195481 Mon Sep 17 00:00:00 2001 From: Dominik Csapak Date: Tue, 1 Jun 2021 15:35:05 +0200 Subject: [PATCH] ui: datastore/DataStoreListSummary: catch and show errors per datastore so that the update does not get canceled because of a bad datastore hide the irrelevant fields in that case Signed-off-by: Dominik Csapak --- www/datastore/DataStoreListSummary.js | 35 +++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/www/datastore/DataStoreListSummary.js b/www/datastore/DataStoreListSummary.js index a9a8481a..eb9e04e1 100644 --- a/www/datastore/DataStoreListSummary.js +++ b/www/datastore/DataStoreListSummary.js @@ -21,6 +21,7 @@ Ext.define('PBS.datastore.DataStoreListSummary', { full: "N/A", stillbad: 0, deduplication: 1.0, + error: "", }, }, setTasks: function(taskdata, since) { @@ -32,6 +33,13 @@ Ext.define('PBS.datastore.DataStoreListSummary', { let me = this; let vm = me.getViewModel(); + if (statusData.error !== undefined) { + vm.set('error', statusData.error); + return; + } else { + vm.set('error', ""); + } + let usage = statusData.used/statusData.total; let usagetext = Ext.String.format(gettext('{0} of {1}'), Proxmox.Utils.format_size(statusData.used), @@ -83,12 +91,34 @@ Ext.define('PBS.datastore.DataStoreListSummary', { }, items: [ + { + xtype: 'box', + reference: 'errorBox', + hidden: true, + tpl: [ + '
', + `

${gettext("Error")}

`, + '', + '

', + '{text}', + '
', + ], + bind: { + visible: '{error}', + data: { + text: '{error}', + }, + }, + }, { xtype: 'proxmoxGauge', warningThreshold: 0.8, criticalThreshold: 0.95, flex: 1, reference: 'usage', + bind: { + visible: '{!error}', + }, }, { xtype: 'pmxInfoWidget', @@ -99,6 +129,7 @@ Ext.define('PBS.datastore.DataStoreListSummary', { data: { text: '{full}', }, + visible: '{!error}', }, }, { @@ -110,6 +141,7 @@ Ext.define('PBS.datastore.DataStoreListSummary', { data: { text: '{deduplication}', }, + visible: '{!error}', }, }, { @@ -143,6 +175,9 @@ Ext.define('PBS.datastore.DataStoreListSummary', { reference: 'historychart', title: gettext('Usage History'), height: 100, + bind: { + visible: '{!error}', + }, }, { xtype: 'container',