all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [PATCH datacenter-manager] ui: auto-installer: filter by country name and code
@ 2026-05-26 13:06 Christian Ebner
  2026-05-26 13:09 ` Shannon Sterz
  0 siblings, 1 reply; 6+ messages in thread
From: Christian Ebner @ 2026-05-26 13:06 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>
---
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





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

* Re: [PATCH datacenter-manager] ui: auto-installer: filter by country name and code
  2026-05-26 13:06 [PATCH datacenter-manager] ui: auto-installer: filter by country name and code Christian Ebner
@ 2026-05-26 13:09 ` Shannon Sterz
  2026-05-26 13:17   ` Christian Ebner
  0 siblings, 1 reply; 6+ messages in thread
From: Shannon Sterz @ 2026-05-26 13:09 UTC (permalink / raw)
  To: Christian Ebner, pdm-devel

On Tue May 26, 2026 at 3:06 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>
> ---
> 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);
> +                    }

Maybe `contains` would be more appropriate here? Since these are mostly
one word names, it's natural to start with the beginning, but we do
usually use `contains` when it comes to searching & filtering.

> +
> +                    false
> +                })
>                  .autoselect_filter(true)
>                  .required(true),
>          )





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

* Re: [PATCH datacenter-manager] ui: auto-installer: filter by country name and code
  2026-05-26 13:09 ` Shannon Sterz
@ 2026-05-26 13:17   ` Christian Ebner
  2026-05-26 13:26     ` Shannon Sterz
  2026-05-26 14:02     ` superseded: " Christian Ebner
  0 siblings, 2 replies; 6+ messages in thread
From: Christian Ebner @ 2026-05-26 13:17 UTC (permalink / raw)
  To: Shannon Sterz, pdm-devel

On 5/26/26 3:09 PM, Shannon Sterz wrote:
> On Tue May 26, 2026 at 3:06 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>
>> ---
>> 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);
>> +                    }
> 
> Maybe `contains` would be more appropriate here? Since these are mostly
> one word names, it's natural to start with the beginning, but we do
> usually use `contains` when it comes to searching & filtering.

That could however lead to seemingly unrelated matches, as this filters 
by country name and country code? Not sure if that would improve UX in 
this particular case.




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

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

On Tue May 26, 2026 at 3:17 PM CEST, Christian Ebner wrote:
> On 5/26/26 3:09 PM, Shannon Sterz wrote:
>> On Tue May 26, 2026 at 3:06 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>
>>> ---
>>> 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);
>>> +                    }
>>
>> Maybe `contains` would be more appropriate here? Since these are mostly
>> one word names, it's natural to start with the beginning, but we do
>> usually use `contains` when it comes to searching & filtering.
>
> That could however lead to seemingly unrelated matches, as this filters
> by country name and country code? Not sure if that would improve UX in
> this particular case.

This will highly depend on the context. If I look for "Arab" with
`start_with` the "United Arab Emirates" won't match. IMO it's probably
better not to break with how filtering/searching usually works in the
UI. Also it's not like there are typically so many matches that
returning a bigger set is really detrimental to UX here.





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

* Re: [PATCH datacenter-manager] ui: auto-installer: filter by country name and code
  2026-05-26 13:26     ` Shannon Sterz
@ 2026-05-26 13:33       ` Christian Ebner
  0 siblings, 0 replies; 6+ messages in thread
From: Christian Ebner @ 2026-05-26 13:33 UTC (permalink / raw)
  To: Shannon Sterz, pdm-devel

On 5/26/26 3:26 PM, Shannon Sterz wrote:
> On Tue May 26, 2026 at 3:17 PM CEST, Christian Ebner wrote:
>> On 5/26/26 3:09 PM, Shannon Sterz wrote:
>>> On Tue May 26, 2026 at 3:06 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>
>>>> ---
>>>> 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);
>>>> +                    }
>>>
>>> Maybe `contains` would be more appropriate here? Since these are mostly
>>> one word names, it's natural to start with the beginning, but we do
>>> usually use `contains` when it comes to searching & filtering.
>>
>> That could however lead to seemingly unrelated matches, as this filters
>> by country name and country code? Not sure if that would improve UX in
>> this particular case.
> 
> This will highly depend on the context. If I look for "Arab" with
> `start_with` the "United Arab Emirates" won't match. IMO it's probably
> better not to break with how filtering/searching usually works in the
> UI. Also it's not like there are typically so many matches that
> returning a bigger set is really detrimental to UX here.

Okay, for this particular example I see your point. I'll resend with 
contains() for the name filtering, leaving starts_with() when matching 
the country code. Thanks!




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

* superseded: [PATCH datacenter-manager] ui: auto-installer: filter by country name and code
  2026-05-26 13:17   ` Christian Ebner
  2026-05-26 13:26     ` Shannon Sterz
@ 2026-05-26 14:02     ` Christian Ebner
  1 sibling, 0 replies; 6+ messages in thread
From: Christian Ebner @ 2026-05-26 14:02 UTC (permalink / raw)
  To: Shannon Sterz, pdm-devel

superseded-by version 2:
https://lore.proxmox.com/pdm-devel/20260526140113.581117-1-c.ebner@proxmox.com/T/




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

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

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-26 13:06 [PATCH datacenter-manager] ui: auto-installer: filter by country name and code Christian Ebner
2026-05-26 13:09 ` 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

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