From: Shannon Sterz <s.sterz@proxmox.com>
To: yew-devel@lists.proxmox.com
Subject: [PATCH yew-comp] user panel: handle expire property on edit properly
Date: Wed, 25 Mar 2026 13:15:16 +0100 [thread overview]
Message-ID: <20260325121516.164312-1-s.sterz@proxmox.com> (raw)
setting expire to "0" is a special case meaning "never expires". while
this was honored in the user management overview, the edit panel
rendered this as 01.01.1970 00:00:00 UTC, or the Unix epoch. this had
minimal functional impact, but it may be confusing to users. set
expire to `Value::Null` in this special case, rendering a cleared date
picker.
also the expire field is typically an `Option<i64>` [1]. so instead of
interpreting it as a `f64` and then casting it back to an `i64` when
rendering the input date, interpret it as an `i64` straight away.
[1]:
https://git.proxmox.com/?p=proxmox.git;a=blob;f=proxmox-access-control/src/types.rs;h=78eafb4c9d1e652f4d69c203aa2117cfe65544c2;hb=HEAD#l218
Signed-off-by: Shannon Sterz <s.sterz@proxmox.com>
---
src/user_panel.rs | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/user_panel.rs b/src/user_panel.rs
index 547fdfe..75a442f 100644
--- a/src/user_panel.rs
+++ b/src/user_panel.rs
@@ -40,8 +40,12 @@ async fn load_user(userid: Key) -> Result<ApiResponseData<Value>, Error> {
let mut resp: ApiResponseData<Value> = crate::http_get_full(&url, None).await?;
if let Value::Number(number) = &resp.data["expire"] {
- if let Some(epoch) = number.as_f64() {
- resp.data["expire"] = Value::String(epoch_to_input_value(epoch as i64));
+ if let Some(epoch) = number.as_i64() {
+ if epoch == 0 {
+ resp.data["expire"] = Value::Null;
+ } else {
+ resp.data["expire"] = Value::String(epoch_to_input_value(epoch));
+ }
}
}
--
2.47.3
next reply other threads:[~2026-03-25 12:15 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-25 12:15 Shannon Sterz [this message]
2026-03-26 23:24 ` applied: " Thomas Lamprecht
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=20260325121516.164312-1-s.sterz@proxmox.com \
--to=s.sterz@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.