public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Thomas Lamprecht <t.lamprecht@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
	Stefan Hanreich <s.hanreich@proxmox.com>
Subject: Re: [pve-devel] [PATCH pve-manager] fix #4228: Display warning when user rollbacks a running container.
Date: Wed, 7 Sep 2022 09:59:03 +0200	[thread overview]
Message-ID: <276f6199-e47a-0a5c-4cfa-76d9f1619585@proxmox.com> (raw)
In-Reply-To: <20220906124304.3049555-1-s.hanreich@proxmox.com>


The respective bug report isn't only talking about adding a warning, so please
either add some rational for why the other idea wasn't indeed not good or note
somewhere that this is indeed a partial fix (which is often totally fine to do).

Am 06/09/2022 um 14:43 schrieb Stefan Hanreich:
> Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
> ---
> I would love to put parentheses around the ternary expression at line
> 265, but eslint complains about unnecessary parentheses. Disabling an
> eslint rule is probably not so exciting for my first contribution, even
> if it would be for only one line.

no need for parenthesis here, but you could just avoid using the ternary if
it irks you and do a normal

let foo = 'default';
if (condition) {
    foo = 'something else';
}

making it less code golfy.

> 
>  www/manager6/tree/SnapshotTree.js | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/www/manager6/tree/SnapshotTree.js b/www/manager6/tree/SnapshotTree.js
> index 97268072..d2fd50d7 100644
> --- a/www/manager6/tree/SnapshotTree.js
> +++ b/www/manager6/tree/SnapshotTree.js
> @@ -259,8 +259,16 @@ Ext.define('PVE.guest.SnapshotTree', {
>  		let view = this.up('treepanel');
>  		let rec = view.getSelection()[0];
>  		let vmid = view.getViewModel().get('vmid');
> -		return Proxmox.Utils.format_task_description('qmrollback', vmid) +
> -		    ` '${rec.data.name}'? ${gettext("Current state will be lost.")}`;
> +
> +		let type = view.getViewModel().get('type');
> +		let isRunning = view.getViewModel().get('running');
> +		let containerWarning = type === 'lxc' && isRunning

would name it extraWarning, also what about VMs, they also loose their current state
on rollback and effectively will be stopped/reset to load the new state (which isn't
much difference in state/availabillity outcome compared to CTs).

Why not differ just between running and not, ignoring the type, e.g. something like

let warning = isRunning
    ? gettext("The guest is currently running and will be stopped!")
    : gettext("Current state will be lost.")

> +		    ? `<br/>${gettext("The container is currently running and will be stopped!")}`
> +		    : ``;
> +
> +		return Proxmox.Utils.format_task_description('qmrollback', vmid)
> +		    + ` '${rec.data.name}'? ${gettext("Current state will be lost.")}`
> +		    + containerWarning
>  	    },
>  	    handler: 'rollback',
>  	},





  reply	other threads:[~2022-09-07  7:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-06 12:43 Stefan Hanreich
2022-09-07  7:59 ` Thomas Lamprecht [this message]
2022-09-07  8:07   ` Thomas Lamprecht

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=276f6199-e47a-0a5c-4cfa-76d9f1619585@proxmox.com \
    --to=t.lamprecht@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    --cc=s.hanreich@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