From: Christoph Heiss <c.heiss@proxmox.com>
To: Thomas Lamprecht <t.lamprecht@proxmox.com>
Cc: Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Subject: Re: [pve-devel] [PATCH manager] www: utils: fix inconsistency in host cpu usage display in search view
Date: Wed, 17 Jul 2024 14:27:51 +0200 [thread overview]
Message-ID: <6jymfxzmamjacos23knb24loac557rnbvkwk5k4iokde6gwuih@xh6y7wx76ror> (raw)
In-Reply-To: <d8573a48-e45c-46d3-a313-1697f819d4d5@proxmox.com>
On Tue, Jul 16, 2024 at 06:07:10PM GMT, Thomas Lamprecht wrote:
> Am 16/07/2024 um 11:31 schrieb Christoph Heiss:
> > 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().
>
> can we split this in a different patch? it's rather unrelated.
Sure, I'll re-send them as separate patches.
>
> Also I think the error here was the lacking parenthesis, i.e., the
> following minimal change would make the check also correct
>
> if (!(Ext.isNumeric(maxcpu) && maxcpu >= 1)) {
>
> But I still like yours more,
I've just looked at how Proxmox.Utils.render_cpu does it and took that
check verbatim from there.
> just wanted to point out that this was
> probably a simple typo or incompletely moving from one variant to
> the other, not straight out bogus in intend.
Of course, that was my thinking too - that is was just a honest typo.
Should probably have formulated that a bit different.
>
> >
> > Signed-off-by: Christoph Heiss <c.heiss@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) {
>
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
prev parent reply other threads:[~2024-07-17 12:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-16 9:31 Christoph Heiss
2024-07-16 16:07 ` Thomas Lamprecht
2024-07-17 12:27 ` Christoph Heiss [this message]
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=6jymfxzmamjacos23knb24loac557rnbvkwk5k4iokde6gwuih@xh6y7wx76ror \
--to=c.heiss@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
--cc=t.lamprecht@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.