Added boot time to status page

This commit is contained in:
Gunnar Skjold 2023-03-30 09:44:41 +02:00
parent 061f6433d6
commit 3c86e824a2
5 changed files with 24 additions and 13 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -2,10 +2,11 @@
import { zeropad, monthnames } from './Helpers.js';
export let timestamp;
export let fullTimeColor;
</script>
{#if Math.abs(new Date().getTime()-timestamp.getTime()) < 300000 }
{`${zeropad(timestamp.getDate())}. ${monthnames[timestamp.getMonth()]} ${zeropad(timestamp.getHours())}:${zeropad(timestamp.getMinutes())}`}
{:else}
<span class="text-red-500">{`${zeropad(timestamp.getDate())}.${zeropad(timestamp.getMonth())}.${timestamp.getFullYear()} ${zeropad(timestamp.getHours())}:${zeropad(timestamp.getMinutes())}`}</span>
<span class="{fullTimeColor}">{`${zeropad(timestamp.getDate())}.${zeropad(timestamp.getMonth())}.${timestamp.getFullYear()} ${zeropad(timestamp.getHours())}:${zeropad(timestamp.getMinutes())}`}</span>
{/if}

View File

@ -73,7 +73,7 @@
<a class="float-right" href='https://github.com/UtilitechAS/amsreader-firmware' target='_blank' rel="noreferrer" aria-label="GitHub"><img class="gh-logo" src={GitHubLogo} alt="GitHub repo"/></a>
</div>
<div class="flex-none my-auto px-2">
<Clock timestamp={ data.c ? new Date(data.c * 1000) : new Date(0) } />
<Clock timestamp={ data.c ? new Date(data.c * 1000) : new Date(0) } fullTimeColor="text-red-500" />
</div>
{#if sysinfo.vndcfg && sysinfo.usrcfg}
<div class="flex-none px-1 mt-1" title="Configuration">

View File

@ -4,6 +4,7 @@
import { upgrade, getNextVersion, upgradeWarningText } from './UpgradeHelper';
import DownloadIcon from './DownloadIcon.svelte';
import { Link } from 'svelte-navigator';
import Clock from './Clock.svelte';
import Mask from './Mask.svelte';
export let data;
@ -103,7 +104,15 @@
AP MAC: {sysinfo.apmac}
</div>
<div class="my-2">
Last boot: {getResetReason(sysinfo)} ({sysinfo.boot_reason})
Last boot:
{#if data.u > 0}
<Clock timestamp={new Date(new Date().getTime() - (data.u * 1000))} fullTimeColor="" />
{:else}
-
{/if}
</div>
<div class="my-2">
Reason: {getResetReason(sysinfo)} ({sysinfo.boot_reason})
</div>
{/if}
<div class="my-2">