From: Shannon Sterz <s.sterz@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [pdm-devel] [PATCH yew-comp 1/2] node info: extend NodeStatus enum to include NodeStatus from proxmox-rs
Date: Thu, 6 Nov 2025 13:43:30 +0100 [thread overview]
Message-ID: <20251106124334.189955-3-s.sterz@proxmox.com> (raw)
In-Reply-To: <20251106124334.189955-1-s.sterz@proxmox.com>
Signed-off-by: Shannon Sterz <s.sterz@proxmox.com>
Reviewed-by: Dominik Csapak <d.csapak@proxmox.com>
Tested-by: Dominik Csapak <d.csapak@proxmox.com>
---
Cargo.toml | 1 +
src/node_info.rs | 38 ++++++++++++++++++++++++++++++++++++++
2 files changed, 39 insertions(+)
diff --git a/Cargo.toml b/Cargo.toml
index 39109c0..ecce886 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -84,6 +84,7 @@ proxmox-apt-api-types = { version = "2.0", optional = true }
proxmox-access-control = "1.1"
proxmox-dns-api = { version = "1", optional = true }
proxmox-network-api = { version = "1", optional = true }
+proxmox-node-status = { version = "1", features = [] }
pve-api-types = "8"
pbs-api-types = "1"
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)
+ }))
}
--
2.47.3
_______________________________________________
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-06 12:42 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-06 12:43 [pdm-devel] [PATCH datacenter-manager/proxmox/yew-comp 0/6] add node status panel to proxmox datacenter manager Shannon Sterz
2025-11-06 12:43 ` [pdm-devel] [PATCH proxmox 1/1] node-status: add node status crate Shannon Sterz
2025-11-06 19:41 ` [pdm-devel] applied: " Thomas Lamprecht
2025-11-06 12:43 ` Shannon Sterz [this message]
2025-11-06 20:44 ` [pdm-devel] applied: [PATCH yew-comp 1/2] node info: extend NodeStatus enum to include NodeStatus from proxmox-rs Thomas Lamprecht
2025-11-06 12:43 ` [pdm-devel] [PATCH yew-comp 2/2] node status panel: add a panel that show the current status of a node Shannon Sterz
2025-11-06 12:43 ` [pdm-devel] [PATCH datacenter-manager 1/3] api-types/api: add endpoints for querying the node's status Shannon Sterz
2025-11-06 20:57 ` [pdm-devel] applied: " Thomas Lamprecht
2025-11-06 12:43 ` [pdm-devel] [PATCH datacenter-manager 2/3] ui: make NodeStatusPanel available as a widget Shannon Sterz
2025-11-06 21:10 ` Thomas Lamprecht
2025-11-06 12:43 ` [pdm-devel] [PATCH datacenter-manager 3/3] nodes: remove unnecessary rustfmt::skip macro Shannon Sterz
2025-11-06 20:57 ` [pdm-devel] applied: " Thomas Lamprecht
2025-11-06 12:44 ` [pdm-devel] [PATCH datacenter-manager/proxmox/yew-comp 0/6] add node status panel to proxmox datacenter manager Shannon Sterz
-- strict thread matches above, loose matches on Subject: below --
2025-10-28 16:44 Shannon Sterz
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
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=20251106124334.189955-3-s.sterz@proxmox.com \
--to=s.sterz@proxmox.com \
--cc=pdm-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.