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 1/1] ui: pdm update panel: show correct subscription notice message
Date: Wed,  3 Dec 2025 13:18:19 +0100	[thread overview]
Message-ID: <20251203121848.2600456-2-d.csapak@proxmox.com> (raw)
In-Reply-To: <20251203121848.2600456-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>
---
 ui/src/administration/mod.rs |  5 ++++-
 ui/src/lib.rs                | 17 ++++++++++++-----
 2 files changed, 16 insertions(+), 6 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 b7f1c1e3..0ad0e7a6 100644
--- a/ui/src/lib.rs
+++ b/ui/src/lib.rs
@@ -260,17 +260,24 @@ pub async fn check_subscription() -> bool {
 
 /// Returns a an [`AlertDialog`] for the 'no valid subscription' popup.
 pub fn subscription_alert(on_close: impl IntoEventCallback<()>) -> AlertDialog {
-    let dest = "<a target=\"_blank\" href=\"https://pdm.proxmox.com/docs/faq.html\">pdm.proxmox.com</a>"
-        .to_string();
+    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();
 
     let msg = tr!(
         "Too many remote nodes without active basic or higher subscription. Please visit {0} for more details.",
         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:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-03 12:18 [pdm-devel] [PATCH yew-comp 1/1] apt package manager: add property for custom subscription alert message Dominik Csapak
2025-12-03 12:18 ` Dominik Csapak [this message]
2025-12-03 12:51 ` [pdm-devel] superseded: " Dominik Csapak
2025-12-03 12:51 ` [pdm-devel] " 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=20251203121848.2600456-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