Skip to content

Commit

Permalink
Fix api readyness (#76)
Browse files Browse the repository at this point in the history
* Fix the list of tables

* Re-added the not-ready display
  • Loading branch information
scmmmh authored Feb 2, 2024
1 parent 880bc9d commit 1edd98f
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 21 deletions.
2 changes: 1 addition & 1 deletion museum_map/__about__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__version__ = "0.9.1"
__tables__ = {"items", "floors", "rooms", "floors_items", "floor_topics", "groups"}
__tables__ = {"groups", "users", "floors_items", "floor_topics", "rooms", "floors", "log_entries", "items"}
1 change: 1 addition & 0 deletions museum_map/server/api/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""The main REST API."""

import logging
from typing import Annotated

Expand Down
38 changes: 18 additions & 20 deletions museum_map/server/frontend/src/Root.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import Research from "./components/Research.svelte";
import Reload from "./components/Reload.svelte";
import Demographics from "./routes/Demographics.svelte";
import NotReady from "./components/NotReady.svelte";
import { apiRequest } from "./util";
let Floor = null;
Expand All @@ -21,31 +22,28 @@
queryFn: apiRequest<APIStatus>,
refetchInterval: 60000,
});
const reloadRequired = derived(apiStatus, (apiStatus) => {
if (apiStatus.isSuccess && apiStatus.data.version !== "0.9.1") {
return true;
}
return false;
});
</script>

<div class="bg-neutral-600 min-h-screen">
{#if $apiStatus.isSuccess}
<main
class="container mx-auto bg-neutral-700 text-white shadow-lg shadow-black font-serif tracking-default"
>
<Route path="/"><Lobby /></Route>
<Route path="/floor/:fid"
>{#if Floor !== null}<svelte:component this={Floor} />{/if}</Route
{#if $apiStatus.data.ready}
<main
class="container mx-auto bg-neutral-700 text-white shadow-lg shadow-black font-serif tracking-default"
>
<Route path="/floor/:fid/room/:rid/*"><Room /></Route>
<Route path="/demographics"><Demographics /></Route>
<NotFoundRoute><Lobby /></NotFoundRoute>
</main>
<Research />
{#if $reloadRequired}
<Reload />
<Route path="/"><Lobby /></Route>
<Route path="/floor/:fid"
>{#if Floor !== null}<svelte:component this={Floor} />{/if}</Route
>
<Route path="/floor/:fid/room/:rid/*"><Room /></Route>
<Route path="/demographics"><Demographics /></Route>
<NotFoundRoute><Lobby /></NotFoundRoute>
</main>
<Research />
{#if $apiStatus.data.version !== "0.9.1"}
<Reload />
{/if}
{:else}
<NotReady />
{/if}
{:else if $apiStatus.isLoading}
<Loading />
Expand Down
19 changes: 19 additions & 0 deletions museum_map/server/frontend/src/components/NotReady.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<script lang="ts">
import { fade } from "svelte/transition";
</script>

<svelte:head>
<title>The Museum Map is currently not available</title>
</svelte:head>

<div
transition:fade
class="fixed left-1/2 top-1/2 transform -translate-x-1/2 -translate-y-1/2 z-50 max-w-full p-4 bg-neutral-700 text-white shadow-2xl rounded-2xl"
role="alert"
>
<p class="mb-2">Unfortuantely the Museum Map is currently not available.</p>
<p>
When the Museum Map becomes available, the interface will load
automatically.
</p>
</div>

0 comments on commit 1edd98f

Please sign in to comment.