all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: "Shan Shaji" <s.shaji@proxmox.com>
To: "Dominik Csapak" <d.csapak@proxmox.com>, <yew-devel@lists.proxmox.com>
Subject: Re: [PATCH proxmox-yew-comp] fix #7932: add missing uptime to the GUI
Date: Wed, 26 Aug 2026 16:42:24 +0200	[thread overview]
Message-ID: <DKYYDNGIAVMV.2WF3ZBQW0OMTW@proxmox.com> (raw)
In-Reply-To: <58428142-fbc3-429f-ac11-2cf28a044504@proxmox.com>

[snip]

>>
>> +fn uptime_html(node_status: Option<&node_info::NodeStatus>) -> Option<Html> {
>> +    let uptime =  match node_status {
>
> nit: whitespace issue after '='
>
> please rustfmt your code before sending
>

Ack, Thank you!

>> +        Some(node_info::NodeStatus::Pve(node_status)) => node_status
>> +            .additional_properties
>> +            .get("uptime")
>> +            .and_then(|uptime| uptime.as_u64())
>> +            .unwrap_or_default(),
>
> the better way would be to properly add the uptime field to the
> return schema in pve-manager. Then we have to update pve-api-types to
> include the 'uptime' field and then we can simply use it here.
>
> IMO the issue is not so pressing that we have to circumvent this
> schema update -> api-types update dance.
>
>
> while i looked at the code in pve-manager where we return this, I
> noticed that we always return an 'idle' field with value 0.
> we do read the idle value from /proc/uptime there, but don't assign
> it to the return value. Maybe that is something you can fix too
> (in a separate patch, also adding the idle field to the return schema)
>

Makes sense, will fix this in the next revision. Thank you!

>> +        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 +249,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))





      reply	other threads:[~2026-08-26 14:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-25 13:54 [PATCH proxmox-yew-comp] fix #7932: add missing uptime to the GUI Shan Shaji
2026-08-26  6:43 ` Dominik Csapak
2026-08-26 14:42   ` Shan Shaji [this message]

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=DKYYDNGIAVMV.2WF3ZBQW0OMTW@proxmox.com \
    --to=s.shaji@proxmox.com \
    --cc=d.csapak@proxmox.com \
    --cc=yew-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