ui: add encryption info to snapshot list

show which backups/files are encrypted in the snapshot list

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak 2020-06-18 13:55:25 +02:00 committed by Dietmar Maurer
parent 1c090810f5
commit e005f953d9
1 changed files with 43 additions and 1 deletions

View File

@ -11,6 +11,30 @@ Ext.define('pbs-data-store-snapshots', {
'files', 'files',
'owner', 'owner',
{ name: 'size', type: 'int' }, { name: 'size', type: 'int' },
{
name: 'encrypted',
type: 'string',
calculate: function(data) {
let encrypted = 0;
let files = 0;
data.files.forEach(file => {
if (file.filename === 'index.json.blob') return; // is never encrypted
if (file.encrypted) {
encrypted++;
}
files++;
});
if (encrypted === 0) {
return Proxmox.Utils.noText;
} else if (encrypted < files) {
return gettext('Partial');
} else if (encrypted === files) {
return Proxmox.Utils.yesText;
}
return Proxmox.Utils.unknowText;
}
}
] ]
}); });
@ -127,7 +151,13 @@ Ext.define('PBS.DataStoreContent', {
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;
}
} }
} }
group.count = group.children.length; group.count = group.children.length;
children.push(group); children.push(group);
@ -192,13 +222,25 @@ Ext.define('PBS.DataStoreContent', {
sortable: true, sortable: true,
dataIndex: 'owner', dataIndex: 'owner',
}, },
{
header: gettext('Encrypted'),
dataIndex: 'encrypted',
},
{ {
header: gettext("Files"), header: gettext("Files"),
sortable: false, sortable: false,
dataIndex: 'files', dataIndex: 'files',
renderer: function(files) { renderer: function(files) {
return files.map((file) => { return files.map((file) => {
return file.filename; let icon = '';
let size = '';
if (file.encrypted) {
icon = '<i class="fa fa-lock"></i> ';
}
if (file.size) {
size = ` (${Proxmox.Utils.format_size(file.size)})`;
}
return `${icon}${file.filename}${size}`;
}).join(', '); }).join(', ');
}, },
flex: 2 flex: 2