public inbox for yew-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: "Shan Shaji" <s.shaji@proxmox.com>
To: "Shannon Sterz" <s.sterz@proxmox.com>, <yew-devel@lists.proxmox.com>
Subject: Re: [PATCH yew-mobile-gui 20/20] resources page: map subscription level analogous to dashboard
Date: Fri, 08 May 2026 17:22:40 +0200	[thread overview]
Message-ID: <DIDECJVZ3ON2.1ZEIGBOM1SMC7@proxmox.com> (raw)
In-Reply-To: <20260508150535.420205-21-s.sterz@proxmox.com>

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 <s.shaji@proxmox.com>

On Fri May 8, 2026 at 5:05 PM CEST, Shannon Sterz wrote:
> and unify the mapping logic.
>
> Signed-off-by: Shannon Sterz <s.sterz@proxmox.com>
> ---
>
> 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?
>     
>     [1]: https://lore.proxmox.com/pdm-devel/20260507082943.2749725-3-t.lamprecht@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;
>  
>  mod page_not_found;
>  pub use page_not_found::PageNotFound;
> +
> +fn map_subscription(level: &Option<String>) -> &str {
> +    match level.as_deref() {
> +        Some("") | None => "no subscription",
> +        Some(level) => match level {
> +            "c" => "Community",
> +            "b" => "Basic",
> +            "s" => "Standard",
> +            "p" => "Premium",
> +            _ => "-",
> +        },
> +    }
> +}
> 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_tile, list_tile_usage};
>  use proxmox_yew_comp::layout::render_loaded_data;
>  use proxmox_yew_comp::{SubscriptionAlert, http_get};
>  
> -use crate::pages::ResourceFilter;
> +use crate::pages::{ResourceFilter, map_subscription};
>  use crate::widgets::TopNavBar;
>  
>  #[derive(Clone, PartialEq, Properties)]
> @@ -202,16 +202,7 @@ impl PvePageDashboard {
>                      let navigator = navigator.clone();
>                      let item = &nodes[pos as usize];
>                      let nodename = item.node.clone();
> -                    let subtitle = match item.level.as_deref() {
> -                        Some("") | None => "no subscription",
> -                        Some(level) => match level {
> -                            "c" => "Community",
> -                            "b" => "Basic",
> -                            "s" => "Standard",
> -                            "p" => "Premium",
> -                            _ => "-",
> -                        },
> -                    };
> +                    let subtitle = map_subscription(&item.level);
>  
>                      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;
>  
>  use pve_api_types::{ClusterResource, ClusterResourceType};
>  
> +use crate::pages::map_subscription;
> +
>  #[derive(Clone, PartialEq, Properties)]
>  pub struct PageResources {}
>  
> @@ -119,11 +121,7 @@ impl PvePageResources {
>              Fa::new("server")
>                  .class((item.status.as_deref() == Some("online")).then_some("pwt-color-primary")),
>              nodename.clone(),
> -            match item.level.as_deref() {
> -                Some("") | None => "no subscription",
> -                Some(level) => level,
> -            }
> -            .to_string(),
> +            map_subscription(&item.level),
>              item.status.clone(),
>          )
>          .interactive(true)





  reply	other threads:[~2026-05-08 15:22 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-08 15:05 [PATCH yew-comp/yew-mobile-gui 00/20] firewall tabs and clean up for pve-yew-mobile-gui Shannon Sterz
2026-05-08 15:05 ` [PATCH yew-comp 01/20] firewall rules panel: correct the url for the pve cluster firewall rules Shannon Sterz
2026-05-08 15:05 ` [PATCH yew-mobile-gui 02/20] cargo.toml: globally ignore certain clippy lints Shannon Sterz
2026-05-08 15:05 ` [PATCH yew-mobile-gui 03/20] main: avoid unnecessary clones Shannon Sterz
2026-05-08 15:05 ` [PATCH yew-mobile-gui 04/20] tree-wide: collapse if statements Shannon Sterz
2026-05-08 15:05 ` [PATCH yew-mobile-gui 05/20] tree-wide: implement the `From` trait instead of the `Into` trait Shannon Sterz
2026-05-08 15:05 ` [PATCH yew-mobile-gui 06/20] tree-wide: implement `Default` for types with an `new()` constructor Shannon Sterz
2026-05-08 15:05 ` [PATCH yew-mobile-gui 07/20] tree-wide: remove unnecessary lazy evaluations Shannon Sterz
2026-05-08 15:05 ` [PATCH yew-mobile-gui 08/20] tree-wide: remove needless borrows Shannon Sterz
2026-05-08 15:05 ` [PATCH yew-mobile-gui 09/20] configuration page: remove redundant static lifetimes Shannon Sterz
2026-05-08 15:05 ` [PATCH yew-mobile-gui 10/20] resources/configuration page: remove useless `.into()` calls Shannon Sterz
2026-05-08 15:05 ` [PATCH yew-mobile-gui 11/20] tree-wide: fix several clippy lints Shannon Sterz
2026-05-08 15:05 ` [PATCH yew-mobile-gui 12/20] dashboard: use proper plural translation string instead of "CPU(s)" Shannon Sterz
2026-05-08 15:05 ` [PATCH yew-mobile-gui 13/20] configuration: clarify that "Firewall" shows the cluster's firewall Shannon Sterz
2026-05-08 15:05 ` [PATCH yew-mobile-gui 14/20] cluster/qemu firewall: use rules panel and comment out unused tabs Shannon Sterz
2026-05-08 15:05 ` [PATCH yew-mobile-gui 15/20] lxc page: align layout for lxc guest with qemu guests Shannon Sterz
2026-05-08 15:43   ` Shannon Sterz
2026-05-08 15:05 ` [PATCH yew-mobile-gui 16/20] lxc: add support for a rudimentary firewall tab for lxc guests Shannon Sterz
2026-05-08 15:05 ` [PATCH yew-mobile-gui 17/20] node status: align layout for node status with guest pages Shannon Sterz
2026-05-08 15:05 ` [PATCH yew-mobile-gui 18/20] node: add a rudimentary firewall tab for cluster nodes Shannon Sterz
2026-05-08 15:05 ` [PATCH yew-mobile-gui 19/20] api types: remove unused file Shannon Sterz
2026-05-08 15:05 ` [PATCH yew-mobile-gui 20/20] resources page: map subscription level analogous to dashboard Shannon Sterz
2026-05-08 15:22   ` Shan Shaji [this message]
2026-05-08 15:59 ` Superseded: Re: [PATCH yew-comp/yew-mobile-gui 00/20] firewall tabs and clean up for pve-yew-mobile-gui Shannon Sterz

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=DIDECJVZ3ON2.1ZEIGBOM1SMC7@proxmox.com \
    --to=s.shaji@proxmox.com \
    --cc=s.sterz@proxmox.com \
    --cc=yew-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