Move updating page to the client

This commit is contained in:
Adria Navarro 2023-12-19 12:05:27 +01:00
parent 0b46b6883d
commit 75b8190c01
4 changed files with 20 additions and 4 deletions

View File

@ -1,3 +1,6 @@
<script>
</script>
<div class="loading">Updating the system...</div> <div class="loading">Updating the system...</div>
<style> <style>

View File

@ -1,4 +1,5 @@
import ClientApp from "./components/ClientApp.svelte" import ClientApp from "./components/ClientApp.svelte"
import UpdatingApp from "./components/UpdatingApp.svelte"
import { import {
builderStore, builderStore,
appStore, appStore,
@ -52,6 +53,13 @@ const loadBudibase = async () => {
window["##BUDIBASE_APP_EMBEDDED##"] === "true" window["##BUDIBASE_APP_EMBEDDED##"] === "true"
) )
if (window.MIGRATING_APP) {
new UpdatingApp({
target: window.document.body,
})
return
}
// Fetch environment info // Fetch environment info
if (!get(environmentStore)?.loaded) { if (!get(environmentStore)?.loaded) {
await environmentStore.actions.fetchEnvironment() await environmentStore.actions.fetchEnvironment()

View File

@ -156,10 +156,6 @@ export const serveApp = async function (ctx: Ctx) {
appHbsPath = join(__dirname, "templates", "app.hbs") appHbsPath = join(__dirname, "templates", "app.hbs")
} }
const App = !needMigrations
? require("./templates/BudibaseApp.svelte").default
: require("./templates/Updating.svelte").default
let db let db
try { try {
db = context.getAppDB({ skip_setup: true }) db = context.getAppDB({ skip_setup: true })
@ -168,6 +164,7 @@ export const serveApp = async function (ctx: Ctx) {
if (!env.isJest()) { if (!env.isJest()) {
const plugins = objectStore.enrichPluginURLs(appInfo.usedPlugins) const plugins = objectStore.enrichPluginURLs(appInfo.usedPlugins)
const App = require("./templates/BudibaseApp.svelte").default
const { head, html, css } = App.render({ const { head, html, css } = App.render({
metaImage: metaImage:
branding?.metaImageUrl || branding?.metaImageUrl ||
@ -188,6 +185,7 @@ export const serveApp = async function (ctx: Ctx) {
config?.logoUrl !== "" config?.logoUrl !== ""
? objectStore.getGlobalFileUrl("settings", "logoUrl") ? objectStore.getGlobalFileUrl("settings", "logoUrl")
: "", : "",
appMigrating: needMigrations,
}) })
const appHbs = loadHandlebarsFile(appHbsPath) const appHbs = loadHandlebarsFile(appHbsPath)
ctx.body = await processString(appHbs, { ctx.body = await processString(appHbs, {
@ -203,6 +201,7 @@ export const serveApp = async function (ctx: Ctx) {
} }
} catch (error) { } catch (error) {
if (!env.isJest()) { if (!env.isJest()) {
const App = require("./templates/BudibaseApp.svelte").default
const { head, html, css } = App.render({ const { head, html, css } = App.render({
title: branding?.metaTitle, title: branding?.metaTitle,
metaTitle: branding?.metaTitle, metaTitle: branding?.metaTitle,

View File

@ -8,6 +8,7 @@
export let clientLibPath export let clientLibPath
export let usedPlugins export let usedPlugins
export let appMigrating
</script> </script>
<svelte:head> <svelte:head>
@ -110,6 +111,11 @@
<script type="application/javascript"> <script type="application/javascript">
window.INIT_TIME = Date.now() window.INIT_TIME = Date.now()
</script> </script>
{#if appMigrating}
<script type="application/javascript">
window.MIGRATING_APP = true
</script>
{/if}
<script type="application/javascript" src={clientLibPath}> <script type="application/javascript" src={clientLibPath}>
</script> </script>
<!-- Custom components need inserted after the core client library --> <!-- Custom components need inserted after the core client library -->