public inbox for pdm-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [pdm-devel] [PATCH datacenter-manager 3/5] ui: remote: tasks: add optional remote property to filter
Date: Wed, 10 Sep 2025 13:52:52 +0200	[thread overview]
Message-ID: <20250910115259.3530107-5-d.csapak@proxmox.com> (raw)
In-Reply-To: <20250910115259.3530107-1-d.csapak@proxmox.com>

so that we can show tasks from a single remote

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 ui/src/remotes/tasks.rs | 45 +++++++++++++++++++++++++++--------------
 1 file changed, 30 insertions(+), 15 deletions(-)

diff --git a/ui/src/remotes/tasks.rs b/ui/src/remotes/tasks.rs
index 9099e89..fc7c30a 100644
--- a/ui/src/remotes/tasks.rs
+++ b/ui/src/remotes/tasks.rs
@@ -2,8 +2,9 @@ use std::rc::Rc;
 
 use yew::{
     html,
+    html::IntoPropValue,
     virtual_dom::{VComp, VNode},
-    Component, Properties,
+    AttrValue, Component, Properties,
 };
 
 use pdm_api_types::RemoteUpid;
@@ -20,11 +21,19 @@ use pwt::{
         Column, Fa, Row,
     },
 };
+use pwt_macros::builder;
 
 use crate::{tasks::format_optional_remote_upid, widget::RemoteSelector};
 
 #[derive(PartialEq, Properties)]
-pub struct RemoteTaskList;
+#[builder]
+pub struct RemoteTaskList {
+    /// If given, shows only tasks of this remote
+    #[prop_or_default]
+    #[builder(IntoPropValue, into_prop_value)]
+    remote: Option<AttrValue>,
+}
+
 impl RemoteTaskList {
     pub fn new() -> Self {
         yew::props!(Self {})
@@ -109,6 +118,7 @@ impl Component for PbsRemoteTaskList {
     }
 
     fn view(&self, ctx: &yew::Context<Self>) -> yew::Html {
+        let props = ctx.props();
         let task = self
             .upid
             .as_ref()
@@ -124,21 +134,26 @@ impl Component for PbsRemoteTaskList {
                         move |_| link.send_message(None)
                     })
             });
+
+        let mut task_list = Tasks::new()
+            .base_url("/remote-tasks/list")
+            .on_show_task({
+                let link = ctx.link().clone();
+                move |(upid_str, endtime)| link.send_message(Some((upid_str, endtime)))
+            })
+            .columns(self.columns.clone());
+
+        task_list = match props.remote.clone() {
+            Some(remote) => task_list.fixed_filter(("remote".into(), remote.to_string())),
+            None => task_list.extra_filter(
+                tr!("Remote"),
+                RemoteSelector::new().name("remote").placeholder(tr!("All")),
+            ),
+        };
+
         Column::new()
             .class(FlexFit)
-            .with_child(
-                Tasks::new()
-                    .base_url("/remote-tasks/list")
-                    .on_show_task({
-                        let link = ctx.link().clone();
-                        move |(upid_str, endtime)| link.send_message(Some((upid_str, endtime)))
-                    })
-                    .columns(self.columns.clone())
-                    .extra_filter(
-                        tr!("Remote"),
-                        RemoteSelector::new().name("remote").placeholder(tr!("All")),
-                    ),
-            )
+            .with_child(task_list)
             .with_optional_child(task)
             .into()
     }
-- 
2.47.3



_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel


  parent reply	other threads:[~2025-09-10 11:53 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-10 11:52 [pdm-devel] [PATCH datacenter-manager/yew-comp 0/6] ui: add remote task panel and filtering Dominik Csapak
2025-09-10 11:52 ` [pdm-devel] [PATCH yew-comp 1/1] tasks: add optional fixed filter Dominik Csapak
2025-09-10 12:23   ` [pdm-devel] applied: " Thomas Lamprecht
2025-09-10 11:52 ` [pdm-devel] [PATCH datacenter-manager 1/5] ui: adapt to new node_ref semantic for new pwt Dominik Csapak
2025-09-10 13:50   ` [pdm-devel] applied: " Thomas Lamprecht
2025-09-10 11:52 ` [pdm-devel] [PATCH datacenter-manager 2/5] ui: remote: tasks: add remote filter Dominik Csapak
2025-09-10 13:50   ` [pdm-devel] applied: " Thomas Lamprecht
2025-09-10 11:52 ` Dominik Csapak [this message]
2025-09-10 13:50   ` [pdm-devel] applied: [PATCH datacenter-manager 3/5] ui: remote: tasks: add optional remote property to filter Thomas Lamprecht
2025-09-10 11:52 ` [pdm-devel] [PATCH datacenter-manager 4/5] ui: pve: tree: use correct key for the root node Dominik Csapak
2025-09-10 13:50   ` [pdm-devel] applied: " Thomas Lamprecht
2025-09-10 11:52 ` [pdm-devel] [PATCH datacenter-manager 5/5] ui: pve: tree: add remote tasks panel Dominik Csapak
2025-09-10 13:50   ` [pdm-devel] applied: " Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250910115259.3530107-5-d.csapak@proxmox.com \
    --to=d.csapak@proxmox.com \
    --cc=pdm-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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