public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Aaron Lauterer <a.lauterer@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH manager 1/2] fix #6304 ui: qemu: fix validator in DisplayEdit to match serial displays
Date: Tue, 15 Apr 2025 17:30:11 +0200	[thread overview]
Message-ID: <20250415153012.1256195-1-a.lauterer@proxmox.com> (raw)

because the value we get is not the config key, but the displayed text.
Therefore we fetch the config key from the PVE.Utils.kvm_vga_drivers object.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
---
We have some options here, we could also match and extract the serial ID
from the displayed text, but that will fail once we change the displayed
text in the kvm_vga_drivers.

This is also the quickest way regarding #6304 as it will just get the
old validator working again.
Adding a hint or making it possible to add the matching serial port
device (semi) automatically will most likely be a bigger change.

 www/manager6/qemu/DisplayEdit.js | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/www/manager6/qemu/DisplayEdit.js b/www/manager6/qemu/DisplayEdit.js
index c8a67017..7a9a5160 100644
--- a/www/manager6/qemu/DisplayEdit.js
+++ b/www/manager6/qemu/DisplayEdit.js
@@ -51,7 +51,10 @@ Ext.define('PVE.qemu.DisplayInputPanel', {
 	validator: function(v) {
 	    let cfg = this.up('proxmoxWindowEdit').vmconfig || {};
 
-	    if (v.match(/^serial\d+$/) && (!cfg[v] || cfg[v] !== 'socket')) {
+	    let vgaKey = Object.keys(PVE.Utils.kvm_vga_drivers).find(
+		(key) => PVE.Utils.kvm_vga_drivers[key] === v
+	    );
+	    if (vgaKey.match(/^serial\d+$/) && (!cfg[vgaKey] || cfg[vgaKey] !== 'socket')) {
 		let fmt = gettext("Serial interface '{0}' is not correctly configured.");
 		return Ext.String.format(fmt, v);
 	    }
-- 
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-04-15 15:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-15 15:30 Aaron Lauterer [this message]
2025-04-15 15:30 ` [pve-devel] [PATCH manager 2/2] ui: qemu: make validator warning for serial displays more concrete Aaron Lauterer

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=20250415153012.1256195-1-a.lauterer@proxmox.com \
    --to=a.lauterer@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