public inbox for pve-devel@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] [RFC PATCH manager 1/1] close #6306: ui: display vmname in addition to vmid in task list
Date: Mon,  5 May 2025 17:29:54 +0200	[thread overview]
Message-ID: <20250505152954.951176-1-m.koeppl@proxmox.com> (raw)

The information displayed in the task list is based on the content of
/var/log/pve/tasks/index, which does not contain the VM/CT name.
The vmname is, however, available through the PVEResources store. The
render function is therefore adapted to find the name matching the vmid
and uses existing functions for rendering the information correctly. The
order of vmid and vmname is dependent on the sort key chosen in the tree
settings (either sorted by VMID or Name).

Signed-off-by: Michael Köppl <m.koeppl@proxmox.com>
---
This patch only partially closes #6306 [0]. I've invested some time 
looking into adding vmname to logging messages such as 'Starting Backup
of VM 100' as well. Generally, there are many cases where we display a
VMID in relation to a task, thus using /var/log/pve/tasks/index as the
source for the VMID and other information, such as the task type. The
logging in the task viewer is one of those cases. It seems to me that
the cleanest solution would be to add the vmname when we encode content
for this file and consider it when decoding. There are upid_encode and
upid_decode functions in pve-common for this. A quick grep suggests that
we always use these functions when accessing this file. Still, I do not
feel comfortable making this change without properly understanding the
implications of it. Perhaps someone more knowledgeable in this regard 
could chime in, I'd love some input on whether this approach makes sense
or if it's even worth the effort, considering we're talking about a
purely visual motivation (displaying the vmname) for this change. Or
maybe I'm just not seeing a more obvious solution.

If a change to the upid_encode and upid_decode functions should be the
preferred solution, this patch probably is not a good solution anymore,
as the vmname would then also be available in record.data.

[0] https://bugzilla.proxmox.com/show_bug.cgi?id=6306

 www/manager6/dc/Tasks.js | 27 ++++++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/www/manager6/dc/Tasks.js b/www/manager6/dc/Tasks.js
index f68bd5e9..579955fc 100644
--- a/www/manager6/dc/Tasks.js
+++ b/www/manager6/dc/Tasks.js
@@ -34,6 +34,16 @@ Ext.define('PVE.dc.Tasks', {
 	    ],
 
 	});
+	let resourcesStore = Ext.create('Ext.data.Store', {
+	    model: 'PVEResources',
+	    autoLoad: true,
+	    filters: [
+		{
+		    property: 'type',
+		    value: /lxc|qemu/,
+		},
+	    ],
+	});
 
 	let run_task_viewer = function() {
 	    var sm = me.getSelectionModel();
@@ -51,6 +61,7 @@ Ext.define('PVE.dc.Tasks', {
 
 	Ext.apply(me, {
 	    store: store,
+	    resourcesStore: resourcesStore,
 	    stateful: false,
 	    viewConfig: {
 		trackOver: false,
@@ -111,7 +122,21 @@ Ext.define('PVE.dc.Tasks', {
 		    header: gettext("Description"),
 		    dataIndex: 'upid',
 		    flex: 1,
-		    renderer: Proxmox.Utils.render_upid,
+		    renderer: function(value, metaData, record) {
+			let vmid = record.data.id;
+			if (vmid) {
+			    let resourceRecord = me.resourcesStore.findRecord('vmid', vmid);
+			    if (resourceRecord) {
+				let vmname = resourceRecord.get('name');
+				record.data.id = PVE.Utils.getFormattedGuestIdentifier(vmid, vmname);
+			    }
+			}
+			return Proxmox.Utils.render_upid(
+			    value,
+			    metaData,
+			    record,
+			);
+		    },
 		},
 		{
 		    header: gettext("Status"),
-- 
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-05-05 15:29 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20250505152954.951176-1-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 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