From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [pdm-devel] [PATCH datacenter-manager] subscription: handle no remotes being configured yet
Date: Wed, 3 Dec 2025 10:00:15 +0100 [thread overview]
Message-ID: <20251203090038.2806380-1-f.gruenbichler@proxmox.com> (raw)
if there are no remotes configured yet, do not display a confusing error
messages, instead wait for some remotes to be set up.
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---
server/src/api/nodes/subscription.rs | 13 +++++++++++++
ui/src/configuration/subscription_panel.rs | 3 +++
2 files changed, 16 insertions(+)
diff --git a/server/src/api/nodes/subscription.rs b/server/src/api/nodes/subscription.rs
index c84487f..4e6c0f0 100644
--- a/server/src/api/nodes/subscription.rs
+++ b/server/src/api/nodes/subscription.rs
@@ -77,6 +77,10 @@ fn count_subscriptions(
}
fn check_counts(stats: &SubscriptionStatistics) -> Result<(), Error> {
+ if stats.total_nodes == 0 {
+ return Ok(());
+ }
+
let basic_or_higher_ratio =
(stats.active_subscriptions - stats.community) as f64 / stats.total_nodes as f64;
@@ -112,6 +116,15 @@ pub async fn get_subscription() -> Result<PdmSubscriptionInfo, Error> {
message: Some(format!("{err}")),
serverid: None,
url: Some(PRODUCT_URL.into()),
+ ..Default::default()
+ }
+ } else if statistics.total_nodes == 0 {
+ SubscriptionInfo {
+ status: SubscriptionStatus::NotFound,
+ message: Some(format!("No remotes configured yet.")),
+ serverid: None,
+ url: Some(PRODUCT_URL.into()),
+
..Default::default()
}
} else {
diff --git a/ui/src/configuration/subscription_panel.rs b/ui/src/configuration/subscription_panel.rs
index 1011132..c08fb73 100644
--- a/ui/src/configuration/subscription_panel.rs
+++ b/ui/src/configuration/subscription_panel.rs
@@ -145,6 +145,9 @@ fn rows() -> Vec<KVGridRow> {
KVGridRow::new("statistics", tr!("Statistics")).renderer(move |_name, value, _record| {
let statistics = serde_json::from_value::<SubscriptionStatistics>(value.clone());
match statistics {
+ Ok(stats) if stats.total_nodes == 0 => {
+ Column::new().with_child(Row::new().with_child("-")).into()
+ }
Ok(stats) => {
let basic_or_higher = stats.active_subscriptions - stats.community;
let basic_or_higher_ratio = basic_or_higher as f64 / stats.total_nodes as f64;
--
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 9:00 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20251203090038.2806380-1-f.gruenbichler@proxmox.com \
--to=f.gruenbichler@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.