refactor!: rename Titano to Chronos and move CI and releases to Gitea (#6)
CI / Build and test (push) Successful in 8m14s
CI / Windows tests and installer (push) Skipped
CI / YAML check (push) Successful in 7s
Release / Build, test and publish (push) Successful in 13m19s
CI / PostgreSQL 16 integration (push) Successful in 4m49s
CI / PostgreSQL 17 integration (push) Successful in 5m28s
CI / Docker image (push) Successful in 53s
Release / Server image (push) Failing after 10s
CI / Build and test (push) Successful in 8m14s
CI / Windows tests and installer (push) Skipped
CI / YAML check (push) Successful in 7s
Release / Build, test and publish (push) Successful in 13m19s
CI / PostgreSQL 16 integration (push) Successful in 4m49s
CI / PostgreSQL 17 integration (push) Successful in 5m28s
CI / Docker image (push) Successful in 53s
Release / Server image (push) Failing after 10s
The owner renamed the product and moved the repository to the self-hosted Gitea (https://gitea.encke-hake.ts.net/BalboSoft/Chronos) for more control, and asked for Actions and a first automatic release with the server package and the Windows exe (docs/requests/2026-10-23-chronos-gitea.md). - Chronos everywhere: a byte-exact rename of contents and paths, then a per-language review of the forms the old name's ending had dictated. - Gitea instead of GitHub: the update check, licence, issue and support links read ChronosReleasesUrl; the update check takes the highest stable version, offers a pre-release build its final release and reports a repository it cannot see as a failed check. EULA, security policy and Gitea issue forms live at the repository root. - Gitea Actions for the Linux act_runner (.gitea/workflows): CI, release, nightly image and performance gates in the .NET SDK container with git checkout and the system SQLite. The release cross-compiles the Windows programs, checks their icon, version and DPI manifest, packs installers and zips, publishes the Gitea release and pushes the server image (REGISTRY_TOKEN). Windows-only tests run in an opt-in job on a Windows runner (WINDOWS_RUNNER). - New Chronos.Tools commands: zip, gitea-release, postgres-ci (replaces the docker-exec script, which Gitea's service containers do not allow; the throw-away server runs without durability) and pe-check. - Timed tests take their budget from TestTiming (CHRONOS_TEST_TIME_FACTOR, 3 on the shared runner; the weekly performance gates keep theirs). BREAKING CHANGE: programs, settings, data folders, file types, environment variables and the Docker image use the new name; nothing is migrated from Titano, which never had a release. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Alberto Balbo <alberto.balbo.96@gmail.com>
This commit was merged in pull request #6.
This commit is contained in:
1 parent
c99842cc86
commit
f2b58522b9
1801 files changed
+11804
-10676
No files matched your search
@@ -0,0 +1,195 @@
|
||||
// Jobs (BRIEF §14.8): queue and history with cancel/pause/resume/retry/priority, log tails, render nodes.
|
||||
import { t, plural, applyStrings } from "../i18n.js";
|
||||
import { escapeHtml, attr, formatTime, formatDateTime, toast, errorText, confirmDialog, emptyState, redraw, fitColumns } from "../ui.js";
|
||||
import { kindLabel, nodeLabel, progressCell, stateCell, stateLabel, encoders, logText } from "../jobs.js";
|
||||
|
||||
const FILTERS = ["all", "running", "queued", "paused", "failed", "done", "cancelled"];
|
||||
const PRIORITIES = ["background", "normal", "user"];
|
||||
|
||||
export async function render(root, { api, setMeta, onEvent }) {
|
||||
let filter = "all";
|
||||
let jobs = [];
|
||||
let nodes = [];
|
||||
let running = 0;
|
||||
let cursor = null;
|
||||
const expanded = new Set();
|
||||
let timer = null;
|
||||
|
||||
root.innerHTML = `
|
||||
<div class="chips" role="group" aria-label="${attr(t("Admin.Jobs.State"))}">${FILTERS.map((f) => `<button class="chip" data-filter="${f}" aria-pressed="${f === filter}" data-i18n="Admin.Jobs.Filter.${cap(f)}" data-i18n-title="Admin.Jobs.Filter.Tip"></button>`).join("")}</div>
|
||||
<section class="panel flush">
|
||||
<div class="table jobs" data-levels="1" role="table" aria-label="${attr(t("Admin.Nav.Jobs"))}">
|
||||
<div class="thead" role="row"><span role="columnheader" data-i18n="Admin.Jobs.Kind"></span><span role="columnheader" data-i18n="Admin.Jobs.Target"></span>
|
||||
<span role="columnheader" class="col-node" data-i18n="Admin.Jobs.Node"></span><span role="columnheader" data-i18n="Admin.Jobs.Progress"></span>
|
||||
<span role="columnheader" data-i18n="Admin.Jobs.State"></span><span role="columnheader" class="col-created" data-i18n="Admin.Jobs.Created"></span>
|
||||
<span role="columnheader"><span class="sr-only" data-i18n="Admin.Common.Actions"></span></span></div>
|
||||
<div id="rows" role="rowgroup"></div>
|
||||
</div>
|
||||
<div class="table-foot" id="foot" hidden><span class="spacer"></span><button class="btn small" id="more" data-i18n="Admin.Common.More" data-i18n-title="Admin.Common.More.Tip"></button></div>
|
||||
</section>
|
||||
<section class="panel flush" aria-labelledby="nodes-title">
|
||||
<div class="panel-head padded"><h2 id="nodes-title" data-i18n="Admin.Jobs.Nodes"></h2></div>
|
||||
<div class="table nodes" data-levels="1" role="table" aria-labelledby="nodes-title">
|
||||
<div class="thead" role="row"><span role="columnheader" data-i18n="Admin.Jobs.NodeName"></span><span role="columnheader" class="col-owner" data-i18n="Admin.Jobs.Owner"></span>
|
||||
<span role="columnheader" data-i18n="Admin.Jobs.Encoders"></span><span role="columnheader" class="col-heartbeat" data-i18n="Admin.Jobs.Heartbeat"></span>
|
||||
<span role="columnheader" data-i18n="Admin.Jobs.State"></span><span role="columnheader"><span class="sr-only" data-i18n="Admin.Common.Actions"></span></span></div>
|
||||
<div id="nodes" role="rowgroup"></div>
|
||||
</div>
|
||||
</section>`;
|
||||
applyStrings(root);
|
||||
root.querySelectorAll("[data-filter]").forEach((chip) => chip.addEventListener("click", () => setFilter(chip.dataset.filter)));
|
||||
root.querySelector("#more").addEventListener("click", () => load(true));
|
||||
|
||||
function setFilter(value) {
|
||||
filter = value;
|
||||
root.querySelectorAll("[data-filter]").forEach((c) => c.setAttribute("aria-pressed", String(c.dataset.filter === value)));
|
||||
load();
|
||||
}
|
||||
|
||||
async function load(more = false) {
|
||||
try {
|
||||
const state = filter === "all" ? "" : `&state=${filter}`;
|
||||
const [page, list, active] = await Promise.all([
|
||||
api.get(`/api/v1/jobs?limit=50${state}${more && cursor ? `&cursor=${encodeURIComponent(cursor)}` : ""}`),
|
||||
api.get("/api/v1/nodes"),
|
||||
// The header counts running jobs whatever the filter shows.
|
||||
api.get("/api/v1/jobs?state=running&limit=100"),
|
||||
]);
|
||||
jobs = more ? jobs.concat(page.items) : page.items;
|
||||
cursor = page.nextCursor;
|
||||
nodes = list;
|
||||
running = active.items.length;
|
||||
} catch (err) {
|
||||
toast(errorText(err), true);
|
||||
return;
|
||||
}
|
||||
setMeta(`${plural("Admin.Jobs.RunningCount", running)} · ${plural("Admin.Jobs.NodesOnline", nodes.filter((n) => n.state !== "offline").length)}`);
|
||||
draw();
|
||||
}
|
||||
|
||||
function draw() {
|
||||
const host = root.querySelector("#rows");
|
||||
redraw(host, () => {
|
||||
host.innerHTML = jobs.map((j) => `
|
||||
<div class="row" role="row" data-key="${attr(j.id)}">
|
||||
<span role="cell"><button class="link ellipsis" data-toggle="${attr(j.id)}" aria-expanded="${expanded.has(j.id)}" aria-controls="log-${attr(j.id)}" data-i18n-title="Admin.Jobs.Log.Tip">${escapeHtml(kindLabel(j.kind))}</button></span>
|
||||
<span class="ellipsis" role="cell" dir="auto" title="${attr(j.targetLabel ?? "")}">${escapeHtml(j.targetLabel ?? "")}</span>
|
||||
<span class="col-node ellipsis" role="cell" dir="auto">${escapeHtml(nodeLabel(j, nodes))}</span>
|
||||
<span class="progress" role="cell">${progressCell(j)}</span>
|
||||
<span role="cell">${stateCell(j.state)}</span>
|
||||
<span class="col-created muted nowrap" role="cell">${escapeHtml(formatTime(j.created))}</span>
|
||||
<span class="row-actions" role="cell">${buttons(j)}</span>
|
||||
</div>
|
||||
${expanded.has(j.id) ? `<div class="row log-row" role="row"><pre class="log wide" role="cell" id="log-${attr(j.id)}" dir="ltr">${escapeHtml(logText(j))}</pre></div>` : ""}`).join("")
|
||||
|| `<div class="row" role="row"><div class="wide" role="cell">${filter === "all"
|
||||
? emptyState("Admin.Jobs.Empty", `<button class="btn small" id="scan" data-i18n="Admin.Archive.Scan" data-i18n-title="Admin.Archive.Scan.Tip"></button>`)
|
||||
: emptyState("Admin.Jobs.Empty", `<button class="btn small" id="show-all" data-i18n="Admin.Jobs.ShowAll" data-i18n-title="Admin.Jobs.ShowAll.Tip"></button>`)}</div></div>`;
|
||||
applyStrings(host);
|
||||
});
|
||||
host.querySelectorAll("[data-toggle]").forEach((b) => b.addEventListener("click", () => {
|
||||
const id = b.dataset.toggle;
|
||||
if (!expanded.delete(id)) expanded.add(id);
|
||||
draw();
|
||||
}));
|
||||
host.querySelectorAll("[data-act]").forEach((b) => b.addEventListener("click", () => act(b.closest("[data-key]").dataset.key, b.dataset.act)));
|
||||
host.querySelectorAll("select[data-priority]").forEach((s) => s.addEventListener("change", () => setPriority(s.dataset.priority, s.value)));
|
||||
host.querySelector("#show-all")?.addEventListener("click", () => setFilter("all"));
|
||||
host.querySelector("#scan")?.addEventListener("click", scan);
|
||||
root.querySelector("#foot").hidden = !cursor;
|
||||
|
||||
const nodeHost = root.querySelector("#nodes");
|
||||
redraw(nodeHost, () => {
|
||||
nodeHost.innerHTML = nodes.map((n) => `
|
||||
<div class="row" role="row" data-key="${attr(n.id)}">
|
||||
<span class="ellipsis" role="cell" dir="auto" title="${attr(n.clientName)}"><strong>${escapeHtml(n.clientName)}</strong></span>
|
||||
<span class="col-owner ellipsis" role="cell" dir="auto">${escapeHtml(n.username)}</span>
|
||||
<span class="ellipsis" role="cell" title="${attr(n.encoders.map((e) => e.name).join(", "))}">${escapeHtml(encoders(n))}</span>
|
||||
<span class="col-heartbeat muted nowrap" role="cell">${escapeHtml(formatDateTime(n.lastHeartbeat))}</span>
|
||||
<span class="state ${n.state === "offline" ? "cancelled" : n.state === "busy" ? "running" : "done"}" role="cell"><span aria-hidden="true">${n.state === "offline" ? "○" : "●"}</span> ${escapeHtml(stateLabel(n.state))}</span>
|
||||
<span class="row-actions" role="cell"><button class="btn small destructive" data-forget="${attr(n.id)}" data-i18n="Admin.Jobs.Forget" data-i18n-title="Admin.Jobs.Forget.Tip"></button></span>
|
||||
</div>`).join("")
|
||||
|| `<div class="row" role="row"><div class="wide" role="cell">${emptyState("Admin.Jobs.NoNodes",
|
||||
`<a class="btn small" href="#/users" data-i18n="Admin.Nav.Users" data-i18n-title="Admin.Jobs.NoNodes.Tip"></a>`)}</div></div>`;
|
||||
applyStrings(nodeHost);
|
||||
});
|
||||
nodeHost.querySelectorAll("[data-forget]").forEach((b) => b.addEventListener("click", () => forget(nodes.find((n) => n.id === b.dataset.forget))));
|
||||
root.querySelectorAll(".table[data-levels]").forEach(fitColumns);
|
||||
}
|
||||
|
||||
function buttons(job) {
|
||||
const button = (act, key) => `<button class="btn small" data-act="${act}" data-i18n="Admin.Jobs.${key}" data-i18n-title="Admin.Jobs.${key}.Tip"></button>`;
|
||||
const priority = `<select class="input small" data-priority="${attr(job.id)}" data-i18n-title="Admin.Jobs.Priority.Tip">${PRIORITIES.map((p) =>
|
||||
`<option value="${p}" ${p === job.priority ? "selected" : ""}>${escapeHtml(t(`Admin.Jobs.Priority.${cap(p)}`))}</option>`).join("")}</select>`;
|
||||
switch (job.state) {
|
||||
case "running": return button("pause", "Pause") + button("cancel", "Cancel");
|
||||
case "queued": return priority + button("pause", "Pause") + button("cancel", "Remove");
|
||||
case "paused": return priority + button("resume", "Resume") + button("cancel", "Cancel");
|
||||
case "failed":
|
||||
case "cancelled": return button("retry", "Retry");
|
||||
default: return "";
|
||||
}
|
||||
}
|
||||
|
||||
async function act(id, action) {
|
||||
try {
|
||||
await api.post(`/api/v1/jobs/${id}/${action}`);
|
||||
await load();
|
||||
} catch (err) {
|
||||
toast(errorText(err), true);
|
||||
}
|
||||
}
|
||||
|
||||
async function setPriority(id, priority) {
|
||||
try {
|
||||
await api.post(`/api/v1/jobs/${id}/priority`, { priority });
|
||||
} catch (err) {
|
||||
toast(errorText(err), true);
|
||||
}
|
||||
}
|
||||
|
||||
async function scan() {
|
||||
try {
|
||||
await api.post("/api/v1/archive/scan");
|
||||
toast(t("Admin.Archive.Queued"));
|
||||
} catch (err) {
|
||||
toast(errorText(err), true);
|
||||
}
|
||||
}
|
||||
|
||||
async function forget(node) {
|
||||
const confirmed = await confirmDialog({
|
||||
title: t("Admin.Jobs.ForgetTitle", node.clientName),
|
||||
confirm: t("Admin.Jobs.Forget"),
|
||||
confirmTip: t("Admin.Jobs.Forget.Tip"),
|
||||
cancel: t("Admin.Common.Keep"),
|
||||
cancelTip: t("Admin.Common.Keep.Tip"),
|
||||
});
|
||||
if (!confirmed) return;
|
||||
try {
|
||||
await api.del(`/api/v1/nodes/${node.id}`);
|
||||
await load();
|
||||
} catch (err) {
|
||||
toast(errorText(err), true);
|
||||
}
|
||||
}
|
||||
|
||||
onEvent((e) => {
|
||||
if (e.type === "jobProgress") {
|
||||
const job = jobs.find((j) => j.id === e.jobId);
|
||||
if (job) {
|
||||
job.progressDone = e.done;
|
||||
job.progressTotal = e.total;
|
||||
const cell = root.querySelector(`[data-key="${CSS.escape(e.jobId)}"] .progress`);
|
||||
if (cell) cell.innerHTML = progressCell(job);
|
||||
}
|
||||
} else if (e.type === "jobState" || e.type === "nodeState") {
|
||||
clearTimeout(timer);
|
||||
timer = setTimeout(load, 800);
|
||||
}
|
||||
});
|
||||
await load();
|
||||
}
|
||||
|
||||
function cap(s) {
|
||||
return s.charAt(0).toUpperCase() + s.slice(1);
|
||||
}
|
||||
Reference in new issue
Block a user