[pbs-devel] [PATCH proxmox-backup 3/3] ui: improve comment behaviour for datastore Summary

Dominik Csapak d.csapak at proxmox.com
Fri Nov 13 15:02:36 CET 2020


when we could not load the config (e.g. missing permissions)
show the comment from the global datastore-list

also show a messagebox for a load error instead of setting
the text of the comment box

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 www/datastore/Notes.js   | 2 +-
 www/datastore/Summary.js | 7 +++++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/www/datastore/Notes.js b/www/datastore/Notes.js
index 21462805..2928b7ec 100644
--- a/www/datastore/Notes.js
+++ b/www/datastore/Notes.js
@@ -56,7 +56,7 @@ Ext.define('PBS.DataStoreNotes', {
 	    url: me.url,
 	    waitMsgTarget: me,
 	    failure: function(response, opts) {
-		me.update(gettext('Error') + " " + response.htmlStatus);
+		Ext.Msg.alert(gettext('Error'), response.htmlStatus);
 		me.setCollapsed(false);
 	    },
 	    success: function(response, opts) {
diff --git a/www/datastore/Summary.js b/www/datastore/Summary.js
index 41fd7c85..c263846a 100644
--- a/www/datastore/Summary.js
+++ b/www/datastore/Summary.js
@@ -264,6 +264,13 @@ Ext.define('PBS.DataStoreSummary', {
 		me.down('pbsDataStoreInfo').setTitle(`${me.datastore} (${path})`);
 		me.down('pbsDataStoreNotes').setNotes(response.result.data.comment);
 	    },
+	    failure: function(response) {
+		// fallback if e.g. we have no permissions to the config
+		let rec = Ext.getStore('pbs-datastore-list').findRecord('store', me.datastore);
+		if (rec) {
+		    me.down('pbsDataStoreNotes').setNotes(rec.data.comment || "");
+		}
+	    },
 	});
 
 	me.query('proxmoxRRDChart').forEach((chart) => {
-- 
2.20.1






More information about the pbs-devel mailing list