Merge: version badge partial on all full-page templates

This commit is contained in:
ZdenekSrotyr 2026-04-21 20:52:04 +02:00
commit 7553f77e55
10 changed files with 39 additions and 32 deletions

View file

@ -0,0 +1,26 @@
<div class="version-badge" style="position: fixed; bottom: 0.5rem; right: 0.75rem; font-size: 0.7rem; color: #888; background: rgba(255,255,255,0.85); padding: 0.25rem 0.5rem; border-radius: 0.25rem; z-index: 9999; pointer-events: auto;">
<span id="agnes-version-badge">Loading…</span>
</div>
<script>
(function() {
fetch('/api/version').then(r => r.ok ? r.json() : null).then(v => {
if (!v) return;
var el = document.getElementById('agnes-version-badge');
if (!el) return;
var deployed = new Date(v.deployed_at);
var s = Math.floor((Date.now() - deployed.getTime()) / 1000);
var rel = s < 60 ? s + 's ago'
: s < 3600 ? Math.floor(s/60) + 'm ago'
: s < 86400 ? Math.floor(s/3600) + 'h ago'
: Math.floor(s/86400) + 'd ago';
var tag = v.image_tag && v.image_tag !== 'unknown' ? ' · ' + v.image_tag : '';
el.textContent = v.channel + '-' + v.version + tag + ' · ' + rel;
el.title = 'version ' + v.version +
'\nchannel ' + v.channel +
'\nimage tag ' + v.image_tag +
'\ncommit ' + v.commit_sha +
'\nschema v' + v.schema_version +
'\ndeployed ' + v.deployed_at;
}).catch(function() {});
})();
</script>

View file

@ -2567,5 +2567,6 @@
// Expose mermaid globally for lazy rendering
window.mermaid = mermaid;
</script>
{% include "_version_badge.html" %}
</body>
</html>

View file

@ -860,8 +860,7 @@
<!-- FOOTER -->
<footer class="footer">
<a href="{{ url_for('dashboard') }}">Back to Dashboard</a>
</footer>
</footer>
<script>
/* ═══════════════════════════════════════════════════════════════
Admin Permissions - JavaScript
@ -1236,5 +1235,6 @@
loadPermissions();
</script>
{% include "_version_badge.html" %}
</body>
</html>

View file

@ -941,8 +941,7 @@
<!-- ═══════════════ FOOTER ═══════════════ -->
<footer class="footer">
<a href="{{ url_for('dashboard') }}">Back to Dashboard</a>
</footer>
</footer>
<script>
/* ═══════════════════════════════════════════════════════════════
Admin Tables - JavaScript
@ -1334,5 +1333,6 @@
loadRegistry();
</script>
{% include "_version_badge.html" %}
</body>
</html>

View file

@ -46,31 +46,8 @@
<footer>
<p>&copy; {{ now().year if now is defined else 2024 }} {{ config.INSTANCE_COPYRIGHT or 'AI Data Analyst' }}</p>
<p class="version-badge" style="font-size: 0.75rem; color: var(--muted, #888); margin-top: 0.5rem;">
<span id="agnes-version-badge">Loading version…</span>
</p>
</footer>
</div>
<script>
// Version badge — fetched from /api/version, no auth needed.
(function() {
fetch('/api/version').then(r => r.ok ? r.json() : null).then(v => {
if (!v) return;
const el = document.getElementById('agnes-version-badge');
if (!el) return;
const deployed = new Date(v.deployed_at);
const relative = (() => {
const s = Math.floor((Date.now() - deployed.getTime()) / 1000);
if (s < 60) return s + 's ago';
if (s < 3600) return Math.floor(s/60) + 'm ago';
if (s < 86400) return Math.floor(s/3600) + 'h ago';
return Math.floor(s/86400) + 'd ago';
})();
const tag = v.image_tag && v.image_tag !== 'unknown' ? ' · ' + v.image_tag : '';
el.textContent = `${v.channel}-${v.version}${tag} · deployed ${relative} (${deployed.toISOString().slice(0,19).replace('T',' ')}Z)`;
el.title = `version ${v.version}\nchannel ${v.channel}\nimage tag ${v.image_tag}\ncommit ${v.commit_sha}\nschema v${v.schema_version}\ndeployed at ${v.deployed_at}`;
}).catch(() => {});
})();
</script>
{% include "_version_badge.html" %}
</body>
</html>

View file

@ -22,5 +22,6 @@
{% endwith %}
{% block content %}{% endblock %}
{% include "_version_badge.html" %}
</body>
</html>

View file

@ -1748,8 +1748,7 @@
<footer class="footer">
<p>&copy; {{ config.INSTANCE_COPYRIGHT or 'AI Data Analyst' }} &middot; Updated daily</p>
</footer>
</footer>
<script>
/* ═══════════════ ACCORDION ═══════════════ */
function toggleAccordion(trigger) {
@ -2761,5 +2760,6 @@ async function submitAccessRequest() {
// Expose mermaid globally for lazy rendering
window.mermaid = mermaid;
</script>
{% include "_version_badge.html" %}
</body>
</html>

View file

@ -861,5 +861,6 @@
return div.innerHTML;
}
</script>
{% include "_version_badge.html" %}
</body>
</html>

View file

@ -1552,5 +1552,6 @@
loadReviewQueue(0);
</script>
{% include "_version_badge.html" %}
</body>
</html>

View file

@ -2378,8 +2378,7 @@
<footer class="footer">
<p>&copy; {{ now().year if now is defined else 2024 }} {{ config.INSTANCE_COPYRIGHT or 'AI Data Analyst' }}</p>
</footer>
</footer>
<script>
function copyToClipboard(text) {
if (navigator.clipboard && window.isSecureContext) {
@ -2574,5 +2573,6 @@
}
}
</script>
{% include "_version_badge.html" %}
</body>
</html>