From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id E45361FF14F for ; Fri, 08 May 2026 17:22:47 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 9BA081CF00; Fri, 8 May 2026 17:22:47 +0200 (CEST) Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Fri, 08 May 2026 17:22:40 +0200 Message-Id: Subject: Re: [PATCH yew-mobile-gui 20/20] resources page: map subscription level analogous to dashboard From: "Shan Shaji" To: "Shannon Sterz" , X-Mailer: aerc 0.20.0 References: <20260508150535.420205-1-s.sterz@proxmox.com> <20260508150535.420205-21-s.sterz@proxmox.com> In-Reply-To: <20260508150535.420205-21-s.sterz@proxmox.com> X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1778253651758 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.150 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [proxmox.com,mod.rs] Message-ID-Hash: OJWRVCPGJMCGUIAGHQWK5W5OBKICI3FV X-Message-ID-Hash: OJWRVCPGJMCGUIAGHQWK5W5OBKICI3FV X-MailFrom: s.shaji@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Yew framework devel list at Proxmox List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Hi, I have tested this patch with my community subscription. Now the status is correctly shown on both dashboard and resources pages. Tested-by: Shan Shaji On Fri May 8, 2026 at 5:05 PM CEST, Shannon Sterz wrote: > and unify the mapping logic. > > Signed-off-by: Shannon Sterz > --- > > Notes: > i couldn't find a similar helper anyway in yew-comp yet, so i added > this here for now. Thomas' recent series [1] added something like > that, but that would only be available for pdm. maybe we should have > something like this in yew-comp? > =20 > [1]: https://lore.proxmox.com/pdm-devel/20260507082943.2749725-3-t.la= mprecht@proxmox.com/ > > src/pages/mod.rs | 13 +++++++++++++ > src/pages/page_dashboard.rs | 13 ++----------- > src/pages/page_resources.rs | 8 +++----- > 3 files changed, 18 insertions(+), 16 deletions(-) > > diff --git a/src/pages/mod.rs b/src/pages/mod.rs > index bc5ff97..3d945a0 100644 > --- a/src/pages/mod.rs > +++ b/src/pages/mod.rs > @@ -45,3 +45,16 @@ pub use page_cluster_firewall::PageClusterFirewall; > =20 > mod page_not_found; > pub use page_not_found::PageNotFound; > + > +fn map_subscription(level: &Option) -> &str { > + match level.as_deref() { > + Some("") | None =3D> "no subscription", > + Some(level) =3D> match level { > + "c" =3D> "Community", > + "b" =3D> "Basic", > + "s" =3D> "Standard", > + "p" =3D> "Premium", > + _ =3D> "-", > + }, > + } > +} > diff --git a/src/pages/page_dashboard.rs b/src/pages/page_dashboard.rs > index 1e0243f..fe2f5b4 100644 > --- a/src/pages/page_dashboard.rs > +++ b/src/pages/page_dashboard.rs > @@ -20,7 +20,7 @@ use proxmox_yew_comp::layout::list_tile::{icon_list_til= e, list_tile_usage}; > use proxmox_yew_comp::layout::render_loaded_data; > use proxmox_yew_comp::{SubscriptionAlert, http_get}; > =20 > -use crate::pages::ResourceFilter; > +use crate::pages::{ResourceFilter, map_subscription}; > use crate::widgets::TopNavBar; > =20 > #[derive(Clone, PartialEq, Properties)] > @@ -202,16 +202,7 @@ impl PvePageDashboard { > let navigator =3D navigator.clone(); > let item =3D &nodes[pos as usize]; > let nodename =3D item.node.clone(); > - let subtitle =3D match item.level.as_deref() { > - Some("") | None =3D> "no subscription", > - Some(level) =3D> match level { > - "c" =3D> "Community", > - "b" =3D> "Basic", > - "s" =3D> "Standard", > - "p" =3D> "Premium", > - _ =3D> "-", > - }, > - }; > + let subtitle =3D map_subscription(&item.level); > =20 > icon_list_tile( > Fa::new("server").class( > diff --git a/src/pages/page_resources.rs b/src/pages/page_resources.rs > index 469bbf3..470a054 100644 > --- a/src/pages/page_resources.rs > +++ b/src/pages/page_resources.rs > @@ -23,6 +23,8 @@ use proxmox_yew_comp::layout::render_loaded_data; > =20 > use pve_api_types::{ClusterResource, ClusterResourceType}; > =20 > +use crate::pages::map_subscription; > + > #[derive(Clone, PartialEq, Properties)] > pub struct PageResources {} > =20 > @@ -119,11 +121,7 @@ impl PvePageResources { > Fa::new("server") > .class((item.status.as_deref() =3D=3D Some("online")).th= en_some("pwt-color-primary")), > nodename.clone(), > - match item.level.as_deref() { > - Some("") | None =3D> "no subscription", > - Some(level) =3D> level, > - } > - .to_string(), > + map_subscription(&item.level), > item.status.clone(), > ) > .interactive(true)