28ef9750d3
CI / Test (rest) (pull_request) Successful in 9s
CI / Test (store) (pull_request) Successful in 6s
CI / Build (windows/amd64) (pull_request) Successful in 8s
CI / Build (linux/amd64) (pull_request) Successful in 7s
CI / Lint (pull_request) Successful in 19s
CI / Build (linux/arm64) (pull_request) Successful in 7s
e2e / Playwright vs docker-compose (pull_request) Successful in 1m26s
CI / Test (server-http) (pull_request) Successful in 2m34s
formatRelTime now wraps its label in <time data-rel-ts=...>, and both layouts include a small ticker that re-renders every 30s. Without this, a job-detail page rendered an hour ago kept showing '2h ago' when the wall-clock truth was '3h ago'.
45 lines
1.6 KiB
HTML
45 lines
1.6 KiB
HTML
{{define "chromeless"}}<!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<title>{{block "title" .}}restic-manager{{end}}</title>
|
|
<link rel="stylesheet" href="/static/css/styles.css">
|
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap" rel="stylesheet">
|
|
</head>
|
|
<body class="min-h-screen flex flex-col">
|
|
{{block "content" .}}{{end}}
|
|
<script>
|
|
// See base.html for rationale; chromeless pages (e.g. pending host)
|
|
// also use the relTime helper, so they need the same ticker.
|
|
(function () {
|
|
function label(ms) {
|
|
var suffix = 'ago';
|
|
if (ms < 0) { ms = -ms; suffix = 'from now'; }
|
|
var s = Math.floor(ms / 1000);
|
|
if (s < 60) return s + 's ' + suffix;
|
|
var m = Math.floor(s / 60);
|
|
if (m < 60) return m + 'm ' + suffix;
|
|
var h = Math.floor(m / 60);
|
|
if (h < 24) return h + 'h ' + suffix;
|
|
var d = Math.floor(h / 24);
|
|
if (d < 7) return d + 'd ' + suffix;
|
|
return Math.floor(d / 7) + 'w ' + suffix;
|
|
}
|
|
function tick() {
|
|
var now = Date.now();
|
|
document.querySelectorAll('time[data-rel-ts]').forEach(function (el) {
|
|
var t = Date.parse(el.getAttribute('data-rel-ts'));
|
|
if (!isNaN(t)) el.textContent = label(now - t);
|
|
});
|
|
}
|
|
tick();
|
|
setInterval(tick, 30000);
|
|
})();
|
|
</script>
|
|
</body>
|
|
</html>
|
|
{{end}}
|