feat(server): admin panel pages for dashboard, users, archive, jobs, settings and logs

Vanilla ES modules under a strict CSP (bars and charts are SVG, no inline
styles), cookie session with CSRF header, first sign-in password change,
live updates over the events WebSocket, language menu fed by
/api/v1/i18n. Every label and tooltip is an Admin.* resource (en, it).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
Claude committed 2026-10-02 12:41:42 +00:00
1 parent 145ecf33d2
commit 26016f1621
16 files changed
+2029 -106

No files matched your search

+41
View File
@@ -0,0 +1,41 @@
// Job and node labels shared by the dashboard and the Jobs page.
import { t, has } from "./i18n.js";
import { escapeHtml, attr, bar } from "./ui.js";
export function pascal(text) {
return String(text).split(/[-_]/).map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join("");
}
export function kindLabel(kind) {
const key = `Admin.Job.Kind.${pascal(kind)}`;
return has(key) ? t(key) : kind;
}
export function stateLabel(state) {
const key = `Admin.Job.State.${pascal(state)}`;
return has(key) ? t(key) : state;
}
/** Where a job runs: this server, a render node by name, or nowhere yet. */
export function nodeLabel(job, nodes) {
if (!job.nodeId) return "—";
if (job.nodeId.startsWith("server:")) return t("Admin.Jobs.Server");
return nodes.find((n) => n.id === job.nodeId)?.clientName ?? "—";
}
export function progressCell(job) {
if (job.progressTotal <= 0) return `<div class="progress-cell">${bar(0, true)}<span class="muted">—</span></div>`;
const fraction = job.progressDone / job.progressTotal;
return `<div class="progress-cell">${bar(fraction)}<span class="num">${Math.floor(fraction * 100)} %</span></div>`;
}
export function stateCell(state) {
const glyph = { running: "◐", queued: "○", paused: "❚❚", done: "●", failed: "✕", cancelled: "○" }[state] ?? "";
return `<span class="state ${attr(state)}">${glyph} ${escapeHtml(stateLabel(state))}</span>`;
}
/** Node encoders as "NVENC HEVC/H.264/AV1". */
export function encoders(node) {
const names = [...new Set(node.encoders.map((e) => e.codec.toUpperCase()))];
return names.join("/");
}