1
0
Fork 0
mirror of synced 2024-07-14 18:55:45 +12:00

Update frontend

This commit is contained in:
Adria Navarro 2024-01-04 13:18:55 +01:00
parent 5dd3c7cada
commit 746178f169

View file

@ -4,6 +4,8 @@
const timeoutMs = 60000 // 1 minute const timeoutMs = 60000 // 1 minute
const loadTime = Date.now() const loadTime = Date.now()
let timedOut = false
async function checkMigrationsFinished() { async function checkMigrationsFinished() {
setTimeout(async () => { setTimeout(async () => {
const response = await API.getMigrationStatus() const response = await API.getMigrationStatus()
@ -11,7 +13,6 @@
if (loadTime + timeoutMs > Date.now()) { if (loadTime + timeoutMs > Date.now()) {
return checkMigrationsFinished() return checkMigrationsFinished()
} }
return migrationTimeout() return migrationTimeout()
} }
@ -22,16 +23,39 @@
checkMigrationsFinished() checkMigrationsFinished()
function migrationTimeout() { function migrationTimeout() {
// TODO timedOut = true
alert("Something went wrong 💀")
} }
</script> </script>
<div class="loading">Updating the system...</div> <div class="loading">
{#if !timedOut}
<p class="loading-message">
🛠️ We are updating the system. <br />Please wait, we will be back in a
second!
</p>
{:else}
<p class="loading-message timeout">
An error occurred. Please try again later.
</p>
{/if}
</div>
<style> <style>
.loading { .loading {
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center;
justify-content: center;
flex-direction: column;
gap: var(--spacing-xl);
height: 100vh;
margin: 0;
}
.loading-message {
text-align: center;
font-size: 18px;
}
.timeout {
color: rgb(196, 46, 46);
} }
</style> </style>