From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 80B099108C for ; Wed, 7 Sep 2022 09:59:12 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 76A8C2F0C2 for ; Wed, 7 Sep 2022 09:59:12 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Wed, 7 Sep 2022 09:59:11 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id E1459435FD for ; Wed, 7 Sep 2022 09:59:04 +0200 (CEST) Message-ID: <276f6199-e47a-0a5c-4cfa-76d9f1619585@proxmox.com> Date: Wed, 7 Sep 2022 09:59:03 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:105.0) Gecko/20100101 Thunderbird/105.0 Content-Language: en-GB To: Proxmox VE development discussion , Stefan Hanreich References: <20220906124304.3049555-1-s.hanreich@proxmox.com> From: Thomas Lamprecht In-Reply-To: <20220906124304.3049555-1-s.hanreich@proxmox.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.880 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment NICE_REPLY_A -1.752 Looks like a legit reply (A) SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record T_SCC_BODY_TEXT_LINE -0.01 - Subject: Re: [pve-devel] [PATCH pve-manager] fix #4228: Display warning when user rollbacks a running container. 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: , X-List-Received-Date: Wed, 07 Sep 2022 07:59:12 -0000 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 > --- > 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.") > + ? `
${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', > },