From 5ab0e2ecdceec1a97754a2253350fd186f844711 Mon Sep 17 00:00:00 2001 From: Akis Date: Tue, 13 Dec 2022 17:37:58 +0200 Subject: [PATCH] adjust to new api --- src/routes/instances/+page.server.ts | 5 +- src/routes/instances/+page.svelte | 98 +++++++++++++++------------- 2 files changed, 57 insertions(+), 46 deletions(-) diff --git a/src/routes/instances/+page.server.ts b/src/routes/instances/+page.server.ts index 7e20563..da85d5b 100644 --- a/src/routes/instances/+page.server.ts +++ b/src/routes/instances/+page.server.ts @@ -2,5 +2,8 @@ import type { PageServerLoad } from "./$types"; import { env } from "$env/dynamic/private"; export const load: PageServerLoad = async () => { - return await fetch(env.VITE_API_URL + "/api/v1/status").then((res) => res.json()); + return { + state: await fetch(env.VITE_API_URL + "/api/v1/state/status").then((res) => res.json()), + instances: await fetch(env.VITE_API_URL + "/api/v1/status").then((res) => res.json()) + } } \ No newline at end of file diff --git a/src/routes/instances/+page.svelte b/src/routes/instances/+page.svelte index 0e8c374..f2e1506 100644 --- a/src/routes/instances/+page.svelte +++ b/src/routes/instances/+page.svelte @@ -13,52 +13,60 @@

Our instances

-
- -
- {#each data.status as group} -

{group.name}

-
- {#each group.data as item} - - - - {#if item.us} - - {/if} +{#if data.state.enabled} +
+ +
+ {#each data.instances.status as group} +

{group.name}

+
+ {#each group.data as item} + + + - {#if item.bp} - - {/if} - - - {/each} -
- {/each} -
-
- - Last updated: {dayjs - .unix(data.updated) - .format("DD/MM/YYYY HH:mm:ss")} - -
+ {#if item.us} + + {/if} - + + {:else} +
+
+ Instances are currently disabled. +
+{/if}