From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 525791FF183 for ; Wed, 10 Sep 2025 13:53:05 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id CF5E51F9E1; Wed, 10 Sep 2025 13:53:07 +0200 (CEST) From: Dominik Csapak To: pdm-devel@lists.proxmox.com Date: Wed, 10 Sep 2025 13:52:52 +0200 Message-ID: <20250910115259.3530107-5-d.csapak@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20250910115259.3530107-1-d.csapak@proxmox.com> References: <20250910115259.3530107-1-d.csapak@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL -2.475 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_DBL_SPAM 5 Contains a spam URL listed in the Spamhaus DBL blocklist [tasks.rs] Subject: [pdm-devel] [PATCH datacenter-manager 3/5] ui: remote: tasks: add optional remote property to filter X-BeenThere: pdm-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Datacenter Manager development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox Datacenter Manager development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pdm-devel-bounces@lists.proxmox.com Sender: "pdm-devel" so that we can show tasks from a single remote Signed-off-by: Dominik Csapak --- 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, +} + impl RemoteTaskList { pub fn new() -> Self { yew::props!(Self {}) @@ -109,6 +118,7 @@ impl Component for PbsRemoteTaskList { } fn view(&self, ctx: &yew::Context) -> 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