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 <c.he...@proxmox.com>
---
 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

Reply via email to