public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Stefan Hanreich <s.hanreich@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH pve-manager] fix #4228: Display warning when user rollbacks a running container.
Date: Tue,  6 Sep 2022 14:43:04 +0200	[thread overview]
Message-ID: <20220906124304.3049555-1-s.hanreich@proxmox.com> (raw)

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.

 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
+		    ? `<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',
 	},
-- 
2.30.2




             reply	other threads:[~2022-09-06 12:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-06 12:43 Stefan Hanreich [this message]
2022-09-07  7:59 ` Thomas Lamprecht
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=20220906124304.3049555-1-s.hanreich@proxmox.com \
    --to=s.hanreich@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