all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Shan Shaji <s.shaji@proxmox.com>
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	[thread overview]
Message-ID: <20260902145944.365185-4-s.shaji@proxmox.com> (raw)
In-Reply-To: <20260902145944.365185-1-s.shaji@proxmox.com>

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 <s.shaji@proxmox.com>
---
 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<Html> {
+    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





  parent reply	other threads:[~2026-09-02 15:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-02 14:59 [PATCH manager/proxmox{-yew-comp,} v2 0/6] add missing uptime to the GUI, update API dump, and regenerate pve-api-types Shan Shaji
2026-09-02 14:59 ` [PATCH pve-manager v2 1/6] fix: nodes: update `idle` key value in hash reference Shan Shaji
2026-09-02 14:59 ` [PATCH pve-manager v2 2/6] fix: node: add missing `uptime` property inside the return schema Shan Shaji
2026-09-02 14:59 ` Shan Shaji [this message]
2026-09-02 14:59 ` [PATCH proxmox v2 4/6] chore: pve-api-types: update API dump and regenerate types Shan Shaji
2026-09-02 14:59 ` [PATCH proxmox v2 5/6] pve-api-types: register missing pve-fw-comment-spec verify function Shan Shaji
2026-09-02 14:59 ` [PATCH proxmox v2 6/6] pve-api-types: update API dump for /node/status and regenerate types Shan Shaji

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=20260902145944.365185-4-s.shaji@proxmox.com \
    --to=s.shaji@proxmox.com \
    --cc=pve-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.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal