From: Dominik Csapak <d.csapak@proxmox.com>
To: Proxmox Datacenter Manager development discussion
<pdm-devel@lists.proxmox.com>,
Shannon Sterz <s.sterz@proxmox.com>
Subject: Re: [pdm-devel] [PATCH yew-comp 1/2] node info: extend NodeStatus enum to include NodeStatus from proxmox-rs
Date: Mon, 3 Nov 2025 13:52:20 +0100 [thread overview]
Message-ID: <e8b6c29f-2b83-41f3-8a0f-9678356fd4ae@proxmox.com> (raw)
In-Reply-To: <20251028164435.576642-3-s.sterz@proxmox.com>
Aside from the missing Cargo toml entry (it's in the 2/2 patch
by accident) consider this
Reviewed-by: Dominik Csapak <d.csapak@proxmox.com>
On 10/28/25 5:45 PM, Shannon Sterz wrote:
> Signed-off-by: Shannon Sterz <s.sterz@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)
> + }))
> }
_______________________________________________
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-11-03 12:51 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-28 16:44 [pdm-devel] [PATCH datacenter-manager/proxmox/yew-comp 0/6] add node status panel to proxmox datacenter manager Shannon Sterz
2025-10-28 16:44 ` [pdm-devel] [PATCH proxmox 1/1] node-status: add node status crate Shannon Sterz
2025-11-03 12:50 ` Dominik Csapak
2025-10-28 16:44 ` [pdm-devel] [PATCH yew-comp 1/2] node info: extend NodeStatus enum to include NodeStatus from proxmox-rs Shannon Sterz
2025-11-03 12:52 ` Dominik Csapak [this message]
2025-10-28 16:44 ` [pdm-devel] [PATCH yew-comp 2/2] node status panel: add a panel that show the current status of a node Shannon Sterz
2025-10-28 16:44 ` [pdm-devel] [PATCH datacenter-manager 1/3] api-types/api: add endpoints for querying the node's status Shannon Sterz
2025-11-03 13:11 ` Dominik Csapak
2025-10-28 16:44 ` [pdm-devel] [RFC PATCH datacenter-manager 2/3] ui: add NodeStatusPanel to the administration menu Shannon Sterz
2025-10-28 16:44 ` [pdm-devel] [RFC PATCH datacenter-manager 3/3] nodes: remove unnecessary rustfmt::skip macro Shannon Sterz
2025-11-03 13:15 ` [pdm-devel] [PATCH datacenter-manager/proxmox/yew-comp 0/6] add node status panel to proxmox datacenter manager Dominik Csapak
2025-11-06 11:21 ` Shannon Sterz
2025-11-06 12:46 ` [pdm-devel] Superseded: " Shannon Sterz
-- strict thread matches above, loose matches on Subject: below --
2025-11-06 12:43 [pdm-devel] " Shannon Sterz
2025-11-06 12:43 ` [pdm-devel] [PATCH yew-comp 1/2] node info: extend NodeStatus enum to include NodeStatus from proxmox-rs 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=e8b6c29f-2b83-41f3-8a0f-9678356fd4ae@proxmox.com \
--to=d.csapak@proxmox.com \
--cc=pdm-devel@lists.proxmox.com \
--cc=s.sterz@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