Prevent flashing and intermittent errors when navigating to admin screens as a non admin
This commit is contained in:
parent
0838a45efc
commit
1f1431344c
|
@ -0,0 +1,18 @@
|
||||||
|
<script>
|
||||||
|
import { Page } from "@budibase/bbui"
|
||||||
|
import { auth } from "stores/portal"
|
||||||
|
import { redirect } from "@roxi/routify"
|
||||||
|
|
||||||
|
// Only admins allowed here
|
||||||
|
$: {
|
||||||
|
if (!$auth.isAdmin) {
|
||||||
|
$redirect("../")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{#if $auth.isAdmin}
|
||||||
|
<Page>
|
||||||
|
<slot />
|
||||||
|
</Page>
|
||||||
|
{/if}
|
|
@ -1,14 +0,0 @@
|
||||||
<script>
|
|
||||||
import { redirect } from "@roxi/routify"
|
|
||||||
import { Page } from "@budibase/bbui"
|
|
||||||
import { auth } from "../../../../../stores/portal"
|
|
||||||
|
|
||||||
// only admins allowed here
|
|
||||||
if (!$auth.isAdmin) {
|
|
||||||
$redirect("../../../portal")
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<Page>
|
|
||||||
<slot />
|
|
||||||
</Page>
|
|
|
@ -1,11 +1,5 @@
|
||||||
<script>
|
<script>
|
||||||
import { redirect } from "@roxi/routify"
|
import { email } from "stores/portal"
|
||||||
import { auth, email } from "stores/portal"
|
|
||||||
|
|
||||||
// only admins allowed here
|
|
||||||
if (!$auth.isAdmin) {
|
|
||||||
$redirect("../../../portal")
|
|
||||||
}
|
|
||||||
|
|
||||||
email.templates.fetch()
|
email.templates.fetch()
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -1,14 +0,0 @@
|
||||||
<script>
|
|
||||||
import { Page } from "@budibase/bbui"
|
|
||||||
import { auth } from "../../../../../stores/portal"
|
|
||||||
import { redirect } from "@roxi/routify"
|
|
||||||
|
|
||||||
// only admins allowed here
|
|
||||||
if (!$auth.isAdmin) {
|
|
||||||
$redirect("../../../portal")
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<Page>
|
|
||||||
<slot />
|
|
||||||
</Page>
|
|
|
@ -17,9 +17,11 @@
|
||||||
import { writable } from "svelte/store"
|
import { writable } from "svelte/store"
|
||||||
import { redirect } from "@roxi/routify"
|
import { redirect } from "@roxi/routify"
|
||||||
|
|
||||||
// only admins allowed here
|
// Only admins allowed here
|
||||||
if (!$auth.isAdmin) {
|
$: {
|
||||||
$redirect("../../portal")
|
if (!$auth.isAdmin) {
|
||||||
|
$redirect("../../portal")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const values = writable({
|
const values = writable({
|
||||||
|
@ -70,68 +72,70 @@
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Layout>
|
{#if $auth.isAdmin}
|
||||||
<Layout gap="XS" noPadding>
|
<Layout>
|
||||||
<Heading size="M">Organisation</Heading>
|
|
||||||
<Body>
|
|
||||||
Organisation settings is where you can edit your organisation name and
|
|
||||||
logo. You can also configure your platform URL and enable or disable
|
|
||||||
analytics.
|
|
||||||
</Body>
|
|
||||||
</Layout>
|
|
||||||
<Divider size="S" />
|
|
||||||
<Layout gap="XS" noPadding>
|
|
||||||
<Heading size="S">Information</Heading>
|
|
||||||
<Body size="S">Here you can update your logo and organization name.</Body>
|
|
||||||
</Layout>
|
|
||||||
<div class="fields">
|
|
||||||
<div class="field">
|
|
||||||
<Label size="L">Organization name</Label>
|
|
||||||
<Input thin bind:value={$values.company} />
|
|
||||||
</div>
|
|
||||||
<div class="field logo">
|
|
||||||
<Label size="L">Logo</Label>
|
|
||||||
<div class="file">
|
|
||||||
<Dropzone
|
|
||||||
value={[$values.logo]}
|
|
||||||
on:change={e => {
|
|
||||||
$values.logo = e.detail?.[0]
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<Divider size="S" />
|
|
||||||
<Layout gap="XS" noPadding>
|
|
||||||
<Heading size="S">Platform</Heading>
|
|
||||||
<Body size="S">Here you can set up general platform settings.</Body>
|
|
||||||
</Layout>
|
|
||||||
<div class="fields">
|
|
||||||
<div class="field">
|
|
||||||
<Label size="L">Platform URL</Label>
|
|
||||||
<Input thin bind:value={$values.platformUrl} />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<Divider size="S" />
|
|
||||||
<Layout gap="S" noPadding>
|
|
||||||
<Layout gap="XS" noPadding>
|
<Layout gap="XS" noPadding>
|
||||||
<Heading size="S">Analytics</Heading>
|
<Heading size="M">Organisation</Heading>
|
||||||
<Body size="S">
|
<Body>
|
||||||
If you would like to send analytics that help us make Budibase better,
|
Organisation settings is where you can edit your organisation name and
|
||||||
please let us know below.
|
logo. You can also configure your platform URL and enable or disable
|
||||||
|
analytics.
|
||||||
</Body>
|
</Body>
|
||||||
</Layout>
|
</Layout>
|
||||||
|
<Divider size="S" />
|
||||||
|
<Layout gap="XS" noPadding>
|
||||||
|
<Heading size="S">Information</Heading>
|
||||||
|
<Body size="S">Here you can update your logo and organization name.</Body>
|
||||||
|
</Layout>
|
||||||
<div class="fields">
|
<div class="fields">
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<Label size="L">Send Analytics to Budibase</Label>
|
<Label size="L">Organization name</Label>
|
||||||
<Toggle text="" bind:value={$values.analytics} />
|
<Input thin bind:value={$values.company} />
|
||||||
|
</div>
|
||||||
|
<div class="field logo">
|
||||||
|
<Label size="L">Logo</Label>
|
||||||
|
<div class="file">
|
||||||
|
<Dropzone
|
||||||
|
value={[$values.logo]}
|
||||||
|
on:change={e => {
|
||||||
|
$values.logo = e.detail?.[0]
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<Divider size="S" />
|
||||||
|
<Layout gap="XS" noPadding>
|
||||||
|
<Heading size="S">Platform</Heading>
|
||||||
|
<Body size="S">Here you can set up general platform settings.</Body>
|
||||||
|
</Layout>
|
||||||
|
<div class="fields">
|
||||||
|
<div class="field">
|
||||||
|
<Label size="L">Platform URL</Label>
|
||||||
|
<Input thin bind:value={$values.platformUrl} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<Divider size="S" />
|
||||||
|
<Layout gap="S" noPadding>
|
||||||
|
<Layout gap="XS" noPadding>
|
||||||
|
<Heading size="S">Analytics</Heading>
|
||||||
|
<Body size="S">
|
||||||
|
If you would like to send analytics that help us make Budibase better,
|
||||||
|
please let us know below.
|
||||||
|
</Body>
|
||||||
|
</Layout>
|
||||||
|
<div class="fields">
|
||||||
|
<div class="field">
|
||||||
|
<Label size="L">Send Analytics to Budibase</Label>
|
||||||
|
<Toggle text="" bind:value={$values.analytics} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</Layout>
|
||||||
|
<div>
|
||||||
|
<Button disabled={loading} on:click={saveConfig} cta>Save</Button>
|
||||||
|
</div>
|
||||||
</Layout>
|
</Layout>
|
||||||
<div>
|
{/if}
|
||||||
<Button disabled={loading} on:click={saveConfig} cta>Save</Button>
|
|
||||||
</div>
|
|
||||||
</Layout>
|
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.fields {
|
.fields {
|
||||||
|
|
Loading…
Reference in New Issue