From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 2F542618B6 for ; Thu, 9 Jul 2020 16:50:56 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 19E4B139BF for ; Thu, 9 Jul 2020 16:50:26 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [212.186.127.180]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id E5CDB139B5 for ; Thu, 9 Jul 2020 16:50:24 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id A894040B4E for ; Thu, 9 Jul 2020 16:50:24 +0200 (CEST) From: Dominik Csapak To: pbs-devel@lists.proxmox.com Date: Thu, 9 Jul 2020 16:50:24 +0200 Message-Id: <20200709145024.8133-1-d.csapak@proxmox.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment KAM_LAZY_DOMAIN_SECURITY 1 Sending domain does not have any anti-forgery methods NO_DNS_FOR_FROM 0.379 Envelope sender has no MX or A DNS records RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_NONE 0.001 SPF: sender does not publish an SPF Record Subject: [pbs-devel] [PATCH proxmox-backup] ui: fix crypt mode caluclation X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Jul 2020 14:50:56 -0000 also include 'mixed' in the calculation of the overall mode of a snapshot and group Signed-off-by: Dominik Csapak --- 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