Create app user facing maintenance page.
This commit is contained in:
parent
02158a0fb1
commit
fcd7ee10f1
|
@ -3,6 +3,12 @@
|
||||||
import { Heading, Body, Button, Layout } from "@budibase/bbui"
|
import { Heading, Body, Button, Layout } from "@budibase/bbui"
|
||||||
import { admin } from "stores/portal"
|
import { admin } from "stores/portal"
|
||||||
import BudibaseLogo from "../portal/_components/BudibaseLogo.svelte"
|
import BudibaseLogo from "../portal/_components/BudibaseLogo.svelte"
|
||||||
|
|
||||||
|
$: {
|
||||||
|
if ($admin.maintenance.length === 0) {
|
||||||
|
window.location = "/builder"
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="main">
|
<div class="main">
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
appStore,
|
appStore,
|
||||||
devToolsStore,
|
devToolsStore,
|
||||||
devToolsEnabled,
|
devToolsEnabled,
|
||||||
|
environmentStore,
|
||||||
} from "stores"
|
} from "stores"
|
||||||
import NotificationDisplay from "components/overlay/NotificationDisplay.svelte"
|
import NotificationDisplay from "components/overlay/NotificationDisplay.svelte"
|
||||||
import ConfirmationDisplay from "components/overlay/ConfirmationDisplay.svelte"
|
import ConfirmationDisplay from "components/overlay/ConfirmationDisplay.svelte"
|
||||||
|
@ -36,6 +37,7 @@
|
||||||
import DevToolsHeader from "components/devtools/DevToolsHeader.svelte"
|
import DevToolsHeader from "components/devtools/DevToolsHeader.svelte"
|
||||||
import DevTools from "components/devtools/DevTools.svelte"
|
import DevTools from "components/devtools/DevTools.svelte"
|
||||||
import FreeFooter from "components/FreeFooter.svelte"
|
import FreeFooter from "components/FreeFooter.svelte"
|
||||||
|
import MaintenanceScreen from "components/MaintenanceScreen.svelte"
|
||||||
import licensing from "../licensing"
|
import licensing from "../licensing"
|
||||||
|
|
||||||
// Provide contexts
|
// Provide contexts
|
||||||
|
@ -111,122 +113,128 @@
|
||||||
class="spectrum spectrum--medium {$themeStore.baseTheme} {$themeStore.theme}"
|
class="spectrum spectrum--medium {$themeStore.baseTheme} {$themeStore.theme}"
|
||||||
class:builder={$builderStore.inBuilder}
|
class:builder={$builderStore.inBuilder}
|
||||||
>
|
>
|
||||||
<DeviceBindingsProvider>
|
{#if $environmentStore.maintenance.length > 0}
|
||||||
<UserBindingsProvider>
|
<MaintenanceScreen maintenanceList={$environmentStore.maintenance} />
|
||||||
<StateBindingsProvider>
|
{:else}
|
||||||
<RowSelectionProvider>
|
<DeviceBindingsProvider>
|
||||||
<QueryParamsProvider>
|
<UserBindingsProvider>
|
||||||
<!-- Settings bar can be rendered outside of device preview -->
|
<StateBindingsProvider>
|
||||||
<!-- Key block needs to be outside the if statement or it breaks -->
|
<RowSelectionProvider>
|
||||||
{#key $builderStore.selectedComponentId}
|
<QueryParamsProvider>
|
||||||
{#if $builderStore.inBuilder}
|
<!-- Settings bar can be rendered outside of device preview -->
|
||||||
<SettingsBar />
|
<!-- Key block needs to be outside the if statement or it breaks -->
|
||||||
{/if}
|
{#key $builderStore.selectedComponentId}
|
||||||
{/key}
|
{#if $builderStore.inBuilder}
|
||||||
|
<SettingsBar />
|
||||||
<!-- Clip boundary for selection indicators -->
|
|
||||||
<div
|
|
||||||
id="clip-root"
|
|
||||||
class:preview={$builderStore.inBuilder}
|
|
||||||
class:tablet-preview={$builderStore.previewDevice === "tablet"}
|
|
||||||
class:mobile-preview={$builderStore.previewDevice === "mobile"}
|
|
||||||
>
|
|
||||||
<!-- Actual app -->
|
|
||||||
<div id="app-root">
|
|
||||||
{#if showDevTools}
|
|
||||||
<DevToolsHeader />
|
|
||||||
{/if}
|
{/if}
|
||||||
|
{/key}
|
||||||
|
|
||||||
<div id="app-body">
|
<!-- Clip boundary for selection indicators -->
|
||||||
{#if permissionError}
|
<div
|
||||||
<div class="error">
|
id="clip-root"
|
||||||
<Layout justifyItems="center" gap="S">
|
class:preview={$builderStore.inBuilder}
|
||||||
<!-- eslint-disable-next-line svelte/no-at-html-tags -->
|
class:tablet-preview={$builderStore.previewDevice ===
|
||||||
{@html ErrorSVG}
|
"tablet"}
|
||||||
<Heading size="L">
|
class:mobile-preview={$builderStore.previewDevice ===
|
||||||
You don't have permission to use this app
|
"mobile"}
|
||||||
</Heading>
|
>
|
||||||
<Body size="S">
|
<!-- Actual app -->
|
||||||
Ask your administrator to grant you access
|
<div id="app-root">
|
||||||
</Body>
|
{#if showDevTools}
|
||||||
</Layout>
|
<DevToolsHeader />
|
||||||
</div>
|
{/if}
|
||||||
{:else if !$screenStore.activeLayout}
|
|
||||||
<div class="error">
|
|
||||||
<Layout justifyItems="center" gap="S">
|
|
||||||
<!-- eslint-disable-next-line svelte/no-at-html-tags -->
|
|
||||||
{@html ErrorSVG}
|
|
||||||
<Heading size="L">
|
|
||||||
Something went wrong rendering your app
|
|
||||||
</Heading>
|
|
||||||
<Body size="S">
|
|
||||||
Get in touch with support if this issue persists
|
|
||||||
</Body>
|
|
||||||
</Layout>
|
|
||||||
</div>
|
|
||||||
{:else if embedNoScreens}
|
|
||||||
<div class="error">
|
|
||||||
<Layout justifyItems="center" gap="S">
|
|
||||||
<!-- eslint-disable-next-line svelte/no-at-html-tags -->
|
|
||||||
{@html ErrorSVG}
|
|
||||||
<Heading size="L">
|
|
||||||
This Budibase app is not publicly accessible
|
|
||||||
</Heading>
|
|
||||||
</Layout>
|
|
||||||
</div>
|
|
||||||
{:else}
|
|
||||||
<CustomThemeWrapper>
|
|
||||||
{#key $screenStore.activeLayout._id}
|
|
||||||
<Component
|
|
||||||
isLayout
|
|
||||||
instance={$screenStore.activeLayout.props}
|
|
||||||
/>
|
|
||||||
{/key}
|
|
||||||
|
|
||||||
<!--
|
<div id="app-body">
|
||||||
|
{#if permissionError}
|
||||||
|
<div class="error">
|
||||||
|
<Layout justifyItems="center" gap="S">
|
||||||
|
<!-- eslint-disable-next-line svelte/no-at-html-tags -->
|
||||||
|
{@html ErrorSVG}
|
||||||
|
<Heading size="L">
|
||||||
|
You don't have permission to use this app
|
||||||
|
</Heading>
|
||||||
|
<Body size="S">
|
||||||
|
Ask your administrator to grant you access
|
||||||
|
</Body>
|
||||||
|
</Layout>
|
||||||
|
</div>
|
||||||
|
{:else if !$screenStore.activeLayout}
|
||||||
|
<div class="error">
|
||||||
|
<Layout justifyItems="center" gap="S">
|
||||||
|
<!-- eslint-disable-next-line svelte/no-at-html-tags -->
|
||||||
|
{@html ErrorSVG}
|
||||||
|
<Heading size="L">
|
||||||
|
Something went wrong rendering your app
|
||||||
|
</Heading>
|
||||||
|
<Body size="S">
|
||||||
|
Get in touch with support if this issue persists
|
||||||
|
</Body>
|
||||||
|
</Layout>
|
||||||
|
</div>
|
||||||
|
{:else if embedNoScreens}
|
||||||
|
<div class="error">
|
||||||
|
<Layout justifyItems="center" gap="S">
|
||||||
|
<!-- eslint-disable-next-line svelte/no-at-html-tags -->
|
||||||
|
{@html ErrorSVG}
|
||||||
|
<Heading size="L">
|
||||||
|
This Budibase app is not publicly accessible
|
||||||
|
</Heading>
|
||||||
|
</Layout>
|
||||||
|
</div>
|
||||||
|
{:else}
|
||||||
|
<CustomThemeWrapper>
|
||||||
|
{#key $screenStore.activeLayout._id}
|
||||||
|
<Component
|
||||||
|
isLayout
|
||||||
|
instance={$screenStore.activeLayout.props}
|
||||||
|
/>
|
||||||
|
{/key}
|
||||||
|
|
||||||
|
<!--
|
||||||
Flatpickr needs to be inside the theme wrapper.
|
Flatpickr needs to be inside the theme wrapper.
|
||||||
It also needs its own container because otherwise it hijacks
|
It also needs its own container because otherwise it hijacks
|
||||||
key events on the whole page. It is painful to work with.
|
key events on the whole page. It is painful to work with.
|
||||||
-->
|
-->
|
||||||
<div id="flatpickr-root" />
|
<div id="flatpickr-root" />
|
||||||
|
|
||||||
<!-- Modal container to ensure they sit on top -->
|
<!-- Modal container to ensure they sit on top -->
|
||||||
<div class="modal-container" />
|
<div class="modal-container" />
|
||||||
|
|
||||||
<!-- Layers on top of app -->
|
<!-- Layers on top of app -->
|
||||||
<NotificationDisplay />
|
<NotificationDisplay />
|
||||||
<ConfirmationDisplay />
|
<ConfirmationDisplay />
|
||||||
<PeekScreenDisplay />
|
<PeekScreenDisplay />
|
||||||
</CustomThemeWrapper>
|
</CustomThemeWrapper>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{#if showDevTools}
|
{#if showDevTools}
|
||||||
<DevTools />
|
<DevTools />
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{#if !$builderStore.inBuilder && licensing.logoEnabled()}
|
||||||
|
<FreeFooter />
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{#if !$builderStore.inBuilder && licensing.logoEnabled()}
|
<!-- Preview and dev tools utilities -->
|
||||||
<FreeFooter />
|
{#if $appStore.isDevApp}
|
||||||
|
<SelectionIndicator />
|
||||||
|
{/if}
|
||||||
|
{#if $builderStore.inBuilder || $devToolsStore.allowSelection}
|
||||||
|
<HoverIndicator />
|
||||||
|
{/if}
|
||||||
|
{#if $builderStore.inBuilder}
|
||||||
|
<DNDHandler />
|
||||||
|
<GridDNDHandler />
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
</QueryParamsProvider>
|
||||||
<!-- Preview and dev tools utilities -->
|
</RowSelectionProvider>
|
||||||
{#if $appStore.isDevApp}
|
</StateBindingsProvider>
|
||||||
<SelectionIndicator />
|
</UserBindingsProvider>
|
||||||
{/if}
|
</DeviceBindingsProvider>
|
||||||
{#if $builderStore.inBuilder || $devToolsStore.allowSelection}
|
{/if}
|
||||||
<HoverIndicator />
|
|
||||||
{/if}
|
|
||||||
{#if $builderStore.inBuilder}
|
|
||||||
<DNDHandler />
|
|
||||||
<GridDNDHandler />
|
|
||||||
{/if}
|
|
||||||
</div>
|
|
||||||
</QueryParamsProvider>
|
|
||||||
</RowSelectionProvider>
|
|
||||||
</StateBindingsProvider>
|
|
||||||
</UserBindingsProvider>
|
|
||||||
</DeviceBindingsProvider>
|
|
||||||
</div>
|
</div>
|
||||||
<KeyboardManager />
|
<KeyboardManager />
|
||||||
{/if}
|
{/if}
|
||||||
|
|
|
@ -1,6 +1,17 @@
|
||||||
|
<!--
|
||||||
|
This is the public facing maintenance screen. It is displayed when there is
|
||||||
|
required maintenance to be done on the Budibase installation. We only use this
|
||||||
|
if we detect that the Budibase installation is in a state where the vast
|
||||||
|
majority of apps would not function correctly.
|
||||||
|
|
||||||
|
The builder-facing maintenance screen is in
|
||||||
|
packages/builder/src/pages/builder/maintenance/index.svelte, and tends to
|
||||||
|
contain more detailed information and actions for the installation owner to
|
||||||
|
take.
|
||||||
|
-->
|
||||||
<script>
|
<script>
|
||||||
import { MaintenanceType } from "@budibase/types"
|
import { MaintenanceType } from "@budibase/types"
|
||||||
import { Heading, Body, Button, Layout } from "@budibase/bbui"
|
import { Heading, Body, Layout } from "@budibase/bbui"
|
||||||
|
|
||||||
export let maintenanceList
|
export let maintenanceList
|
||||||
</script>
|
</script>
|
||||||
|
@ -11,22 +22,14 @@
|
||||||
{#each maintenanceList as maintenance}
|
{#each maintenanceList as maintenance}
|
||||||
{#if maintenance.type === MaintenanceType.SQS_MISSING}
|
{#if maintenance.type === MaintenanceType.SQS_MISSING}
|
||||||
<Layout>
|
<Layout>
|
||||||
<Heading>Please upgrade your Budibase installation</Heading>
|
<Heading>Budibase installation requires maintenance</Heading>
|
||||||
<Body>
|
<Body>
|
||||||
We've detected that the version of Budibase you're using depends
|
The administrator of this Budibase installation needs to take
|
||||||
on a more recent version of the CouchDB database than what you
|
actions to update components that are out of date. Please contact
|
||||||
have installed.
|
them and show them this warning. More information will be
|
||||||
</Body>
|
available when they log into their account.
|
||||||
<Body>
|
|
||||||
To resolve this, you can either rollback to a previous version of
|
|
||||||
Budibase, or follow the migration guide to update to a later
|
|
||||||
version of CouchDB.
|
|
||||||
</Body>
|
</Body>
|
||||||
</Layout>
|
</Layout>
|
||||||
<Button
|
|
||||||
on:click={() => (window.location = "https://docs.budibase.com")}
|
|
||||||
>Migration guide</Button
|
|
||||||
>
|
|
||||||
{/if}
|
{/if}
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import ClientApp from "./components/ClientApp.svelte"
|
import ClientApp from "./components/ClientApp.svelte"
|
||||||
import UpdatingApp from "./components/UpdatingApp.svelte"
|
import UpdatingApp from "./components/UpdatingApp.svelte"
|
||||||
import MaintenanceScreen from "./components/MaintenanceScreen.svelte"
|
|
||||||
import {
|
import {
|
||||||
builderStore,
|
builderStore,
|
||||||
appStore,
|
appStore,
|
||||||
|
@ -66,15 +65,6 @@ const loadBudibase = async () => {
|
||||||
await environmentStore.actions.fetchEnvironment()
|
await environmentStore.actions.fetchEnvironment()
|
||||||
}
|
}
|
||||||
|
|
||||||
const maintenanceList = get(environmentStore)?.maintenance
|
|
||||||
if (maintenanceList?.length > 0) {
|
|
||||||
new MaintenanceScreen({
|
|
||||||
target: window.document.body,
|
|
||||||
props: { maintenanceList },
|
|
||||||
})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Register handler for runtime events from the builder
|
// Register handler for runtime events from the builder
|
||||||
window.handleBuilderRuntimeEvent = (type, data) => {
|
window.handleBuilderRuntimeEvent = (type, data) => {
|
||||||
if (!window["##BUDIBASE_IN_BUILDER##"]) {
|
if (!window["##BUDIBASE_IN_BUILDER##"]) {
|
||||||
|
|
Loading…
Reference in New Issue