From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id 9AF9B1FF0A7 for ; Wed, 02 Sep 2026 17:00:12 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 8F959215AF; Wed, 02 Sep 2026 17:00:02 +0200 (CEST) From: Shan Shaji To: pve-devel@lists.proxmox.com Subject: [PATCH proxmox-yew-comp v2 3/6] fix #7932: add missing uptime to the GUI Date: Wed, 2 Sep 2026 16:59:41 +0200 Message-ID: <20260902145944.365185-4-s.shaji@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260902145944.365185-1-s.shaji@proxmox.com> References: <20260902145944.365185-1-s.shaji@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1788361193338 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.337 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) POISEN_SPAM_PILL 0.1 Meta: its spam POISEN_SPAM_PILL_1 0.1 random spam to be learned in bayes POISEN_SPAM_PILL_3 0.1 random spam to be learned in bayes RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: B5MUVSO6HJMEYA43LVUEYBCZVQQJBDDA X-Message-ID-Hash: B5MUVSO6HJMEYA43LVUEYBCZVQQJBDDA X-MailFrom: s.shaji@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Previously, the uptime was not displayed in Proxmox Datacenter Manager. This fixes the issue by wiring the property already available from the /status endpoint into the UI. Signed-off-by: Shan Shaji --- src/node_status_panel.rs | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/node_status_panel.rs b/src/node_status_panel.rs index ec17a94..7e5c6e7 100644 --- a/src/node_status_panel.rs +++ b/src/node_status_panel.rs @@ -8,13 +8,13 @@ use pwt::widget::form::DisplayField; use yew::virtual_dom::{VComp, VNode}; use pwt::prelude::*; -use pwt::widget::{error_message, Fa, Panel, Row, Tooltip}; +use pwt::widget::{Container, Fa, Panel, Row, Tooltip, error_message}; use pwt::widget::{Button, Dialog}; use pwt_macros::builder; use proxmox_node_status::{NodePowerCommand, NodeStatus}; -use crate::utils::copy_text_to_clipboard; +use crate::utils::{copy_text_to_clipboard, format_duration_human}; use crate::{ http_get, http_post, node_info, ConfirmButton, LoadableComponent, LoadableComponentContext, LoadableComponentMaster, LoadableComponentScopeExt, LoadableComponentState, @@ -146,6 +146,22 @@ impl ProxmoxNodeStatusPanel { } } +fn uptime_html(node_status: Option<&node_info::NodeStatus>) -> Option { + let uptime = match node_status { + Some(node_info::NodeStatus::Pve(node_status)) => node_status.uptime, + Some(node_info::NodeStatus::Pbs(node_status)) => node_status.uptime, + Some(node_info::NodeStatus::Common(node_status)) => node_status.uptime, + None => 0 + }; + + if uptime == 0 { + return None; + } + + let uptime_string = tr!("(Uptime: {})", format_duration_human(uptime as f64)); + Some(Container::from_tag("span").with_child(uptime_string).into()) +} + impl LoadableComponent for ProxmoxNodeStatusPanel { type Message = Msg; type ViewState = ViewState; @@ -229,6 +245,7 @@ impl LoadableComponent for ProxmoxNodeStatusPanel { .gap(2) .with_child(Fa::new("book")) .with_child(tr!("Node Status")) + .with_optional_child(uptime_html(status.as_ref())) .into_html(), ) .with_child(node_info(status)) -- 2.47.3