Show devtools even in client app error states, to fix being locked out when changing to a public preview

This commit is contained in:
Andrew Kingston 2022-06-09 15:55:59 +01:00
parent 13c3390da5
commit eeb0a9fc64
2 changed files with 66 additions and 64 deletions

View File

@ -120,22 +120,6 @@
>
<DeviceBindingsProvider>
<UserBindingsProvider>
{#if permissionError}
<div class="error-wrapper">
{#if showDevTools}
<DevToolsHeader />
{/if}
<div class="error">
<Layout justifyItems="center" gap="S">
{@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>
</div>
{:else if $screenStore.activeLayout}
<StateBindingsProvider>
<RowSelectionProvider>
<!-- Settings bar can be rendered outside of device preview -->
@ -160,6 +144,31 @@
{/if}
<div id="app-body">
{#if permissionError}
<div class="error">
<Layout justifyItems="center" gap="S">
{@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">
{@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}
<CustomThemeWrapper>
{#key $screenStore.activeLayout._id}
<Component
@ -183,6 +192,7 @@
<ConfirmationDisplay />
<PeekScreenDisplay />
</CustomThemeWrapper>
{/if}
{#if showDevTools}
<DevTools />
@ -203,7 +213,6 @@
</div>
</RowSelectionProvider>
</StateBindingsProvider>
{/if}
</UserBindingsProvider>
</DeviceBindingsProvider>
</div>
@ -253,10 +262,6 @@
overflow: hidden;
}
.error-wrapper {
width: 100%;
height: 100%;
}
.error {
width: 100%;
height: 100%;

View File

@ -1,6 +1,4 @@
import { get } from "svelte/store"
import { createLocalStorageStore } from "@budibase/frontend-core"
import { appStore } from "./app"
import { initialise } from "./initialise"
import { authStore } from "./auth"
import { API } from "../api"
@ -13,8 +11,7 @@ const initialState = {
}
const createDevToolStore = () => {
const localStorageKey = `${get(appStore).appId}.devTools`
const store = createLocalStorageStore(localStorageKey, initialState)
const store = createLocalStorageStore("bb-devtools", initialState)
const setEnabled = enabled => {
store.update(state => ({