[pdm-devel] [PATCH datacenter-manager v4 03/10] server: api: resources: add more complex filter syntax

Dominik Csapak d.csapak at proxmox.com
Thu Aug 28 16:18:53 CEST 2025



On 8/28/25 3:53 PM, Shannon Sterz wrote:
>> +fn remote_matches_search_term(remote_name: &str, online: Option<bool>, term: &SearchTerm) -> bool {
>> +    match term.category.as_deref() {
>> +        Some("remote" | "name" | "id") => remote_name.contains(&term.value),
>> +        Some("type") => "remote".starts_with(&term.value),
>> +        Some("status") => match online {
>> +            None => true,
>> +            Some(true) => "online".starts_with(&term.value),
>> +            Some(false) => "offline".starts_with(&term.value),
>> +        },
>> +        None => remote_name.contains(&term.value) || "remote".contains(&term.value),
> 
> correct me if im wrong, but wouldn't this mean that any search without a
> category would return all remotes given that the term's value is a
> substring of "remote"? so if i type "e" i'd get all remotes?
> 
> since this has already been a concern for searches with a `type`
> category [1] in v3, maybe this here should also be a `starts_with`
> match? seems more consistent to me anyway.

ah yes, i overlooked that check

imho it should be

None => remote_name.contains(&term.value) || 
"remote".starts_with(&term_value),

Can send as a follow up or if something else comes i'll include that in a v5

> 
> [1]: https://lore.proxmox.com/pdm-devel/f992b565-f7e3-4339-80ce-aabd49cef773@proxmox.com/T/#m74b8924dda5ddb32aeee34a6685fa4a769380ef9
> 
> -->8 snip 8<--
> 
> 
> _______________________________________________
> pdm-devel mailing list
> pdm-devel at lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel
> 
> 





More information about the pdm-devel mailing list