[pdm-devel] [PATCH yew-comp 1/2] node info: extend NodeStatus enum to include NodeStatus from proxmox-rs

Dominik Csapak d.csapak at proxmox.com
Mon Nov 3 13:52:20 CET 2025


Aside from the missing Cargo toml entry (it's in the 2/2 patch
by accident) consider this

Reviewed-by: Dominik Csapak <d.csapak at proxmox.com>

On 10/28/25 5:45 PM, Shannon Sterz wrote:
> Signed-off-by: Shannon Sterz <s.sterz at proxmox.com>
> ---
>   src/node_info.rs | 38 ++++++++++++++++++++++++++++++++++++++
>   1 file changed, 38 insertions(+)
> 
> diff --git a/src/node_info.rs b/src/node_info.rs
> index 17ba6cd..5604787 100644
> --- a/src/node_info.rs
> +++ b/src/node_info.rs
> @@ -1,4 +1,5 @@
>   use proxmox_human_byte::HumanByte;
> +use proxmox_node_status::BootMode;
>   use pwt::{prelude::*, widget::Container};
>   
>   use crate::{MeterLabel, StatusRow};
> @@ -7,6 +8,7 @@ use crate::{MeterLabel, StatusRow};
>   pub enum NodeStatus<'a> {
>       Pve(&'a pve_api_types::NodeStatus),
>       Pbs(&'a pbs_api_types::NodeStatus),
> +    Common(&'a proxmox_node_status::NodeStatus),
>   }
>   
>   impl<'a> From<&'a pve_api_types::NodeStatus> for NodeStatus<'a> {
> @@ -29,6 +31,7 @@ pub fn node_info(data: Option<NodeStatus>) -> Container {
>       let (cpu, cpus_total) = match data {
>           Some(NodeStatus::Pve(node_status)) => (node_status.cpu, node_status.cpuinfo.cpus as u64),
>           Some(NodeStatus::Pbs(node_status)) => (node_status.cpu, node_status.cpuinfo.cpus as u64),
> +        Some(NodeStatus::Common(node_status)) => (node_status.cpu, node_status.cpuinfo.cpus as u64),
>           None => (0.0, 1),
>       };
>   
> @@ -39,6 +42,7 @@ pub fn node_info(data: Option<NodeStatus>) -> Container {
>               .and_then(|wait| wait.as_f64())
>               .unwrap_or_default(),
>           Some(NodeStatus::Pbs(node_status)) => node_status.wait,
> +        Some(NodeStatus::Common(node_status)) => node_status.wait,
>           None => 0.0,
>       };
>   
> @@ -48,6 +52,9 @@ pub fn node_info(data: Option<NodeStatus>) -> Container {
>               node_status.memory.total as u64,
>           ),
>           Some(NodeStatus::Pbs(node_status)) => (node_status.memory.used, node_status.memory.total),
> +        Some(NodeStatus::Common(node_status)) => {
> +            (node_status.memory.used, node_status.memory.total)
> +        }
>           None => (0, 1),
>       };
>   
> @@ -57,6 +64,10 @@ pub fn node_info(data: Option<NodeStatus>) -> Container {
>               "{:.2} {:.2} {:.2}",
>               node_status.loadavg[0], node_status.loadavg[1], node_status.loadavg[2]
>           ),
> +        Some(NodeStatus::Common(node_status)) => format!(
> +            "{:.2} {:.2} {:.2}",
> +            node_status.loadavg[0], node_status.loadavg[1], node_status.loadavg[2]
> +        ),
>           None => tr!("N/A"),
>       };
>   
> @@ -66,6 +77,7 @@ pub fn node_info(data: Option<NodeStatus>) -> Container {
>               node_status.rootfs.total as u64,
>           ),
>           Some(NodeStatus::Pbs(node_status)) => (node_status.root.used, node_status.root.total),
> +        Some(NodeStatus::Common(node_status)) => (node_status.root.used, node_status.root.total),
>           None => (0, 1),
>       };
>   
> @@ -90,6 +102,7 @@ pub fn node_info(data: Option<NodeStatus>) -> Container {
>               }
>           }
>           Some(NodeStatus::Pbs(node_status)) => (node_status.swap.used, node_status.swap.total),
> +        Some(NodeStatus::Common(node_status)) => (node_status.swap.used, node_status.swap.total),
>           None => (0, 1),
>       };
>   
> @@ -102,6 +115,10 @@ pub fn node_info(data: Option<NodeStatus>) -> Container {
>               node_status.cpuinfo.model.clone(),
>               node_status.cpuinfo.sockets as u64,
>           ),
> +        Some(NodeStatus::Common(node_status)) => (
> +            node_status.cpuinfo.model.clone(),
> +            node_status.cpuinfo.sockets as u64,
> +        ),
>           None => (String::new(), 1),
>       };
>   
> @@ -121,9 +138,20 @@ pub fn node_info(data: Option<NodeStatus>) -> Container {
>               node_status.current_kernel.release.clone(),
>               node_status.current_kernel.version.clone(),
>           ),
> +        Some(NodeStatus::Common(node_status)) => (
> +            node_status.current_kernel.sysname.clone(),
> +            node_status.current_kernel.release.clone(),
> +            node_status.current_kernel.version.clone(),
> +        ),
>           None => (String::new(), String::new(), String::new()),
>       };
>   
> +    let boot_mode = if let Some(NodeStatus::Common(node_status)) = data {
> +        Some(&node_status.boot_info)
> +    } else {
> +        None
> +    };
> +
>       Container::new()
>           .class("pwt-d-grid pwt-gap-2 pwt-align-items-center")
>           .style("grid-template-columns", "1fr 20px 1fr")
> @@ -221,4 +249,14 @@ pub fn node_info(data: Option<NodeStatus>) -> Container {
>                   .style("grid-column", "1/-1")
>                   .status(format!("{} {} {}", k_sysname, k_release, k_version)),
>           )
> +        .with_optional_child(boot_mode.map(|m| {
> +            let mode = match m.mode {
> +                BootMode::Efi => tr!("Legacy BIOS"),
> +                BootMode::LegacyBios if m.secureboot => tr!("UEFI (Secure Boot Enabled)"),
> +                BootMode::LegacyBios => tr!("UEFI"),
> +            };
> +            StatusRow::new(tr!("Boot Mode"))
> +                .style("grid-column", "1/-1")
> +                .status(mode)
> +        }))
>   }





More information about the pdm-devel mailing list