all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Christian Ebner <c.ebner@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [PATCH datacenter-manager] ui: auto-installer: filter by country name and code
Date: Tue, 26 May 2026 15:06:18 +0200	[thread overview]
Message-ID: <20260526130618.516360-1-c.ebner@proxmox.com> (raw)

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>
---
Note:
Developt on top of [0] to reduce conflicts when applying.

[0] https://lore.proxmox.com/pdm-devel/20260526113310.289789-1-s.sterz@proxmox.com/T/

 .../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..793f41c 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().starts_with(&query);
+                    }
+
+                    false
+                })
                 .autoselect_filter(true)
                 .required(true),
         )
-- 
2.47.3





             reply	other threads:[~2026-05-26 13:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-26 13:06 Christian Ebner [this message]
2026-05-26 13:09 ` [PATCH datacenter-manager] ui: auto-installer: filter by country name and code Shannon Sterz
2026-05-26 13:17   ` Christian Ebner
2026-05-26 13:26     ` Shannon Sterz
2026-05-26 13:33       ` Christian Ebner
2026-05-26 14:02     ` superseded: " Christian Ebner

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=20260526130618.516360-1-c.ebner@proxmox.com \
    --to=c.ebner@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 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