From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <d.csapak@proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
 (No client certificate requested)
 by lists.proxmox.com (Postfix) with ESMTPS id 1B36A743FA
 for <pbs-devel@lists.proxmox.com>; Tue,  1 Jun 2021 15:35:08 +0200 (CEST)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id 0A39829EB1
 for <pbs-devel@lists.proxmox.com>; Tue,  1 Jun 2021 15:35:08 +0200 (CEST)
Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com
 [94.136.29.106])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits))
 (No client certificate requested)
 by firstgate.proxmox.com (Proxmox) with ESMTPS id 6FEC429EA6
 for <pbs-devel@lists.proxmox.com>; Tue,  1 Jun 2021 15:35:07 +0200 (CEST)
Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1])
 by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 4402446443
 for <pbs-devel@lists.proxmox.com>; Tue,  1 Jun 2021 15:35:07 +0200 (CEST)
From: Dominik Csapak <d.csapak@proxmox.com>
To: pbs-devel@lists.proxmox.com
Date: Tue,  1 Jun 2021 15:35:05 +0200
Message-Id: <20210601133506.28376-1-d.csapak@proxmox.com>
X-Mailer: git-send-email 2.20.1
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-SPAM-LEVEL: Spam detection results:  1
 AWL -1.560 Adjusted score from AWL reputation of From: address
 ENA_SUBJ_ODD_CASE         3.2 Subject has odd case
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
Subject: [pbs-devel] [PATCH proxmox-backup 1/2] ui:
 datastore/DataStoreListSummary: catch and show errors per datastore
X-BeenThere: pbs-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox Backup Server development discussion
 <pbs-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pbs-devel>, 
 <mailto:pbs-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pbs-devel/>
List-Post: <mailto:pbs-devel@lists.proxmox.com>
List-Help: <mailto:pbs-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel>, 
 <mailto:pbs-devel-request@lists.proxmox.com?subject=subscribe>
X-List-Received-Date: Tue, 01 Jun 2021 13:35:08 -0000

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 <d.csapak@proxmox.com>
---
 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: [
+			'<center>',
+			`<h3>${gettext("Error")}</h3>`,
+			'<i class="fa fa-5x fa-exclamation-circle critical"></i>',
+			'<br /><br/>',
+			'{text}',
+			'</center>',
+		    ],
+		    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',
-- 
2.20.1