show version in UI

This commit is contained in:
2026-03-09 09:43:13 +11:00
parent c796f1324e
commit 76851f0816
4 changed files with 107 additions and 6 deletions

View File

@@ -615,7 +615,35 @@ function extendForecastTo(points, endTime) {
return [...points, { ...last, ts: new Date(endTs).toISOString() }];
}
function updateSiteMeta(site, model, tzLabel) {
function formatBuildStamp(build) {
if (!build) {
return "build --";
}
const parts = [];
const rawBuildTime = build.build_time;
if (rawBuildTime && rawBuildTime !== "unknown") {
const dt = new Date(rawBuildTime);
if (Number.isNaN(dt.getTime())) {
parts.push(rawBuildTime);
} else {
parts.push(formatDateTime(dt));
}
} else {
parts.push("--");
}
if (build.git_commit && build.git_commit !== "unknown") {
parts.push(`commit ${build.git_commit}`);
}
if (build.version && build.version !== "dev") {
parts.push(`version ${build.version}`);
}
return `build ${parts.join(", ")}`;
}
function updateSiteMeta(site, model, tzLabel, build) {
const home = document.getElementById("site-home");
const suffix = document.getElementById("site-meta-suffix");
if (home) {
@@ -623,7 +651,7 @@ function updateSiteMeta(site, model, tzLabel) {
home.setAttribute("href", "/");
}
if (suffix) {
suffix.textContent = ` | model ${model || "--"} | ${tzLabel}`;
suffix.textContent = ` | model ${model || "--"} | ${tzLabel} | ${formatBuildStamp(build)}`;
}
}
@@ -686,7 +714,7 @@ function baseOptions(range) {
function renderDashboard(data) {
const latest = data.latest;
const tzLabel = state.tz === "utc" ? "UTC" : "Local";
updateSiteMeta(data.site, data.model, tzLabel);
updateSiteMeta(data.site, data.model, tzLabel, data.build);
updateText("last-updated", `updated ${formatDateTime(data.generated_at)}`);
const forecastMeta = data.forecast && data.forecast.points && data.forecast.points.length
? `forecast retrieved ${formatDateTime(data.forecast.retrieved_at)}`