ui: fix crypt mode caluclation
also include 'mixed' in the calculation of the overall mode of a snapshot and group Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
parent
7ba2c1c386
commit
106603c58f
|
@ -21,19 +21,19 @@ Ext.define('pbs-data-store-snapshots', {
|
|||
mixed: 0,
|
||||
'sign-only': 0,
|
||||
encrypt: 0,
|
||||
count: 0,
|
||||
};
|
||||
let signed = 0;
|
||||
let files = 0;
|
||||
data.files.forEach(file => {
|
||||
if (file.filename === 'index.json.blob') return; // is never encrypted
|
||||
let mode = PBS.Utils.cryptmap.indexOf(file['crypt-mode']);
|
||||
if (mode !== -1) {
|
||||
crypt[file['crypt-mode']]++;
|
||||
}
|
||||
files++;
|
||||
crypt.count++;
|
||||
});
|
||||
|
||||
return PBS.Utils.calculateCryptMode(crypt['sign-only'], crypt.encrypt, files);
|
||||
return PBS.Utils.calculateCryptMode(crypt);
|
||||
}
|
||||
}
|
||||
]
|
||||
|
@ -155,7 +155,7 @@ Ext.define('PBS.DataStoreContent', {
|
|||
none: 0,
|
||||
mixed: 0,
|
||||
'sign-only': 0,
|
||||
encrypt: 0
|
||||
encrypt: 0,
|
||||
};
|
||||
for (const item of group.children) {
|
||||
crypt[PBS.Utils.cryptmap[item['crypt-mode']]]++;
|
||||
|
@ -169,7 +169,8 @@ Ext.define('PBS.DataStoreContent', {
|
|||
|
||||
}
|
||||
group.count = group.children.length;
|
||||
group['crypt-mode'] = PBS.Utils.calculateCryptMode(crypt['sign-only'], crypt.encrypt, group.count);
|
||||
crypt.count = group.count;
|
||||
group['crypt-mode'] = PBS.Utils.calculateCryptMode(crypt);
|
||||
children.push(group);
|
||||
}
|
||||
|
||||
|
|
10
www/Utils.js
10
www/Utils.js
|
@ -34,8 +34,14 @@ Ext.define('PBS.Utils', {
|
|||
'lock',
|
||||
],
|
||||
|
||||
calculateCryptMode: function(signed, encrypted, files) {
|
||||
if (files === encrypted) {
|
||||
calculateCryptMode: function(data) {
|
||||
let mixed = data.mixed;
|
||||
let encrypted = data.encrypt;
|
||||
let signed = data['sign-only'];
|
||||
let files = data.count;
|
||||
if (mixed > 0) {
|
||||
return PBS.Utils.cryptmap.indexOf('mixed');
|
||||
} else if (files === encrypted) {
|
||||
return PBS.Utils.cryptmap.indexOf('encrypt');
|
||||
} else if (files === signed) {
|
||||
return PBS.Utils.cryptmap.indexOf('sign-only');
|
||||
|
|
Loading…
Reference in New Issue