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,152 @@
|
||||
// Dashboard (mockup Admin.html, BRIEF §14.8): storage, archive, jobs, render nodes, charts, activity, active jobs.
|
||||
import { t, plural, applyStrings, culture } from "../i18n.js";
|
||||
import { escapeHtml, attr, formatBytes, formatNumber, formatTime, formatDuration, bar, columns, toast, errorText, emptyState, redraw, fitColumns, PROXY_WARNING } from "../ui.js";
|
||||
import { kindLabel, nodeLabel, progressCell, stateCell, stateLabel, encoders } from "../jobs.js";
|
||||
import { activityText } from "../audit.js";
|
||||
|
||||
const SCAN_BUTTON = `<button class="btn small" data-scan data-i18n="Admin.Archive.Scan" data-i18n-title="Admin.Archive.Scan.Tip"></button>`;
|
||||
|
||||
export async function render(root, { api, setMeta, actions, onEvent }) {
|
||||
let timer = null;
|
||||
const refresh = () => {
|
||||
clearTimeout(timer);
|
||||
timer = setTimeout(load, 1500);
|
||||
};
|
||||
|
||||
async function load() {
|
||||
let d;
|
||||
try {
|
||||
d = await api.get("/api/v1/server/dashboard");
|
||||
} catch (err) {
|
||||
root.innerHTML = `<div class="panel empty">${escapeHtml(errorText(err))}</div>`;
|
||||
return;
|
||||
}
|
||||
redraw(root, () => draw(d));
|
||||
}
|
||||
|
||||
function draw(d) {
|
||||
const tls = `Admin.Settings.Tls.${d.tlsMode.charAt(0).toUpperCase()}${d.tlsMode.slice(1)}`;
|
||||
setMeta(t("Admin.Dashboard.Meta", formatDuration(d.uptimeSeconds), d.database, t(tls),
|
||||
t(d.discovery ? "Admin.Dashboard.DiscoveryOn" : "Admin.Dashboard.DiscoveryOff")));
|
||||
actions.innerHTML = d.proxyWarning ? PROXY_WARNING : "";
|
||||
applyStrings(actions);
|
||||
const a = d.archive;
|
||||
const used = a.capacityBytes > 0 ? (a.capacityBytes - a.freeBytes) / a.capacityBytes : 0;
|
||||
const online = d.nodes.filter((n) => n.state !== "offline");
|
||||
const uploads = lastThirtyDays(d.uploads);
|
||||
const totalUploads = uploads.reduce((s, u) => s + u.value, 0);
|
||||
const peak = Math.max(0, ...uploads.map((u) => u.value));
|
||||
|
||||
root.innerHTML = `
|
||||
<div class="tiles">
|
||||
<section class="panel tile" aria-labelledby="tile-storage">
|
||||
<h2 class="label" id="tile-storage" data-i18n="Admin.Dashboard.Storage"></h2>
|
||||
<span class="value">${escapeHtml(formatBytes(a.capacityBytes - a.freeBytes))}<small>${escapeHtml(t("Admin.Dashboard.Of", formatBytes(a.capacityBytes)))}</small></span>
|
||||
${bar(used)}
|
||||
<span class="sub">${escapeHtml(t("Admin.Dashboard.Free", formatBytes(a.freeBytes)))} · ${escapeHtml(t("Admin.Dashboard.Originals", formatBytes(a.bytes)))}</span>
|
||||
</section>
|
||||
<section class="panel tile" aria-labelledby="tile-archive">
|
||||
<h2 class="label" id="tile-archive" data-i18n="Admin.Dashboard.Archive"></h2>
|
||||
<span class="value num">${formatNumber(a.sequences)}<small>${escapeHtml(plural("Admin.Dashboard.SequenceUnit", a.sequences))}</small></span>
|
||||
<span class="sub">${escapeHtml(`${plural("Admin.Dashboard.PhotoCount", a.photos)} · ${plural("Admin.Dashboard.CameraCount", a.cameras)}`)}</span>
|
||||
<span class="sub">${escapeHtml(plural("Admin.Dashboard.WithoutProxies", a.sequencesWithoutProxies))}</span>
|
||||
</section>
|
||||
<section class="panel tile" aria-labelledby="tile-jobs">
|
||||
<h2 class="label" id="tile-jobs" data-i18n="Admin.Dashboard.Jobs"></h2>
|
||||
<span class="value num">${formatNumber(d.jobs.running)}<small data-i18n="Admin.Dashboard.Running"></small></span>
|
||||
<span class="sub">${escapeHtml([plural("Admin.Dashboard.QueuedCount", d.jobs.queued), plural("Admin.Dashboard.DoneToday", d.jobs.doneToday),
|
||||
plural("Admin.Dashboard.FailedToday", d.jobs.failedToday)].join(" · "))}</span>
|
||||
<span class="sub">${escapeHtml([plural("Admin.Dashboard.Parallelism", d.parallelism), ...(d.priorityQueue ? [t("Admin.Dashboard.PriorityQueue")] : [])].join(" · "))}</span>
|
||||
</section>
|
||||
<section class="panel tile" aria-labelledby="tile-nodes">
|
||||
<h2 class="label" id="tile-nodes" data-i18n="Admin.Dashboard.Nodes"></h2>
|
||||
<span class="value num">${formatNumber(online.length)}<small data-i18n="Admin.Dashboard.Online"></small></span>
|
||||
${online.slice(0, 2).map((n) => `<span class="sub"><bdi>${escapeHtml(n.clientName)}</bdi> · ${escapeHtml(encoders(n))} · ${escapeHtml(stateLabel(n.state))}</span>`).join("")}
|
||||
</section>
|
||||
</div>
|
||||
<div class="grid two charts">
|
||||
<section class="panel">
|
||||
<div class="panel-head"><h2 data-i18n="Admin.Dashboard.ByYear"></h2></div>
|
||||
${a.byYear.length === 0 ? emptyState("Admin.Dashboard.NoData", SCAN_BUTTON)
|
||||
: columns(a.byYear.map((y) => ({ label: y.key, value: y.bytes, title: `${y.key} · ${formatBytes(y.bytes)} · ${formatNumber(y.count)}` })),
|
||||
{ label: t("Admin.Dashboard.ByYear"), valueLabel: (i) => formatBytes(i.value) })}
|
||||
</section>
|
||||
<section class="panel">
|
||||
<div class="panel-head"><h2 data-i18n="Admin.Dashboard.Uploads"></h2>
|
||||
<span class="muted ellipsis">${escapeHtml(t("Admin.Dashboard.UploadTotals", formatNumber(totalUploads), formatNumber(peak)))}</span></div>
|
||||
${columns(uploads, { label: t("Admin.Dashboard.Uploads"), sun: true, edgeLabels: true })}
|
||||
</section>
|
||||
</div>
|
||||
<div class="grid wide-right">
|
||||
<section class="panel">
|
||||
<div class="panel-head"><h2 data-i18n="Admin.Dashboard.Activity"></h2><a href="#/logs?view=audit" data-i18n="Admin.Dashboard.AllLogs" data-i18n-title="Admin.Dashboard.AllLogs.Tip"></a></div>
|
||||
${d.activity.length === 0 ? emptyState("Admin.Dashboard.NoActivity", `<button class="btn small" id="reload" data-i18n="Admin.Common.Refresh" data-i18n-title="Admin.Dashboard.Refresh.Tip"></button>`)
|
||||
: `<ul class="activity">${d.activity.map((e) => `<li><time class="muted num" datetime="${attr(e.at)}">${escapeHtml(formatTime(e.at))}</time><span dir="auto">${escapeHtml(activityText(e))}</span></li>`).join("")}</ul>`}
|
||||
</section>
|
||||
<section class="panel">
|
||||
<div class="panel-head"><h2 data-i18n="Admin.Dashboard.Jobs"></h2><a href="#/jobs" data-i18n="Admin.Dashboard.Queue" data-i18n-title="Admin.Dashboard.Queue.Tip"></a></div>
|
||||
${d.activeJobs.length === 0 ? emptyState("Admin.Jobs.Empty", SCAN_BUTTON) : `
|
||||
<div class="table jobs-mini" data-levels="1" role="table" aria-label="${attr(t("Admin.Dashboard.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"><span class="sr-only" data-i18n="Admin.Common.Actions"></span></span></div>
|
||||
<div role="rowgroup">${d.activeJobs.map((j) => `
|
||||
<div class="row" role="row" data-key="${attr(j.id)}">
|
||||
<span class="ellipsis" role="cell">${escapeHtml(kindLabel(j.kind))}</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, d.nodes))}</span>
|
||||
<span class="progress" role="cell">${progressCell(j)}</span><span role="cell">${stateCell(j.state)}</span>
|
||||
<span class="row-actions" role="cell"><button class="btn small" data-cancel="${attr(j.id)}" data-i18n="${j.state === "queued" ? "Admin.Jobs.Remove" : "Admin.Jobs.Cancel"}"
|
||||
data-i18n-title="${j.state === "queued" ? "Admin.Jobs.Remove.Tip" : "Admin.Jobs.Cancel.Tip"}"></button></span>
|
||||
</div>`).join("")}</div>
|
||||
</div>`}
|
||||
</section>
|
||||
</div>`;
|
||||
applyStrings(root);
|
||||
root.querySelectorAll("[data-cancel]").forEach((button) => button.addEventListener("click", async () => {
|
||||
button.disabled = true;
|
||||
try {
|
||||
await api.post(`/api/v1/jobs/${button.dataset.cancel}/cancel`);
|
||||
refresh();
|
||||
} catch (err) {
|
||||
toast(errorText(err), true);
|
||||
button.disabled = false;
|
||||
}
|
||||
}));
|
||||
root.querySelectorAll("[data-scan]").forEach((button) => button.addEventListener("click", async () => {
|
||||
try {
|
||||
await api.post("/api/v1/archive/scan");
|
||||
toast(t("Admin.Archive.Queued"));
|
||||
} catch (err) {
|
||||
toast(errorText(err), true);
|
||||
}
|
||||
}));
|
||||
root.querySelector("#reload")?.addEventListener("click", load);
|
||||
root.querySelectorAll(".table[data-levels]").forEach(fitColumns);
|
||||
}
|
||||
|
||||
onEvent((e) => {
|
||||
if (e.type === "jobProgress") {
|
||||
const cell = root.querySelector(`[data-key="${CSS.escape(e.jobId)}"] .progress`);
|
||||
if (cell) cell.innerHTML = progressCell({ progressDone: e.done, progressTotal: e.total });
|
||||
} else {
|
||||
refresh();
|
||||
}
|
||||
});
|
||||
await load();
|
||||
}
|
||||
|
||||
/** Frames per UTC day for the last 30 days, zero-filled; the first and last days are labelled (in UTC, like the keys). */
|
||||
function lastThirtyDays(days) {
|
||||
const byDay = new Map(days.map((d) => [d.day, d.frames]));
|
||||
const short = new Intl.DateTimeFormat(culture(), { day: "numeric", month: "short", timeZone: "UTC" });
|
||||
const long = new Intl.DateTimeFormat(culture(), { dateStyle: "medium", timeZone: "UTC" });
|
||||
const items = [];
|
||||
const today = new Date();
|
||||
for (let i = 29; i >= 0; i--) {
|
||||
const day = new Date(Date.UTC(today.getUTCFullYear(), today.getUTCMonth(), today.getUTCDate() - i));
|
||||
const value = byDay.get(day.toISOString().slice(0, 10)) ?? 0;
|
||||
items.push({ value, label: i === 29 || i === 0 ? short.format(day) : "", title: `${long.format(day)} · ${formatNumber(value)}` });
|
||||
}
|
||||
return items;
|
||||
}
|
||||
Reference in new issue
Block a user