first commit
This commit is contained in:
commit
d6414d4343
23 files changed
+2156
No files matched your search
@@ -0,0 +1,40 @@
|
||||
<script lang="ts">
|
||||
import { onMount, onDestroy } from "svelte";
|
||||
|
||||
let stats = $state(null);
|
||||
let services = $state([]);
|
||||
let interval: ReturnType<typeof setInterval>;
|
||||
|
||||
async function fetchAll() {
|
||||
const [s, sv] = await Promise.all([
|
||||
fetch("/api/stats").then((r) => r.json()),
|
||||
fetch("/api/services").then((r) => r.json()),
|
||||
]);
|
||||
stats = s;
|
||||
services = sv;
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
fetchAll();
|
||||
interval = setInterval(fetchAll, 5000);
|
||||
});
|
||||
|
||||
onDestroy(() => clearInterval(interval));
|
||||
</script>
|
||||
|
||||
<h1>Hi Niggas</h1>
|
||||
|
||||
<h2>services</h2>
|
||||
|
||||
<ul>
|
||||
{#each services as service}
|
||||
<li>{service.name}: {service.status}</li>
|
||||
{/each}
|
||||
</ul>
|
||||
|
||||
<h2>stats</h2>
|
||||
<ul>
|
||||
{#each stats as stat}
|
||||
<li>{stat.name}: {stat.value}</li>
|
||||
{/each}
|
||||
</ul>
|
||||
Reference in new issue
Block a user