[pve-devel] [PATCH manager] fix #5787: ui: display vm description in confirm dialogs

Thomas Lamprecht t.lamprecht at proxmox.com
Tue Oct 22 08:58:56 CEST 2024


The subject made me think you added the VM description property, i.e. the
comment a user can set for VMs in the note field, to the confirmation.
But it's for all guests, i.e., bot VMs and CTs, and it's the guest name, so
I'd go for something like:

fix #5787: ui: display guest name in confirm dialogs

Am 21/10/2024 um 14:17 schrieb Timothy Nicholson:
> Signed-off-by: Timothy Nicholson <t.nicholson at proxmox.com>
> ---
> 
> This patch adds a new function to the PVE Utils that formats a task confirmation message to display in confirm dialogs, for example when shutting down a VM. As requested by the Bugzilla entry #5787, the message now includes the VM name in addition to the VM ID.

why isn't above stated in the commit message but only as patch note?

> 
>  www/manager6/Utils.js            |  4 ++++
>  www/manager6/lxc/CmdMenu.js      |  4 ++--
>  www/manager6/lxc/Config.js       |  8 +++++---
>  www/manager6/qemu/CmdMenu.js     |  4 ++--
>  www/manager6/qemu/Config.js      | 14 ++++++++------
>  www/manager6/window/GuestStop.js |  2 +-
>  6 files changed, 22 insertions(+), 14 deletions(-)
> 
> diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js
> index db86fa9a..462eb148 100644
> --- a/www/manager6/Utils.js
> +++ b/www/manager6/Utils.js
> @@ -1960,6 +1960,10 @@ Ext.define('PVE.Utils', {
>  	}
>  	return languageCookie || Proxmox.defaultLang || 'en';
>      },
> +
> +    format_task_confirmation_message: function(type, vmid, vmname) {

As this is not for arbitrary tasks but for guests I'd change the signature
of this function to:

format_guest_confirmation: function(taskType, vmid, guestName) {

vmid could also become guestId, but vmid is so widely used in various code
bases that it is often easier to ignore that it implies VMs only, as "vmid"
seldom does that.

And yes, we have some wrong terminology in LXC code, like the "vm" variable
below, but for new functions I'd still like to use the generic terms if the
function is applicable for both, CTs and VMs.

> +	return `${Proxmox.Utils.format_task_description(type, `${vmid} (${vmname})`)}?`;

This also adds a "?" at the end, is that all right? The nested template string
isn't making things easier to read IMO, and if the "?" is indeed superfluous then
a simple

return Proxmox.Utils.format_task_description(taskType, `${vmid} (${guestName})`);




More information about the pve-devel mailing list