From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 120801FF187 for ; Mon, 3 Nov 2025 13:51:46 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 7A0011CC98; Mon, 3 Nov 2025 13:52:24 +0100 (CET) Message-ID: Date: Mon, 3 Nov 2025 13:52:20 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Beta To: Proxmox Datacenter Manager development discussion , Shannon Sterz References: <20251028164435.576642-1-s.sterz@proxmox.com> <20251028164435.576642-3-s.sterz@proxmox.com> Content-Language: en-US From: Dominik Csapak In-Reply-To: <20251028164435.576642-3-s.sterz@proxmox.com> X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1762174323334 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.029 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 Subject: Re: [pdm-devel] [PATCH yew-comp 1/2] node info: extend NodeStatus enum to include NodeStatus from proxmox-rs X-BeenThere: pdm-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Datacenter Manager development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox Datacenter Manager development discussion Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: pdm-devel-bounces@lists.proxmox.com Sender: "pdm-devel" Aside from the missing Cargo toml entry (it's in the 2/2 patch by accident) consider this Reviewed-by: Dominik Csapak On 10/28/25 5:45 PM, Shannon Sterz wrote: > Signed-off-by: Shannon Sterz > --- > 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) -> 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) -> 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) -> 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) -> 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) -> 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) -> 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) -> 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) -> 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) -> 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) > + })) > } _______________________________________________ pdm-devel mailing list pdm-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel