time local

This commit is contained in:
2026-04-20 09:04:02 +02:00
parent c7ff9f162c
commit 31e7b93546

View File

@@ -59,7 +59,7 @@
<div class="card stat-card text-center py-3 h-100"> <div class="card stat-card text-center py-3 h-100">
<div class="fs-6 fw-semibold text-secondary"> <div class="fs-6 fw-semibold text-secondary">
{% set last_fetch = logs | selectattr('event_type', 'equalto', 'yodeck_fetch') | first %} {% set last_fetch = logs | selectattr('event_type', 'equalto', 'yodeck_fetch') | first %}
{% if last_fetch %}{{ last_fetch.timestamp[:19] }} UTC{% else %}—{% endif %} {% if last_fetch %}<span class="local-time" data-utc="{{ last_fetch.timestamp }}">{{ last_fetch.timestamp[:19] }}</span>{% else %}—{% endif %}
</div> </div>
<div class="text-muted small">Last API Fetch</div> <div class="text-muted small">Last API Fetch</div>
</div> </div>
@@ -86,7 +86,7 @@
<th>Workspace</th> <th>Workspace</th>
<th>Type</th> <th>Type</th>
<th>Status</th> <th>Status</th>
<th>Last Seen (UTC)</th> <th>Last Seen</th>
<th>Last Pushed</th> <th>Last Pushed</th>
<th>Status Updated</th> <th>Status Updated</th>
<th>Resolution</th> <th>Resolution</th>
@@ -112,9 +112,9 @@
<span class="offline">● Offline</span> <span class="offline">● Offline</span>
{% endif %} {% endif %}
</td> </td>
<td class="font-monospace small">{{ (p.last_seen or '—')[:19] }}</td> <td class="font-monospace small">{% if p.last_seen %}<span class="local-time" data-utc="{{ p.last_seen }}">{{ p.last_seen[:19] }}</span>{% else %}—{% endif %}</td>
<td class="font-monospace small">{{ (p.last_pushed or '—')[:19] }}</td> <td class="font-monospace small">{% if p.last_pushed %}<span class="local-time" data-utc="{{ p.last_pushed }}">{{ p.last_pushed[:19] }}</span>{% else %}—{% endif %}</td>
<td class="font-monospace small">{{ (p.status_last_updated or '—')[:19] }}</td> <td class="font-monospace small">{% if p.status_last_updated %}<span class="local-time" data-utc="{{ p.status_last_updated }}">{{ p.status_last_updated[:19] }}</span>{% else %}—{% endif %}</td>
<td class="small">{{ p.screen_resolution or '—' }}</td> <td class="small">{{ p.screen_resolution or '—' }}</td>
<td class="small">{{ p.hardware_version or '—' }}</td> <td class="small">{{ p.hardware_version or '—' }}</td>
<td class="font-monospace small">{{ p.last_ip_address or '—' }}</td> <td class="font-monospace small">{{ p.last_ip_address or '—' }}</td>
@@ -140,7 +140,7 @@
<table class="table table-sm table-hover mb-0"> <table class="table table-sm table-hover mb-0">
<thead class="table-dark sticky-top"> <thead class="table-dark sticky-top">
<tr> <tr>
<th style="width:180px">Timestamp (UTC)</th> <th style="width:180px">Timestamp</th>
<th style="width:160px">Event</th> <th style="width:160px">Event</th>
<th>Message</th> <th>Message</th>
</tr> </tr>
@@ -148,7 +148,7 @@
<tbody> <tbody>
{% for l in logs %} {% for l in logs %}
<tr> <tr>
<td class="font-monospace small text-muted">{{ l.timestamp[:19] }}</td> <td class="font-monospace small text-muted"><span class="local-time" data-utc="{{ l.timestamp }}">{{ l.timestamp[:19] }}</span></td>
<td> <td>
<span class="badge badge-{{ l.event_type }}">{{ l.event_type }}</span> <span class="badge badge-{{ l.event_type }}">{{ l.event_type }}</span>
</td> </td>
@@ -171,6 +171,26 @@
</div> </div>
<script> <script>
const TZ = 'Europe/Vienna';
const dtFmt = new Intl.DateTimeFormat('sv-SE', {
timeZone: TZ,
year: 'numeric', month: '2-digit', day: '2-digit',
hour: '2-digit', minute: '2-digit', second: '2-digit',
hour12: false,
});
function toVienna(isoStr) {
try {
const d = new Date(isoStr);
if (isNaN(d)) return isoStr;
return dtFmt.format(d).replace('T', ' ');
} catch { return isoStr; }
}
document.querySelectorAll('.local-time').forEach(el => {
el.textContent = toVienna(el.dataset.utc);
});
let offlineFilter = false; let offlineFilter = false;
function applyFilter() { function applyFilter() {