all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: "Michael Köppl" <m.koeppl@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH widget-toolkit 1/1] close #3181: ui: add guest name to safe destroy dialog window
Date: Tue, 25 Mar 2025 16:01:45 +0100	[thread overview]
Message-ID: <20250325150146.213066-2-m.koeppl@proxmox.com> (raw)
In-Reply-To: <20250325150146.213066-1-m.koeppl@proxmox.com>

While the format_task_description function is used in other parts of the
UI, this still leaves these use cases intact. The guest name is an
optional addition in parantheses.

Signed-off-by: Michael Köppl <m.koeppl@proxmox.com>
---
 src/Utils.js              | 8 ++++++--
 src/window/SafeDestroy.js | 3 ++-
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/Utils.js b/src/Utils.js
index c873c85..a64d07f 100644
--- a/src/Utils.js
+++ b/src/Utils.js
@@ -716,7 +716,7 @@ utilities: {
 	}
     },
 
-    format_task_description: function(type, id) {
+    format_task_description: function(type, id, name) {
 	let farray = Proxmox.Utils.task_desc_table[type];
 	let text;
 	if (!farray) {
@@ -731,7 +731,11 @@ utilities: {
 	let prefix = farray[0];
 	text = farray[1];
 	if (prefix && id !== undefined) {
-	    return prefix + ' ' + id + ' - ' + text;
+	    let fullText = prefix + ' ' + id;
+	    if (name) {
+		fullText += " (" + name + ")";
+	    }
+	    return fullText + " - " + text;
 	}
 	return text;
     },
diff --git a/src/window/SafeDestroy.js b/src/window/SafeDestroy.js
index c058465..d980a52 100644
--- a/src/window/SafeDestroy.js
+++ b/src/window/SafeDestroy.js
@@ -187,9 +187,10 @@ Ext.define('Proxmox.window.SafeDestroy', {
 	}
 
 	let taskName = me.getTaskName();
+	const itemName = me.getItem().name;
 	if (Ext.isDefined(taskName)) {
 	    me.lookupReference('messageCmp').setHtml(
-		Proxmox.Utils.format_task_description(taskName, itemId),
+		Proxmox.Utils.format_task_description(taskName, itemId, itemName),
 	    );
 	} else {
 	    throw "no task name specified";
-- 
2.39.5



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

  reply	other threads:[~2025-03-25 15:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-25 15:01 [pve-devel] [PATCH manager/widget-toolkit 0/2] close #3181: ui: display guest name in confirm dialogs Michael Köppl
2025-03-25 15:01 ` Michael Köppl [this message]
2025-03-25 18:27   ` [pve-devel] [PATCH widget-toolkit 1/1] close #3181: ui: add guest name to safe destroy dialog window Thomas Lamprecht
2025-03-28 12:03     ` Michael Köppl
2025-03-31 13:37       ` Michael Köppl
2025-03-25 15:01 ` [pve-devel] [PATCH manager 1/1] close #3181: ui: display guest name in confirm dialogs Michael Köppl

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=20250325150146.213066-2-m.koeppl@proxmox.com \
    --to=m.koeppl@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 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.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal