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 v2 1/1] ui: pdm update panel: show correct subscription notice message
Date: Wed,  3 Dec 2025 13:50:45 +0100	[thread overview]
Message-ID: <20251203125056.2821841-2-d.csapak@proxmox.com> (raw)
In-Reply-To: <20251203125056.2821841-1-d.csapak@proxmox.com>

instead of the default one that does not fit for pdm hosts.

For that, refactor the message + title generation into its own function,
so we can reuse it for the generic alert dialog as well.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
change from v1:
* rebase on master
 ui/src/administration/mod.rs |  5 ++++-
 ui/src/lib.rs                | 12 +++++++++---
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/ui/src/administration/mod.rs b/ui/src/administration/mod.rs
index 9e45a425..760cc90b 100644
--- a/ui/src/administration/mod.rs
+++ b/ui/src/administration/mod.rs
@@ -20,6 +20,8 @@ mod node_status;
 
 use proxmox_yew_comp::{AptPackageManager, AptRepositories, ExistingProduct, Syslog, Tasks};
 
+use crate::pdm_subscription_title_and_message;
+
 #[derive(Clone, PartialEq, Properties)]
 #[builder]
 pub struct ServerAdministration {
@@ -88,7 +90,8 @@ impl Component for PdmServerAdministration {
                         .with_child(
                             AptPackageManager::new()
                                 .enable_upgrade(enable_upgrade)
-                                .subscription_url("/nodes/localhost/subscription"),
+                                .subscription_url("/nodes/localhost/subscription")
+                                .subscription_message(pdm_subscription_title_and_message()),
                         )
                         .into()
                 },
diff --git a/ui/src/lib.rs b/ui/src/lib.rs
index 5ca0461c..1aac7571 100644
--- a/ui/src/lib.rs
+++ b/ui/src/lib.rs
@@ -269,6 +269,14 @@ pub async fn check_pdm_subscription() -> bool {
 /// i.e., one that's not just relayed 1:1 to a specific remote node, as for that one should use the
 /// remote-specific alert.
 pub fn pdm_subscription_alert(on_close: impl IntoEventCallback<()>) -> AlertDialog {
+    let (title, msg) = pdm_subscription_title_and_message();
+    AlertDialog::new(Container::from_tag("p").with_child(msg))
+        .title(title)
+        .on_close(on_close)
+}
+
+/// returns the PDM specific title and message for the subscription alert
+pub fn pdm_subscription_title_and_message() -> (String, Html) {
     let dest =
         "<a target=\"_blank\" href=\"https://pdm.proxmox.com/docs/faq.html\">pdm.proxmox.com</a>"
             .to_string();
@@ -278,9 +286,7 @@ pub fn pdm_subscription_alert(on_close: impl IntoEventCallback<()>) -> AlertDial
         dest
     );
     let msg = Html::from_html_unchecked(msg.into());
-    AlertDialog::new(Container::from_tag("p").with_child(msg))
-        .title(tr!("No valid subscriptions"))
-        .on_close(on_close)
+    (tr!("No valid subscriptions"), msg)
 }
 
 /// Extract the version of a specific package from `RemoteUpdateSummary` for a specific node
-- 
2.47.3



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


  reply	other threads:[~2025-12-03 12:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-03 12:50 [pdm-devel] [PATCH yew-comp v2 1/1] apt package manager: add property for custom subscription alert message Dominik Csapak
2025-12-03 12:50 ` Dominik Csapak [this message]
2025-12-03 14:04   ` [pdm-devel] [PATCH datacenter-manager v2 1/1] ui: pdm update panel: show correct subscription notice message 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=20251203125056.2821841-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