[pve-devel] [PATCH v2 12/12] ui: qemu: hardware: add eject button for cdroms

Friedrich Weber f.weber at proxmox.com
Thu Jan 23 17:39:18 CET 2025


Hi, I have two small things that I noticed skimming the series (inline).

On 13/01/2025 09:56, Daniel Herzig wrote:
> Eject by setting file to none.
> 
> Signed-off-by: Daniel Herzig <d.herzig at proxmox.com>
> ---
>  www/manager6/qemu/HardwareView.js | 43 +++++++++++++++++++++++++++++++
>  1 file changed, 43 insertions(+)
> 
> diff --git a/www/manager6/qemu/HardwareView.js b/www/manager6/qemu/HardwareView.js
> index 59e670db..5d1c18a5 100644
> --- a/www/manager6/qemu/HardwareView.js
> +++ b/www/manager6/qemu/HardwareView.js
> @@ -538,6 +538,45 @@ Ext.define('PVE.qemu.HardwareView', {
>  	    apiurl: '/api2/extjs/' + baseurl,
>  	});
>  
> +	let eject_btn = new Proxmox.button.Button({
> +	    text: gettext('Eject'),
> +	    disabled: true,
> +	    selModel: sm,
> +	    RESTMethod: 'POST',
> +	    confirmMsg: function(rec) {
> +		let warn = gettext("Are you sure you want to eject '{0}' ?");
> +		let isofile = rec.data.value.split(",")[0];

Not a frontend expert, but it might be nicer to use something like
PVE.Parser.parsePropertyString to retrieve the ISO name here, instead of
manually splitting the string.

> +		let msg = Ext.String.format(warn, isofile);
> +		return msg;

This should be html-encoded before displaying, e.g. using Ext.htmlEncode.




More information about the pve-devel mailing list