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: [PATCH proxmox-yew-comp 1/2] apt package manager/repositories: add 'reload_generation' property
Date: Mon, 30 Nov 2026 10:44:54 +0100	[thread overview]
Message-ID: <20261130094500.972447-2-d.csapak@proxmox.com> (raw)
In-Reply-To: <20261130094500.972447-1-d.csapak@proxmox.com>

so that users of these components can let them load their data again,
e.g. when they know that it changed, without having to recreate them.

Recreating shows an empty component until the data is loaded, while a
reload keeps the old content until then, like the reload button of the
package manager does.

A change is ignored while a load is still ongoing, so that the loads
don't pile up when the value changes faster than the data can be
loaded.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 src/apt_package_manager.rs | 11 ++++++++++-
 src/apt_repositories.rs    |  7 +++++++
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/src/apt_package_manager.rs b/src/apt_package_manager.rs
index 07454cc..f86ceb1 100644
--- a/src/apt_package_manager.rs
+++ b/src/apt_package_manager.rs
@@ -79,6 +79,12 @@ pub struct AptPackageManager {
     #[builder(IntoPropValue, into_prop_value)]
     /// Custom subscription dialog title and message
     pub subscription_message: Option<(String, Html)>,
+
+    /// Changing this value loads the updates again (if not already running), like the reload
+    /// button of the list does.
+    #[prop_or_default]
+    #[builder]
+    pub reload_generation: u64,
 }
 
 impl Default for AptPackageManager {
@@ -408,7 +414,10 @@ impl LoadableComponent for ProxmoxAptPackageManager {
 
         self.set_task_base_url(props.task_base_url.clone());
 
-        if props.base_url != old_props.base_url || props.task_base_url != old_props.task_base_url {
+        if props.base_url != old_props.base_url
+            || props.task_base_url != old_props.task_base_url
+            || (props.reload_generation != old_props.reload_generation && !self.loading())
+        {
             ctx.link().send_reload();
             true
         } else {
diff --git a/src/apt_repositories.rs b/src/apt_repositories.rs
index 9fd6671..155116e 100644
--- a/src/apt_repositories.rs
+++ b/src/apt_repositories.rs
@@ -61,6 +61,12 @@ pub struct AptRepositories {
     #[builder(IntoPropValue, into_prop_value)]
     #[prop_or_default]
     pub status_only: bool,
+
+    /// Changing this value loads the repositories and the subscription status again (if not
+    /// already running).
+    #[prop_or_default]
+    #[builder]
+    pub reload_generation: u64,
 }
 
 impl Default for AptRepositories {
@@ -552,6 +558,7 @@ impl LoadableComponent for ProxmoxAptRepositories {
         if props.base_url != old_props.base_url
             || props.subscription_url != old_props.subscription_url
             || props.product != old_props.product
+            || (props.reload_generation != old_props.reload_generation && !self.loading())
         {
             ctx.link().send_reload();
             true
-- 
2.47.3





  reply	other threads:[~2026-11-30  9:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-30  9:44 [PATCH datacenter-manager/proxmox-yew-comp 0/2] ui: remote updates: reload the details of a node in place Dominik Csapak
2026-11-30  9:44 ` Dominik Csapak [this message]
2026-11-30  9:44 ` [PATCH datacenter-manager 2/2] " Dominik Csapak

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=20261130094500.972447-2-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