From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id D1F4A1FF0C1 for ; Wed, 26 Aug 2026 16:42:33 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 9301A2133F; Wed, 26 Aug 2026 16:42:33 +0200 (CEST) Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Wed, 26 Aug 2026 16:42:24 +0200 Message-Id: From: "Shan Shaji" To: "Dominik Csapak" , Subject: Re: [PATCH proxmox-yew-comp] fix #7932: add missing uptime to the GUI X-Mailer: aerc 0.20.0 References: <20260825135425.329949-1-s.shaji@proxmox.com> <58428142-fbc3-429f-ac11-2cf28a044504@proxmox.com> In-Reply-To: <58428142-fbc3-429f-ac11-2cf28a044504@proxmox.com> X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1787755336951 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.506 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) 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: UG2NGXUFUZJDDHATUT7FFTWWFFXUYZNU X-Message-ID-Hash: UG2NGXUFUZJDDHATUT7FFTWWFFXUYZNU 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: Yew framework devel list at Proxmox List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: [snip] >> >> +fn uptime_html(node_status: Option<&node_info::NodeStatus>) -> Option { >> + let uptime =3D match node_status { > > nit: whitespace issue after '=3D' > > please rustfmt your code before sending > Ack, Thank you! >> + Some(node_info::NodeStatus::Pve(node_status)) =3D> 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)) =3D> node_status.= uptime, >> + Some(node_info::NodeStatus::Common(node_status)) =3D> node_stat= us.uptime, >> + None =3D> 0 >> + }; >> + >> + if uptime =3D=3D 0 { >> + return None; >> + } >> + >> + let uptime_string =3D tr!("(Uptime: {})", format_duration_human(upti= me as f64)); >> + Some(Container::from_tag("span").with_child(uptime_string).into()) >> +} >> + >> impl LoadableComponent for ProxmoxNodeStatusPanel { >> type Message =3D Msg; >> type ViewState =3D 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))