From: Lukas Wagner <l.wagner@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [pdm-devel] [PATCH proxmox-yew-comp 1/1] task list: add support for starting refresh tasks
Date: Tue, 16 Dec 2025 14:15:13 +0100 [thread overview]
Message-ID: <20251216131518.241022-2-l.wagner@proxmox.com> (raw)
In-Reply-To: <20251216131518.241022-1-l.wagner@proxmox.com>
PDM has an API endpoint to trigger remote task fetching. By adding
the 'refresh_task_url' property to the task list implementation in
`Tasks`, we now allow starting this refresh task manually when pressing
the 'Refresh' button.
Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
---
src/tasks.rs | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/src/tasks.rs b/src/tasks.rs
index ece8f2e..f4c5026 100644
--- a/src/tasks.rs
+++ b/src/tasks.rs
@@ -62,6 +62,13 @@ pub struct Tasks {
#[builder(IntoPropValue, into_prop_value)]
pub base_url: Option<AttrValue>,
+ /// If set, clicking the 'refresh' button will POST the provided URL to start
+ /// a task which refreshes the underlying task storage. Once the task finishes,
+ /// the view automatically refreshes and shows the latest tasks.
+ #[prop_or_default]
+ #[builder(IntoPropValue, into_prop_value)]
+ pub refresh_task_url: Option<AttrValue>,
+
#[builder_cb(IntoEventCallback, into_event_callback, (String, Option<i64>))]
#[prop_or_default]
/// Called when the task is opened
@@ -103,6 +110,7 @@ pub enum ViewDialog {
pub enum Msg {
ToggleFilter,
LoadBatch(bool), // fresh load
+ RefreshClicked,
LoadFinished,
UpdateFilter,
ShowTask,
@@ -337,6 +345,16 @@ impl LoadableComponent for ProxmoxTasks {
self.fresh_load = false;
false
}
+ Msg::RefreshClicked => {
+ let link = ctx.link().clone();
+ if let Some(url) = &ctx.props().refresh_task_url {
+ link.start_task(url.to_string(), None, true);
+ } else {
+ link.send_message(Msg::LoadBatch(true));
+ }
+
+ false
+ }
Msg::ShowTask => {
if let Some(on_show_task) = &ctx.props().on_show_task {
let selected_item = self
@@ -394,7 +412,7 @@ impl LoadableComponent for ProxmoxTasks {
.with_child({
let loading = self.loading();
let link = ctx.link().clone();
- Button::refresh(loading).onclick(move |_| link.send_message(Msg::LoadBatch(true)))
+ Button::refresh(loading).onclick(move |_| link.send_message(Msg::RefreshClicked))
});
let filter_classes = classes!(
--
2.47.3
_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel
next prev parent reply other threads:[~2025-12-16 13:15 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-16 13:15 [pdm-devel] [PATCH-SERIES 0/6] manual refresh button for remote task cache Lukas Wagner
2025-12-16 13:15 ` Lukas Wagner [this message]
2025-12-16 13:15 ` [pdm-devel] [PATCH datacenter-manager 1/5] remote tasks: move implementation to server crate Lukas Wagner
2025-12-16 13:15 ` [pdm-devel] [PATCH datacenter-manager 2/5] remote tasks: implement `refresh_task_cache` for manual task fetching Lukas Wagner
2025-12-16 13:15 ` [pdm-devel] [PATCH datacenter-manager 3/5] api: add /remotes/tasks/refresh Lukas Wagner
2025-12-16 13:15 ` [pdm-devel] [PATCH datacenter-manager 4/5] ui: remote task view: set refresh_task_url property for task viewer Lukas Wagner
2025-12-16 13:15 ` [pdm-devel] [PATCH datacenter-manager 5/5] ui: register task descriptions for some native PDM tasks Lukas Wagner
2025-12-17 14:37 ` [pdm-devel] [PATCH-SERIES 0/6] manual refresh button for remote task cache Lukas Wagner
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=20251216131518.241022-2-l.wagner@proxmox.com \
--to=l.wagner@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