]> git.proxmox.com Git - proxmox-backup.git/commitdiff
gui: add snapshot/file fingerprint tooltip
authorFabian Grünbichler <f.gruenbichler@proxmox.com>
Fri, 20 Nov 2020 16:38:43 +0000 (17:38 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Tue, 24 Nov 2020 07:44:55 +0000 (08:44 +0100)
display short key ID, like backend's Display trait.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
www/Utils.js
www/datastore/Content.js

index ab48bdcf1070a634211fc7ec937482644173d742..775c03d772de0975ef62f5a0e2bb5241eb61618c 100644 (file)
@@ -161,6 +161,11 @@ Ext.define('PBS.Utils', {
        return `Datastore ${what} ${id}`;
     },
 
+    // mimics Display trait in backend
+    renderKeyID: function(fingerprint) {
+       return fingerprint.substring(0, 23);
+    },
+
     parse_datastore_worker_id: function(type, id) {
        let result;
        let res;
index acd4184b71ccf2f22f92b00d75ffa24bfcc1f896..12dacb8992722821853856ee4772c291307e964e 100644 (file)
@@ -12,6 +12,7 @@ Ext.define('pbs-data-store-snapshots', {
        'files',
        'owner',
        'verification',
+       'fingerprint',
        { name: 'size', type: 'int', allowNull: true },
        {
            name: 'crypt-mode',
@@ -182,6 +183,7 @@ Ext.define('PBS.DataStoreContent', {
                for (const file of data.files) {
                    file.text = file.filename;
                    file['crypt-mode'] = PBS.Utils.cryptmap.indexOf(file['crypt-mode']);
+                   file.fingerprint = data.fingerprint;
                    file.leaf = true;
                    file.matchesFilter = true;
 
@@ -699,7 +701,16 @@ Ext.define('PBS.DataStoreContent', {
                if (iconCls) {
                    iconTxt = `<i class="fa fa-fw fa-${iconCls}"></i> `;
                }
-               return (iconTxt + PBS.Utils.cryptText[v]) || Proxmox.Utils.unknownText;
+               let tip;
+               if (v !== PBS.Utils.cryptmap.indexOf('none') && record.data.fingerprint !== undefined) {
+                   tip = "Key: " + PBS.Utils.renderKeyID(record.data.fingerprint);
+               }
+               let txt = (iconTxt + PBS.Utils.cryptText[v]) || Proxmox.Utils.unknownText;
+               if (record.parentNode.id === 'root' || tip === undefined) {
+                   return txt;
+               } else {
+                   return `<span data-qtip="${tip}">${txt}</span>`;
+               }
            },
        },
        {