From: Dominik Csapak <d.csapak@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup] ui: fix crypt mode caluclation
Date: Thu, 9 Jul 2020 16:50:24 +0200 [thread overview]
Message-ID: <20200709145024.8133-1-d.csapak@proxmox.com> (raw)
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
next reply other threads:[~2020-07-09 14:50 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-09 14:50 Dominik Csapak [this message]
2020-07-09 15:10 ` [pbs-devel] applied: " Thomas Lamprecht
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200709145024.8133-1-d.csapak@proxmox.com \
--to=d.csapak@proxmox.com \
--cc=pbs-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox