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/3] ui: mark subscription check as active if no remotes are configured
Date: Wed,  3 Dec 2025 10:59:37 +0100	[thread overview]
Message-ID: <20251203095945.1459122-1-d.csapak@proxmox.com> (raw)

by checking the 'total_nodes' value of the subscription for 0

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 ui/src/lib.rs | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/ui/src/lib.rs b/ui/src/lib.rs
index 20dcec8b..76d60a37 100644
--- a/ui/src/lib.rs
+++ b/ui/src/lib.rs
@@ -2,6 +2,7 @@ use js_sys::{Array, JsString, Object};
 use pdm_api_types::remote_updates::RemoteUpdateSummary;
 use pdm_api_types::remotes::RemoteType;
 use pdm_api_types::resource::{PveLxcResource, PveQemuResource};
+use pdm_api_types::subscription::PdmSubscriptionInfo;
 use pdm_client::types::Resource;
 use proxmox_deb_version::Version;
 use serde::{Deserialize, Serialize};
@@ -241,7 +242,15 @@ pub(crate) fn locale_compare(first: String, second: &str, numeric: bool) -> std:
 /// Returns true if the global subscription checks succeeded
 pub async fn check_subscription() -> bool {
     let data: Result<Value, _> = http_get("/nodes/localhost/subscription", None).await;
-    proxmox_yew_comp::subscription_is_active(Some(&data))
+    let mut is_active = proxmox_yew_comp::subscription_is_active(Some(&data));
+    if !is_active {
+        if let Ok(Ok(info)) = data.map(serde_json::from_value::<PdmSubscriptionInfo>) {
+            if info.statistics.total_nodes == 0 {
+                is_active = true;
+            }
+        }
+    }
+    is_active
 }
 
 /// 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  9:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-03  9:59 Dominik Csapak [this message]
2025-12-03  9:59 ` [pdm-devel] [PATCH datacenter-manager 2/3] ui: dashboard/views: add subscription notice in status row Dominik Csapak
2025-12-03  9:59 ` [pdm-devel] [PATCH datacenter-manager 3/3] ui: views: make Subscription panel not required anymore Dominik Csapak
2025-12-03 12:08 ` [pdm-devel] [PATCH datacenter-manager 1/3] ui: mark subscription check as active if no remotes are configured 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=20251203095945.1459122-1-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