all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [PATCH datacenter-manager v2] ui: auto-installer: filter by country name and code
@ 2026-05-26 14:01 Christian Ebner
  2026-05-26 14:06 ` Shannon Sterz
  2026-05-26 14:12 ` Lukas Wagner
  0 siblings, 2 replies; 4+ messages in thread
From: Christian Ebner @ 2026-05-26 14:01 UTC (permalink / raw)
  To: pdm-devel

The country filed for answer files expects a 2 character country
code as input, while showing the full country name for items. The
filter therefore currently applies to country codes only, not
matching on country (common) names.

Filter based on both, matching name or country code instead.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
---
Changes since version 1 (thanks @Shannon):
- match country name by containing string instead of starting with
  query string.

 .../auto_installer/prepared_answer_form.rs       | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/ui/src/remotes/auto_installer/prepared_answer_form.rs b/ui/src/remotes/auto_installer/prepared_answer_form.rs
index c1d2bab..a68c5cd 100644
--- a/ui/src/remotes/auto_installer/prepared_answer_form.rs
+++ b/ui/src/remotes/auto_installer/prepared_answer_form.rs
@@ -171,6 +171,22 @@ pub fn render_global_options_form(
                     }
                 })
                 .value(config.country.clone())
+                .filter(|item: &AttrValue, query: &str| {
+                    let query = query.to_string().to_lowercase();
+                    let item = item.to_string();
+
+                    // match by country code
+                    if item.starts_with(&query) {
+                        return true;
+                    }
+
+                    // match by country (common) name
+                    if let Some(name) = COUNTRY_INFO.deref().get(&item) {
+                        return name.to_lowercase().contains(&query);
+                    }
+
+                    false
+                })
                 .autoselect_filter(true)
                 .required(true),
         )
-- 
2.47.3





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

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

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-26 14:01 [PATCH datacenter-manager v2] ui: auto-installer: filter by country name and code Christian Ebner
2026-05-26 14:06 ` Shannon Sterz
2026-05-26 14:12 ` Lukas Wagner
2026-05-26 14:14   ` applied: " Lukas Wagner

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal