* [pbs-devel] [PATCH proxmox-backup] ui: fix crypt mode caluclation
@ 2020-07-09 14:50 Dominik Csapak
2020-07-09 15:10 ` [pbs-devel] applied: " Thomas Lamprecht
0 siblings, 1 reply; 2+ messages in thread
From: Dominik Csapak @ 2020-07-09 14:50 UTC (permalink / raw)
To: pbs-devel
also include 'mixed' in the calculation of the overall mode of a
snapshot and group
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
www/DataStoreContent.js | 11 ++++++-----
www/Utils.js | 10 ++++++++--
2 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/www/DataStoreContent.js b/www/DataStoreContent.js
index cc4d955..a29436f 100644
--- a/www/DataStoreContent.js
+++ b/www/DataStoreContent.js
@@ -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);
}
diff --git a/www/Utils.js b/www/Utils.js
index db7dbf8..c75a779 100644
--- a/www/Utils.js
+++ b/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');
--
2.20.1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-07-09 15:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-09 14:50 [pbs-devel] [PATCH proxmox-backup] ui: fix crypt mode caluclation Dominik Csapak
2020-07-09 15:10 ` [pbs-devel] applied: " Thomas Lamprecht
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox