public inbox for pdm-devel@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

* Re: [PATCH datacenter-manager v2] ui: auto-installer: filter by country name and code
  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
  1 sibling, 0 replies; 4+ messages in thread
From: Shannon Sterz @ 2026-05-26 14:06 UTC (permalink / raw)
  To: Christian Ebner, pdm-devel

On Tue May 26, 2026 at 4:01 PM CEST, Christian Ebner wrote:
> 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),
>          )

Gave this a quick spin, lgtm, so consider this:

Reviewed-by: Shannon Sterz <s.sterz@proxmox.com>
Tested-by: Shannon Sterz <s.sterz@proxmox.com>




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

* Re: [PATCH datacenter-manager v2] ui: auto-installer: filter by country name and code
  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
  1 sibling, 1 reply; 4+ messages in thread
From: Lukas Wagner @ 2026-05-26 14:12 UTC (permalink / raw)
  To: pdm-devel, Christian Ebner


On Tue, 26 May 2026 16:01:13 +0200, Christian Ebner wrote:
> 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.
> 
> [...]

Applied, thanks!

[1/1] ui: auto-installer: filter by country name and code
      commit: 4ea479627811299c6c873633a318c1f52d8b5a64

Best regards,
-- 
Lukas Wagner <l.wagner@proxmox.com>




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

* applied: [PATCH datacenter-manager v2] ui: auto-installer: filter by country name and code
  2026-05-26 14:12 ` Lukas Wagner
@ 2026-05-26 14:14   ` Lukas Wagner
  0 siblings, 0 replies; 4+ messages in thread
From: Lukas Wagner @ 2026-05-26 14:14 UTC (permalink / raw)
  To: Lukas Wagner, pdm-devel, Christian Ebner

On Tue May 26, 2026 at 4:12 PM CEST, Lukas Wagner wrote:
>
> On Tue, 26 May 2026 16:01:13 +0200, Christian Ebner wrote:
>> 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.
>> 
>> [...]
>
> Applied, thanks!
>
> [1/1] ui: auto-installer: filter by country name and code
>       commit: 4ea479627811299c6c873633a318c1f52d8b5a64
>
> Best regards,





^ permalink raw reply	[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 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