public inbox for pdm-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [PATCH datacenter-manager] ui: auto-installer: filter keyboard layouts based on code and human name
@ 2026-05-26 14:20 Shannon Sterz
  2026-05-26 14:28 ` applied: " Lukas Wagner
  0 siblings, 1 reply; 3+ messages in thread
From: Shannon Sterz @ 2026-05-26 14:20 UTC (permalink / raw)
  To: pdm-devel

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





^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-05-26 14:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-26 14:20 [PATCH datacenter-manager] ui: auto-installer: filter keyboard layouts based on code and human name Shannon Sterz
2026-05-26 14:28 ` applied: " Lukas Wagner
2026-05-26 14:30   ` Shannon Sterz

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