[pdm-devel] [PATCH datacenter-manager v4 03/10] server: api: resources: add more complex filter syntax
Shannon Sterz
s.sterz at proxmox.com
Thu Aug 28 15:53:22 CEST 2025
> +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.
[1]: https://lore.proxmox.com/pdm-devel/f992b565-f7e3-4339-80ce-aabd49cef773@proxmox.com/T/#m74b8924dda5ddb32aeee34a6685fa4a769380ef9
-->8 snip 8<--
More information about the pdm-devel
mailing list