Compare commits

...

2 commits

Author SHA1 Message Date
1ef21891f1
fix: remove now marker
wasnt clear and now its useless
2024-12-03 03:06:38 +01:00
c5f7a7092b
feat: add "h ago" marker 2024-12-03 03:06:16 +01:00

View file

@ -79,7 +79,6 @@
<p>%%DESCRIPTION%%</p> <p>%%DESCRIPTION%%</p>
</div> </div>
<hr class="color"/> <hr class="color"/>
<small style="display: block" class="rev">now --&gt;</small>
<main id="uppe-rs-content"> <main id="uppe-rs-content">
@ -101,6 +100,9 @@ function cell(timestamp, rtt) {
function card(key, history, last_rtt) { function card(key, history, last_rtt) {
let bar = ""; let bar = "";
let now = Math.floor(Date.now() / 1000);
let first = history[0][0];
let hrs_ago = (now - first) / 3600;
for (let el of history) { for (let el of history) {
bar += cell(el[0], el[1]); bar += cell(el[0], el[1]);
} }
@ -108,6 +110,7 @@ function card(key, history, last_rtt) {
<h3 class="mt-0">${key} <code class="color">${last_rtt ? last_rtt + 'ms' : 'DOWN'}</code></h3> <h3 class="mt-0">${key} <code class="color">${last_rtt ? last_rtt + 'ms' : 'DOWN'}</code></h3>
<div class="box"> <div class="box">
${bar} ${bar}
<p class="ma-0"><small>^ ~${hrs_ago.toFixed(1)}h ago</small></p>
</div> </div>
</div>`; </div>`;
} }