public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: "Max Carrara" <m.carrara@proxmox.com>
To: "Lukas Wagner" <l.wagner@proxmox.com>,
	"Proxmox VE development discussion" <pve-devel@lists.proxmox.com>
Subject: Re: [pve-devel] [PATCH v1 pve-manager 8/8] ui: ceph: osd: rework rendering of version field & show build commit
Date: Thu, 06 Jun 2024 10:04:43 +0200	[thread overview]
Message-ID: <D1SS1CI1A12N.1K02E59KJ99U9@proxmox.com> (raw)
In-Reply-To: <3a3d3958-221e-433a-a53f-297f31a5f0f3@proxmox.com>

On Wed Jun 5, 2024 at 4:48 PM CEST, Lukas Wagner wrote:
>
>
> On  2024-04-30 17:28, Max Carrara wrote:
> > The logic of the `render_version` function is split up in order to
> > handle how the version is displayed depending on the type of the row.
> > 
> > If the parsed version is `undefined` or the row marks the beginning of
> > the tree, an empty string is now returned. This behaviour is
> > equivalent to before, it just makes the overall logic easier.
> > 
> > If the row belongs to a node, the build commit is now additionally
> > displayed in parentheses next to the installed Ceph version:
> > 
> >   18.2.2 (abcd1234)
> > 
> > If the row belongs to an osd, the build commit is also additionally
> > displayed in parentheses next to the installed Ceph version.
> > Furthermore, should the build commit of the running osd differ from
> > the one that's installed on the host, the new hash will also be shown
> > in parentheses:
> > 
> >   18.2.2 (abcd1234 -> 5678fedc)
> > 
> > The icon displayed for running an osd with an outdated build is the
> > same as for running an outdated version. The conditional display of
> > cluster health-related icons remains the same otherwise.
> > 
> > Signed-off-by: Max Carrara <m.carrara@proxmox.com>
> > ---
> >  www/manager6/ceph/OSD.js | 55 ++++++++++++++++++++++++++++++++--------
> >  1 file changed, 45 insertions(+), 10 deletions(-)
> > 
> > diff --git a/www/manager6/ceph/OSD.js b/www/manager6/ceph/OSD.js
> > index d2caafa4..988962b1 100644
> > --- a/www/manager6/ceph/OSD.js
> > +++ b/www/manager6/ceph/OSD.js
> > @@ -642,23 +642,58 @@ Ext.define('PVE.node.CephOsdTree', {
> >  	},
> >  
> >  	render_version: function(value, metadata, rec) {
> > +	    if (value === undefined || rec.data.type === 'root') {
> > +		return '';
> > +	    }
> > +
> >  	    let vm = this.getViewModel();
> > -	    let versions = vm.get('versions');
> >  	    let icon = "";
> > -	    let version = value || "";
> > -	    let maxversion = vm.get('maxversion');
> > -	    if (value && PVE.Utils.compare_ceph_versions(value, maxversion) !== 0) {
> > -		let host_version = rec.parentNode?.data?.version || versions[rec.data.host] || "";
> > -		if (rec.data.type === 'host' || PVE.Utils.compare_ceph_versions(host_version, maxversion) !== 0) {
> > +	    const maxversion = vm.get('maxversion');
> > +	    const mixedversions = vm.get('mixedversions');
> > +
> > +	    if (rec.data.type === 'host') {
> > +		const bc = rec.data.buildcommit ?? '';
> > +
> > +		if (PVE.Utils.compare_ceph_versions(maxversion, value) > 0) {
> >  		    icon = PVE.Utils.get_ceph_icon_html('HEALTH_UPGRADE');
> > -		} else {
> > -		    icon = PVE.Utils.get_ceph_icon_html('HEALTH_OLD');
> > +		} else if (mixedversions) {
> > +		    icon = PVE.Utils.get_ceph_icon_html('HEALTH_OK');
> >  		}
> > -	    } else if (value && vm.get('mixedversions')) {
> > +
> > +		if (bc === '') {
> > +		    return `${icon}${value}`;
> > +		}
> > +
> > +		return `${icon}${value} (${bc.substring(0, 9)})`;
> > +	    }
> > +
> > +	    const versionNode = rec.parentNode?.data?.version ?? '';
> > +
> > +	    const bc = PVE.Utils.parse_ceph_buildcommit(rec.data) ?? '';
> > +	    const bcNode = rec.parentNode?.data?.buildcommit ?? '';
>
> same as before, rather use `let` than `const` and maybe use a longer, more
> clear name.

ACK - thanks!

>
> > +
> > +	    let bcChanged = bc !== '' && bcNode !== '' && bc !== bcNode;
> > +
> > +	    if (PVE.Utils.compare_ceph_versions(maxversion, value) > 0) {
> > +		icon = PVE.Utils.get_ceph_icon_html('HEALTH_UPGRADE');
> > +	    } else if (versionNode && PVE.Utils.compare_ceph_versions(versionNode, value) > 0) {
> > +		icon = PVE.Utils.get_ceph_icon_html('HEALTH_OLD');
> > +	    } else if (mixedversions && !bcChanged) {
> >  		icon = PVE.Utils.get_ceph_icon_html('HEALTH_OK');
> >  	    }
> >  
> > -	    return icon + version;
> > +	    let bcPart = bc.substring(0, 9);
> > +	    if (bcChanged) {
> > +		const arrow = '<i class="fa fa-fw fa-long-arrow-right"></i>';
> > +		icon ||= PVE.Utils.get_ceph_icon_html('HEALTH_OLD');
> > +		bcPart = `${bc.substring(0, 9)}${arrow}${bcNode.substring(0, 9)}`;
> > +	    }
> > +
> > +	    if (bcPart === '') {
> > +		return `${icon}${value}`;
> > +	    }
> > +
> > +	    return `${icon}${value} (${bcPart})`;
> >  	},
> >  
> >  	render_osd_val: function(value, metaData, rec) {



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


  reply	other threads:[~2024-06-06  8:04 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-30 15:28 [pve-devel] [PATCH v1 pve-manager 0/8] Ceph Build Commit in UI Max Carrara
2024-04-30 15:28 ` [pve-devel] [PATCH v1 pve-manager 1/8] ceph: tools: refactor installation check as guard clause Max Carrara
2024-04-30 15:28 ` [pve-devel] [PATCH v1 pve-manager 2/8] ceph: tools: update Ceph version regex Max Carrara
2024-06-05 14:48   ` Lukas Wagner
2024-04-30 15:28 ` [pve-devel] [PATCH v1 pve-manager 3/8] ceph: services: remove old cluster broadcast Max Carrara
2024-04-30 15:28 ` [pve-devel] [PATCH v1 pve-manager 4/8] ceph: services: refactor version existence check as guard clause Max Carrara
2024-04-30 15:28 ` [pve-devel] [PATCH v1 pve-manager 5/8] utils: align regex of parse_ceph_version with Perl equivalent Max Carrara
2024-04-30 15:28 ` [pve-devel] [PATCH v1 pve-manager 6/8] ui: ceph: services: parse and display build commit Max Carrara
2024-06-05 14:48   ` Lukas Wagner
2024-06-06  8:04     ` Max Carrara
2024-04-30 15:28 ` [pve-devel] [PATCH v1 pve-manager 7/8] api: ceph: add build commit of host to Ceph osd index endpoint data Max Carrara
2024-04-30 15:28 ` [pve-devel] [PATCH v1 pve-manager 8/8] ui: ceph: osd: rework rendering of version field & show build commit Max Carrara
2024-06-05 14:48   ` Lukas Wagner
2024-06-06  8:04     ` Max Carrara [this message]
2024-06-05  9:16 ` [pve-devel] [PATCH v1 pve-manager 0/8] Ceph Build Commit in UI Max Carrara
2024-06-05 14:48 ` Lukas Wagner
2024-06-06  8:06   ` Max Carrara

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=D1SS1CI1A12N.1K02E59KJ99U9@proxmox.com \
    --to=m.carrara@proxmox.com \
    --cc=l.wagner@proxmox.com \
    --cc=pve-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
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal