ui: fix encrypted column

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>
This commit is contained in:
Dominik Csapak 2020-06-23 12:09:46 +02:00 committed by Dietmar Maurer
parent 60f9a6ea8f
commit 676b0fde49

View 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"),