public inbox for pdm-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Shannon Sterz <s.sterz@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [PATCH datacenter-manager] ui: auto-installer: filter keyboard layouts based on code and human name
Date: Tue, 26 May 2026 16:20:43 +0200	[thread overview]
Message-ID: <20260526142043.458849-1-s.sterz@proxmox.com> (raw)

should improve usability of this filter field by also allowing to
search for the values that are actually rendered.

Signed-off-by: Shannon Sterz <s.sterz@proxmox.com>
---
 .../auto_installer/prepared_answer_form.rs     | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/ui/src/remotes/auto_installer/prepared_answer_form.rs b/ui/src/remotes/auto_installer/prepared_answer_form.rs
index 67b78fe..100b802 100644
--- a/ui/src/remotes/auto_installer/prepared_answer_form.rs
+++ b/ui/src/remotes/auto_installer/prepared_answer_form.rs
@@ -224,6 +224,24 @@ pub fn render_global_options_form(
                         .into()
                 })
                 .value(serde_variant_name(config.keyboard))
+                .filter(|item: &AttrValue, query: &str| {
+                    let query = query.to_string().to_lowercase();
+                    let item = item.to_string();
+
+                    // match by keyboard layout code
+                    if item.starts_with(&query) {
+                        return true;
+                    }
+
+                    // match by keyboard layout human name
+                    if let Ok(human_name) = item.parse::<KeyboardLayout>()
+                        .map(|v| v.human_name().to_owned()) {
+                        log::info!("{:?}", human_name);
+                        return human_name.to_lowercase().contains(&query);
+                    }
+
+                    false
+                })
                 .autoselect_filter(true)
                 .required(true),
         )
-- 
2.47.3





             reply	other threads:[~2026-05-26 14:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-26 14:20 Shannon Sterz [this message]
2026-05-26 14:28 ` applied: [PATCH datacenter-manager] ui: auto-installer: filter keyboard layouts based on code and human name Lukas Wagner
2026-05-26 14:30   ` Shannon Sterz

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=20260526142043.458849-1-s.sterz@proxmox.com \
    --to=s.sterz@proxmox.com \
    --cc=pdm-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