feat(ui): GPUs und Zustand der Modelle als Symbole mit Nummer beziehungsweise Hinweis (#1085)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GmHhg3Td16J38kAyDLzb39
This commit is contained in:
2026-11-17 22:07:39 +01:00
parent ca3f5f2b6b
commit bdd0ee81ec
3 changed files with 65 additions and 14 deletions

View File

@ -198,6 +198,51 @@ pub(super) fn oberflaeche(frontend: &nexus_adapter::Frontend, admin: bool) -> St
}
}
/// Zustand eines Modells als Symbol (Lucide): `geladen`, `laedt`, `entlaedt`, `wartet`, sonst nicht geladen.
/// `text` steht im Hinweis und für Screenreader; der Tabellenfilter liest ihn aus `data-sort`.
pub(super) fn zustand(art: &str, text: &str) -> String {
let (klasse, farbe, pfade) = match art {
"geladen" => (
"gemeldet",
"z-ok",
"<circle cx=\"12\" cy=\"12\" r=\"10\"/><path d=\"m16 9-5.5 5.5L8 12\"/>",
),
"laedt" | "entlaedt" => (
"gemeldet",
"z-warn",
"<path d=\"M21 12a9 9 0 1 1-6.219-8.56\"/>",
),
"wartet" => (
"gemeldet",
"z-warn",
"<path d=\"M5 22h14\"/><path d=\"M5 2h14\"/><path d=\"M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22\"/><path d=\"M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2\"/>",
),
_ => (
"engine",
"z-aus",
"<path d=\"M10.1 2.182a10 10 0 0 1 3.8 0\"/><path d=\"M13.9 21.818a10 10 0 0 1-3.8 0\"/><path d=\"M17.609 3.721a10 10 0 0 1 2.69 2.7\"/><path d=\"M2.182 13.9a10 10 0 0 1 0-3.8\"/><path d=\"M20.279 17.609a10 10 0 0 1-2.7 2.69\"/><path d=\"M21.818 10.1a10 10 0 0 1 0 3.8\"/><path d=\"M3.721 6.391a10 10 0 0 1 2.7-2.69\"/><path d=\"M6.391 20.279a10 10 0 0 1-2.69-2.7\"/>",
),
};
format!(
"<svg class=\"fsym {klasse} {farbe}\" viewBox=\"0 0 24 24\" role=\"img\" aria-label=\"{t}\"><title>{t}</title>{pfade}</svg>",
t = esc(text)
)
}
/// GPU-Nummern („0, 1“) als Chip-Symbole mit Nummer.
pub(super) fn gpu_symbole(gpus: &str) -> String {
gpus.split(',')
.map(str::trim)
.filter(|n| !n.is_empty())
.map(|n| {
format!(
"<span class=\"fkann\" title=\"GPU {n}\"><svg class=\"fsym engine k-embed\" viewBox=\"0 0 24 24\" role=\"img\" aria-label=\"GPU {n}\"><path d=\"M12 20v2\"/><path d=\"M12 2v2\"/><path d=\"M17 20v2\"/><path d=\"M17 2v2\"/><path d=\"M2 12h2\"/><path d=\"M2 17h2\"/><path d=\"M2 7h2\"/><path d=\"M20 12h2\"/><path d=\"M20 17h2\"/><path d=\"M20 7h2\"/><path d=\"M7 20v2\"/><path d=\"M7 2v2\"/><rect x=\"4\" y=\"4\" width=\"16\" height=\"16\" rx=\"2\"/><rect x=\"8\" y=\"8\" width=\"8\" height=\"8\" rx=\"1\"/></svg>{n}</span>",
n = esc(n)
)
})
.collect()
}
fn symbol(key: &str, klasse: &str, hinweis: &str) -> String {
format!(
"<svg class=\"fsym {klasse} k-{key}\" viewBox=\"0 0 24 24\" role=\"img\" aria-label=\"{t}: {h}\"><title>{t}: {h}</title>{p}</svg>",