From: Dominik Csapak <d.csapak@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [pdm-devel] [PATCH yew-comp 1/2] subscription check: use more useful function signature
Date: Tue, 2 Dec 2025 15:31:02 +0100 [thread overview]
Message-ID: <20251202143226.3681712-2-d.csapak@proxmox.com> (raw)
In-Reply-To: <20251202143226.3681712-1-d.csapak@proxmox.com>
having a reference of an option is very unweildly at times, e.g. when
having the inner type, it's necessary to move it into an option, even if
`subscription_is_active` does not need to own the data.
using an option of a reference makes usage much more ergonomic at times.
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
NOTE: this breaks current pdm, as it changes a public function
signature. Fix for pdm is the first datacenter manger patch.
src/apt_package_manager.rs | 2 +-
src/apt_repositories.rs | 2 +-
src/subscription_alert.rs | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/apt_package_manager.rs b/src/apt_package_manager.rs
index 0b4ae2e..b419957 100644
--- a/src/apt_package_manager.rs
+++ b/src/apt_package_manager.rs
@@ -198,7 +198,7 @@ impl LoadableComponent for ProxmoxAptPackageManager {
let command = format!("{}/update", props.base_url);
self.async_pool.spawn(async move {
let data = crate::http_get::<Value>(url.as_str(), None).await;
- let is_active = subscription_is_active(&Some(data));
+ let is_active = subscription_is_active(Some(&data));
if is_active {
link.task_base_url(task_base_url);
diff --git a/src/apt_repositories.rs b/src/apt_repositories.rs
index 9ab8258..7157c0c 100644
--- a/src/apt_repositories.rs
+++ b/src/apt_repositories.rs
@@ -705,7 +705,7 @@ fn standard_repo_info(
impl ProxmoxAptRepositories {
fn active_subscription(&self) -> bool {
- subscription_is_active(&self.subscription_status)
+ subscription_is_active(self.subscription_status.as_ref())
}
fn create_show_subscription_dialog(
diff --git a/src/subscription_alert.rs b/src/subscription_alert.rs
index 7734123..496d258 100644
--- a/src/subscription_alert.rs
+++ b/src/subscription_alert.rs
@@ -68,7 +68,7 @@ impl From<SubscriptionAlert> for VNode {
}
/// Check if the result of the subscription check returned an active subscription
-pub fn subscription_is_active(result: &Option<Result<Value, Error>>) -> bool {
+pub fn subscription_is_active(result: Option<&Result<Value, Error>>) -> bool {
match result {
Some(Ok(data)) => {
data["status"].as_str().map(|s| s.to_lowercase()).as_deref() == Some("active")
--
2.47.3
_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel
next prev parent reply other threads:[~2025-12-02 14:32 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-02 14:31 [pdm-devel] [PATCH datacenter-manager/yew-comp 0/7] add top bar subscription state and dedicated panel Dominik Csapak
2025-12-02 14:31 ` Dominik Csapak [this message]
2025-12-02 15:23 ` [pdm-devel] applied: [PATCH yew-comp 1/2] subscription check: use more useful function signature Thomas Lamprecht
2025-12-02 14:31 ` [pdm-devel] [PATCH yew-comp 2/2] subscriptions: expose subscription_icon Dominik Csapak
2025-12-02 15:23 ` [pdm-devel] applied: " Thomas Lamprecht
2025-12-02 14:31 ` [pdm-devel] [PATCH datacenter-manager 1/5] ui: adapt to signature change of subscription_is_active Dominik Csapak
2025-12-02 16:13 ` [pdm-devel] applied: " Thomas Lamprecht
2025-12-02 14:31 ` [pdm-devel] [PATCH datacenter-manager 2/5] lib/server: include subscription statistics in subscription information Dominik Csapak
2025-12-02 16:13 ` [pdm-devel] applied: " Thomas Lamprecht
2025-12-02 14:31 ` [pdm-devel] [PATCH datacenter-manager 3/5] ui: configuration: add subscription panel Dominik Csapak
2025-12-02 16:13 ` [pdm-devel] applied: " Thomas Lamprecht
2025-12-02 14:31 ` [pdm-devel] [PATCH datacenter-manager 4/5] ui: show pdm subscription state in top nav bar Dominik Csapak
2025-12-02 14:31 ` [pdm-devel] [PATCH datacenter-manager 5/5] ui: views: make Subscription panel not required anymore Dominik Csapak
2025-12-03 12:08 ` Thomas Lamprecht
2025-12-02 15:27 ` [pdm-devel] [PATCH datacenter-manager/yew-comp 0/7] add top bar subscription state and dedicated panel 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=20251202143226.3681712-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 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.