[pdm-devel] [PATCH yew-comp 1/1] tasks: add optional fixed filter

Dominik Csapak d.csapak at proxmox.com
Wed Sep 10 13:52:49 CEST 2025


sometimes it's useful to have a simple fixed filter defined, e.g.
when we want to filter for a specific remote.

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 src/tasks.rs | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/tasks.rs b/src/tasks.rs
index b614dce..6f2a0a0 100644
--- a/src/tasks.rs
+++ b/src/tasks.rs
@@ -47,6 +47,13 @@ pub struct Tasks {
     #[prop_or_default]
     pub extra_filter: Option<(AttrValue, Html)>,
 
+    /// Additional fixed filter that cannot be changed or cleared
+    ///
+    /// this can be useful when filtering for e.g. node/remote/etc.
+    #[prop_or_default]
+    #[builder(IntoPropValue, into_prop_value)]
+    pub fixed_filter: Option<(String, String)>,
+
     /// The base url, default is `/nodes/<nodename>/tasks`.
     #[prop_or_default]
     #[builder(IntoPropValue, into_prop_value)]
@@ -247,6 +254,11 @@ impl LoadableComponent for ProxmoxTasks {
 
         filter["limit"] = BATCH_LIMIT.into();
 
+        // add fixed filter
+        if let Some((key, value)) = props.fixed_filter.clone() {
+            filter[key] = value.into();
+        }
+
         let link = ctx.link().clone();
         Box::pin(async move {
             let mut data: Vec<_> = crate::http_get(&path, Some(filter)).await?;
-- 
2.47.3





More information about the pdm-devel mailing list