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:
parent
60f9a6ea8f
commit
676b0fde49
@ -13,7 +13,7 @@ Ext.define('pbs-data-store-snapshots', {
|
|||||||
{ name: 'size', type: 'int' },
|
{ name: 'size', type: 'int' },
|
||||||
{
|
{
|
||||||
name: 'encrypted',
|
name: 'encrypted',
|
||||||
type: 'string',
|
type: 'boolean',
|
||||||
calculate: function(data) {
|
calculate: function(data) {
|
||||||
let encrypted = 0;
|
let encrypted = 0;
|
||||||
let files = 0;
|
let files = 0;
|
||||||
@ -26,13 +26,12 @@ Ext.define('pbs-data-store-snapshots', {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (encrypted === 0) {
|
if (encrypted === 0) {
|
||||||
return Proxmox.Utils.noText;
|
return 0;
|
||||||
} else if (encrypted < files) {
|
} else if (encrypted < files) {
|
||||||
return gettext('Partial');
|
return 1;
|
||||||
} else if (encrypted === files) {
|
} else {
|
||||||
return Proxmox.Utils.yesText;
|
return 2;
|
||||||
}
|
}
|
||||||
return Proxmox.Utils.unknowText;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -144,21 +143,27 @@ Ext.define('PBS.DataStoreContent', {
|
|||||||
let children = [];
|
let children = [];
|
||||||
for (const [_key, group] of Object.entries(groups)) {
|
for (const [_key, group] of Object.entries(groups)) {
|
||||||
let last_backup = 0;
|
let last_backup = 0;
|
||||||
|
let encrypted = 0;
|
||||||
for (const item of group.children) {
|
for (const item of group.children) {
|
||||||
|
if (item.encrypted > 0) {
|
||||||
|
encrypted++;
|
||||||
|
}
|
||||||
if (item["backup-time"] > last_backup) {
|
if (item["backup-time"] > last_backup) {
|
||||||
last_backup = item["backup-time"];
|
last_backup = item["backup-time"];
|
||||||
group["backup-time"] = last_backup;
|
group["backup-time"] = last_backup;
|
||||||
group.files = item.files;
|
group.files = item.files;
|
||||||
group.size = item.size;
|
group.size = item.size;
|
||||||
group.owner = item.owner;
|
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;
|
group.count = group.children.length;
|
||||||
children.push(group);
|
children.push(group);
|
||||||
}
|
}
|
||||||
@ -225,6 +230,14 @@ Ext.define('PBS.DataStoreContent', {
|
|||||||
{
|
{
|
||||||
header: gettext('Encrypted'),
|
header: gettext('Encrypted'),
|
||||||
dataIndex: '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"),
|
header: gettext("Files"),
|
||||||
|
Loading…
Reference in New Issue
Block a user