- Neue Datei crates/nexus-api/assets/tabellen.js unter /ui/tabellen.js: formatLocalTime und filterAndSort (mit Strata geschrieben, geprüft) und die Anbindung an die Seite. - Zeiten in Anfragen und Audit sind <time datetime="…Z"> mit UTC-Rückfall ohne JavaScript; Fußzeile nennt Ortszeit. - Tabellen Modelle, Anfragen und Audit: Suchfeld auf dem Namen, Auswahl für Engine, Status, Zustand, Key, Wer und Aktion, Sortierung per Klick auf die Kopfzeile. Der Zustand bleibt beim Erneuern der Teile erhalten. - Tests: tests/js/tabellen.test.mjs (Node, TZ=Europe/Berlin), API-Test der Einbindung; im Browser lokal geprüft. - Nicht enthalten: Übersicht (Stand-Zeile) und Keys/Benutzer-Tabellen, #1078. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@ -141,6 +141,7 @@ pub fn routes() -> Router<Arc<AppState>> {
|
||||
.route("/ui/audit", get(audit_page))
|
||||
.route("/ui/teil/uebersicht", get(overview_fragment))
|
||||
.route("/ui/app.js", get(app_js))
|
||||
.route("/ui/tabellen.js", get(tabellen_js))
|
||||
.route("/ui/app.css", get(app_css))
|
||||
.route("/ui/favicon.svg", get(favicon))
|
||||
// PWA (→ #1062): Manifest und Symbole sind ohne Anmeldung lesbar, enthalten
|
||||
@ -470,8 +471,8 @@ pub(crate) fn layout(title: &str, active: &str, viewer: &Viewer, body: &str) ->
|
||||
<form method=\"post\" action=\"/ui/logout\"><a class=\"chip konto\" href=\"/ui/konto\" title=\"Mein Konto\">{key}</a>{role}\
|
||||
<button class=\"sm\" type=\"submit\">Abmelden</button></form></div></header>\
|
||||
<main><h1>{title}</h1>{body}</main>\
|
||||
<footer>{WORTMARKE} {version} · {mode} · Zeiten in UTC</footer>\
|
||||
<script src=\"/ui/app.js\"></script></body></html>",
|
||||
<footer>{WORTMARKE} {version} · {mode} · Zeiten in Ortszeit (ohne JavaScript UTC)</footer>\
|
||||
<script src=\"/ui/tabellen.js\"></script><script src=\"/ui/app.js\"></script></body></html>",
|
||||
head = head(title),
|
||||
title = esc(title),
|
||||
key = esc(&viewer.user),
|
||||
@ -933,10 +934,10 @@ async fn requests_page(State(state): State<Arc<AppState>>, headers: HeaderMap) -
|
||||
"ok"
|
||||
};
|
||||
format!(
|
||||
"<tr><td class=\"zeit\">{}</td><td><code>{}</code></td><td class=\"name\">{}</td><td class=\"name\">{}</td>\
|
||||
"<tr>{}<td><code>{}</code></td><td class=\"name\">{}</td><td class=\"name\">{}</td>\
|
||||
<td><span class=\"chip {status_class}\">{}</span></td><td class=\"num\">{}</td>\
|
||||
<td class=\"num\">{}</td><td class=\"num\">{}</td><td class=\"num\">{} / {}</td><td>{}</td><td>{}</td></tr>",
|
||||
esc(&r.time),
|
||||
zeit_zelle(&r.time),
|
||||
esc(&r.correlation),
|
||||
esc(r.key.as_deref().unwrap_or("–")),
|
||||
esc(r.model.as_deref().unwrap_or("–")),
|
||||
@ -960,9 +961,9 @@ async fn requests_page(State(state): State<Arc<AppState>>, headers: HeaderMap) -
|
||||
} else {
|
||||
format!(
|
||||
"<p class=\"klein\">Die letzten {ROWS} Anfragen, nur Metadaten (keine Prompts oder Antworten). Zeiten in ms.</p>\
|
||||
<section class=\"card\"><div class=\"breit\"><table><thead><tr><th>Zeit</th><th>Korrelation</th><th>Key</th><th>Modell</th><th>Status</th>\
|
||||
<section class=\"card\"><div class=\"breit\"><table data-filtern=\"anfragen\"><thead><tr><th data-spalte=\"zeit\">Zeit</th><th>Korrelation</th><th data-spalte=\"key\" data-filter>Key</th><th data-spalte=\"name\">Modell</th><th data-spalte=\"status\" data-filter>Status</th>\
|
||||
<th class=\"num\">Warten</th><th class=\"num\">Latenz</th><th class=\"num\">Dauer</th><th class=\"num\">Tokens ein / aus</th>\
|
||||
<th>Engine</th><th></th></tr></thead>\
|
||||
<th data-spalte=\"engine\" data-filter>Engine</th><th></th></tr></thead>\
|
||||
<tbody>{rows}</tbody></table></div></section>"
|
||||
)
|
||||
};
|
||||
@ -983,8 +984,8 @@ async fn audit_page(State(state): State<Arc<AppState>>, headers: HeaderMap) -> R
|
||||
.into_iter()
|
||||
.map(|a| {
|
||||
format!(
|
||||
"<tr><td class=\"zeit\">{}</td><td>{}</td><td><code>{}</code></td><td>{}</td></tr>",
|
||||
esc(&a.time),
|
||||
"<tr>{}<td>{}</td><td><code>{}</code></td><td>{}</td></tr>",
|
||||
zeit_zelle(&a.time),
|
||||
esc(&a.actor),
|
||||
esc(&a.action),
|
||||
esc(a.target.as_deref().unwrap_or("–"))
|
||||
@ -995,7 +996,7 @@ async fn audit_page(State(state): State<Arc<AppState>>, headers: HeaderMap) -> R
|
||||
"<p class=\"leer\">Noch keine Einträge.</p>".to_string()
|
||||
} else {
|
||||
format!(
|
||||
"<section class=\"card\"><div class=\"breit\"><table><thead><tr><th>Zeit</th><th>Wer</th><th>Aktion</th><th>Ziel</th></tr></thead><tbody>{rows}</tbody></table></div></section>"
|
||||
"<section class=\"card\"><div class=\"breit\"><table data-filtern=\"audit\"><thead><tr><th data-spalte=\"zeit\">Zeit</th><th data-spalte=\"wer\" data-filter>Wer</th><th data-spalte=\"aktion\" data-filter>Aktion</th><th data-spalte=\"name\">Ziel</th></tr></thead><tbody>{rows}</tbody></table></div></section>"
|
||||
)
|
||||
};
|
||||
html(StatusCode::OK, layout("Audit", "/ui/audit", &viewer, &body))
|
||||
@ -1130,10 +1131,29 @@ dl.daten dd{margin:0;overflow-wrap:anywhere}dl.daten .breit-zeile{grid-column:1/
|
||||
pre.befehl{margin:0;padding:.6rem .8rem;background:var(--bg);border:1px solid var(--border);border-radius:10px;font-family:ui-monospace,"JetBrains Mono",Menlo,monospace;font-size:.82rem;white-space:pre-wrap;overflow-wrap:anywhere}
|
||||
.engine h2{margin:0}.chips{display:flex;flex-wrap:wrap;gap:.35rem;margin:.7rem 0 .2rem}
|
||||
.engine .zeile{gap:.5rem .7rem}
|
||||
.tabellenleiste{display:flex;flex-wrap:wrap;gap:.5rem .7rem;align-items:center;margin:0 0 .7rem}.tabellenleiste input[type=search]{min-width:12rem}
|
||||
th.sortierbar{cursor:pointer;user-select:none}th.sortierbar:hover{color:var(--text)}
|
||||
th[aria-sort=ascending]::after{content:" ▲";color:var(--accent)}th[aria-sort=descending]::after{content:" ▼";color:var(--accent)}
|
||||
@media (max-width:40rem){header .innen{gap:.6rem 1rem}header form{margin-left:auto}header nav{order:3;width:100%;flex-wrap:nowrap;overflow-x:auto}
|
||||
header nav a{padding:.3rem .8rem;white-space:nowrap}h1{font-size:1.3rem}.card{padding:.9rem 1rem}}
|
||||
"#;
|
||||
|
||||
/// Ortszeit und Filtern/Sortieren der Tabellen (#1082, #1085), Quelle in `assets/tabellen.js`.
|
||||
const TABELLEN_JS: &str = include_str!("../assets/tabellen.js");
|
||||
|
||||
async fn tabellen_js() -> Response {
|
||||
secure(Response::builder())
|
||||
.header(CONTENT_TYPE, "text/javascript; charset=utf-8")
|
||||
.body(Body::from(TABELLEN_JS))
|
||||
.unwrap_or_default()
|
||||
}
|
||||
|
||||
/// Zeitzelle: der UTC-Text bleibt als Rückfall, `tabellen.js` schreibt ihn in die Ortszeit um.
|
||||
pub(crate) fn zeit_zelle(iso: &str) -> String {
|
||||
let iso = esc(iso);
|
||||
format!("<td class=\"zeit\" data-sort=\"{iso}\"><time datetime=\"{iso}\">{iso}</time></td>")
|
||||
}
|
||||
|
||||
async fn app_js() -> Response {
|
||||
secure(Response::builder())
|
||||
.header(CONTENT_TYPE, "text/javascript; charset=utf-8")
|
||||
|
||||
Reference in New Issue
Block a user