]> git.proxmox.com Git - proxmox-backup.git/commitdiff
ui: fix encrypted column
authorDominik Csapak <d.csapak@proxmox.com>
Tue, 23 Jun 2020 10:09:46 +0000 (12:09 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Wed, 24 Jun 2020 05:00:32 +0000 (07:00 +0200)
do not use two different gettexts for groups and single backups
and correct logic for backup groups

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
www/DataStoreContent.js

index 931cb7fd9049778b406fdb3977b059ef38253e38..9703971630a51740e41e523c7e0b66656133e72d 100644 (file)
@@ -13,7 +13,7 @@ Ext.define('pbs-data-store-snapshots', {
        { name: 'size', type: 'int' },
        {
            name: 'encrypted',
-           type: 'string',
+           type: 'boolean',
            calculate: function(data) {
                let encrypted = 0;
                let files = 0;
@@ -26,13 +26,12 @@ Ext.define('pbs-data-store-snapshots', {
                });
 
                if (encrypted === 0) {
-                   return Proxmox.Utils.noText;
+                   return 0;
                } else if (encrypted < files) {
-                   return gettext('Partial');
-               } else if (encrypted === files) {
-                   return Proxmox.Utils.yesText;
+                   return 1;
+               } else {
+                   return 2;
                }
-               return Proxmox.Utils.unknowText;
            }
        }
     ]
@@ -144,21 +143,27 @@ Ext.define('PBS.DataStoreContent', {
            let children = [];
            for (const [_key, group] of Object.entries(groups)) {
                let last_backup = 0;
+               let encrypted = 0;
                for (const item of group.children) {
+                   if (item.encrypted > 0) {
+                       encrypted++;
+                   }
                    if (item["backup-time"] > last_backup) {
                        last_backup = item["backup-time"];
                        group["backup-time"] = last_backup;
                        group.files = item.files;
                        group.size = item.size;
                        group.owner = item.owner;
-                       if (group.encrypted !== undefined && group.encrypted !== item.encrypted) {
-                           group.encrypted = gettext('Mixed');
-                       } else {
-                           group.encrypted = item.encrypted;
-                       }
                    }
 
                }
+               if (encrypted === 0) {
+                   group.encrypted = 0;
+               } else if (encrypted < group.children.length) {
+                   group.encrypted = 1;
+               } else {
+                   group.encrypted = 2;
+               }
                group.count = group.children.length;
                children.push(group);
            }
@@ -225,6 +230,14 @@ Ext.define('PBS.DataStoreContent', {
        {
            header: gettext('Encrypted'),
            dataIndex: 'encrypted',
+           renderer: function(value) {
+               switch (value) {
+                   case 0: return Proxmox.Utils.noText;
+                   case 1: return gettext('Mixed');
+                   case 2: return Proxmox.Utils.yesText;
+                   default: Proxmox.Utils.unknownText;
+               }
+           }
        },
        {
            header: gettext("Files"),