web: 审计页时间按浏览器本地时区显示
Some checks failed
Secrets MCP — Build & Release / 检查 / 构建 / 发版 (push) Failing after 25s
Secrets MCP — Build & Release / 部署 secrets-mcp (push) Has been skipped

Made-with: Cursor
This commit is contained in:
voson
2026-03-21 12:03:44 +08:00
parent 259fbe10a6
commit 17f8ac0dbc
2 changed files with 20 additions and 4 deletions

View File

@@ -1,4 +1,5 @@
use askama::Template;
use chrono::SecondsFormat;
use std::net::SocketAddr;
use axum::{
@@ -61,7 +62,8 @@ struct AuditPageTemplate {
}
struct AuditEntryView {
created_at: String,
/// RFC3339 UTC for `<time datetime>`; rendered as browser-local in audit.html.
created_at_iso: String,
action: String,
target: String,
detail: String,
@@ -408,7 +410,9 @@ async fn audit_page(
let entries = rows
.into_iter()
.map(|row| AuditEntryView {
created_at: row.created_at.format("%Y-%m-%d %H:%M:%S UTC").to_string(),
created_at_iso: row
.created_at
.to_rfc3339_opts(SecondsFormat::Secs, true),
action: row.action,
target: format_audit_target(&row.namespace, &row.kind, &row.name),
detail: serde_json::to_string_pretty(&row.detail).unwrap_or_else(|_| "{}".to_string()),