[pbs-devel] [PATCH proxmox-backup v2 2/3] ui: add fingerprint also to the 'show connection information' window

Dominik Csapak d.csapak at proxmox.com
Wed Nov 29 16:49:51 CET 2023


by globally calling the 'status' api once and saving the fingerprint
into the global Proxmox variable.

since not all users might have that permission, ignore errors for that,
and don't show the fingerprint in this case

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
changes from v1:
* adapt to changes in DatastoreRepoInfo
 www/MainView.js                 | 11 +++++++++++
 www/window/DatastoreRepoInfo.js |  9 +++++++++
 2 files changed, 20 insertions(+)

diff --git a/www/MainView.js b/www/MainView.js
index d35162e4..4dbfe9bf 100644
--- a/www/MainView.js
+++ b/www/MainView.js
@@ -184,6 +184,17 @@ Ext.define('PBS.MainView', {
 		interval: 15*60*1000,
 	    });
 
+	    Proxmox.Utils.API2Request({
+		url: `/api2/extjs/nodes/localhost/status`,
+		success: function({ result }) {
+		    if (result?.data?.info?.fingerprint) {
+			Proxmox.Fingerprint = result.data.info.fingerprint;
+		    }
+		},
+		failure: function() {
+		    // silently ignore errors
+		},
+	    });
 
 	    // select treeitem and load page from url fragment, if set
 	    let token = Ext.util.History.getToken() || 'pbsDashboard';
diff --git a/www/window/DatastoreRepoInfo.js b/www/window/DatastoreRepoInfo.js
index a7080c27..b2d4f402 100644
--- a/www/window/DatastoreRepoInfo.js
+++ b/www/window/DatastoreRepoInfo.js
@@ -13,6 +13,7 @@ Ext.define('PBS.window.DatastoreRepoInfo', {
 
     cbindData: function() {
 	let me = this;
+	let fingerprint = Proxmox.Fingerprint;
 	let host = window.location.hostname;
 	let hostname = host;
 	if (window.location.port.toString() !== "8007") {
@@ -26,6 +27,7 @@ Ext.define('PBS.window.DatastoreRepoInfo', {
 	return {
 	    datastore,
 	    hostname,
+	    fingerprint,
 	    repository,
 	    repositoryWithUser,
 	};
@@ -49,6 +51,13 @@ Ext.define('PBS.window.DatastoreRepoInfo', {
 		value: '{hostname}',
 	    },
 	},
+	{
+	    fieldLabel: gettext('Fingerprint'),
+	    cbind: {
+		value: '{fingerprint}',
+		hidden: '{!fingerprint}',
+	    },
+	},
 	{
 	    xtype: 'displayfield',
 	    value: '',
-- 
2.30.2





More information about the pbs-devel mailing list