From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 8C4F81FF2A1 for ; Tue, 16 Jul 2024 11:33:11 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id B528BFF82; Tue, 16 Jul 2024 11:33:36 +0200 (CEST) From: Christoph Heiss To: pve-devel@lists.proxmox.com Date: Tue, 16 Jul 2024 11:31:57 +0200 Message-ID: <20240716093250.576370-1-c.heiss@proxmox.com> X-Mailer: git-send-email 2.45.1 MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.017 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [PATCH manager] www: utils: fix inconsistency in host cpu usage display in search view X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" Between the number of CPUs and the actual label, a space was missing - resulting in an inconsistency vs. the "CPU usage" column. Also, fix a rather nonsensical check for `maxcpu` above - noticed that while comparing the implementation to that of Proxmox.Utils.render_cpu(). Signed-off-by: Christoph Heiss --- www/manager6/Utils.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js index f5608944d..6a0ecc98f 100644 --- a/www/manager6/Utils.js +++ b/www/manager6/Utils.js @@ -1073,13 +1073,14 @@ Ext.define('PVE.Utils', { } var maxcpu = node.data.maxcpu || 1; - if (!Ext.isNumeric(maxcpu) && (maxcpu >= 1)) { + if (!Ext.isNumeric(maxcpu) || maxcpu < 1) { return ''; } var per = (record.data.cpu/maxcpu) * record.data.maxcpu * 100; + const cpu_label = maxcpu > 1 ? 'CPUs' : 'CPU'; - return per.toFixed(1) + '% of ' + maxcpu.toString() + (maxcpu > 1 ? 'CPUs' : 'CPU'); + return `${per.toFixed(1)}% of ${maxcpu} ${cpu_label}`; }, render_bandwidth: function(value) { -- 2.45.1 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel