From 1f1431344ccf31734a39b95c68b5f4f40e14268e Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Mon, 24 May 2021 12:40:36 +0100 Subject: [PATCH] Prevent flashing and intermittent errors when navigating to admin screens as a non admin --- .../builder/portal/manage/_layout.svelte | 18 +++ .../builder/portal/manage/auth/_layout.svelte | 14 --- .../portal/manage/email/_layout.svelte | 8 +- .../portal/manage/users/_layout.svelte | 14 --- .../portal/settings/organisation.svelte | 118 +++++++++--------- 5 files changed, 80 insertions(+), 92 deletions(-) create mode 100644 packages/builder/src/pages/builder/portal/manage/_layout.svelte delete mode 100644 packages/builder/src/pages/builder/portal/manage/auth/_layout.svelte delete mode 100644 packages/builder/src/pages/builder/portal/manage/users/_layout.svelte diff --git a/packages/builder/src/pages/builder/portal/manage/_layout.svelte b/packages/builder/src/pages/builder/portal/manage/_layout.svelte new file mode 100644 index 0000000000..356b362b0b --- /dev/null +++ b/packages/builder/src/pages/builder/portal/manage/_layout.svelte @@ -0,0 +1,18 @@ + + +{#if $auth.isAdmin} + + + +{/if} diff --git a/packages/builder/src/pages/builder/portal/manage/auth/_layout.svelte b/packages/builder/src/pages/builder/portal/manage/auth/_layout.svelte deleted file mode 100644 index 12cbf48b22..0000000000 --- a/packages/builder/src/pages/builder/portal/manage/auth/_layout.svelte +++ /dev/null @@ -1,14 +0,0 @@ - - - - - diff --git a/packages/builder/src/pages/builder/portal/manage/email/_layout.svelte b/packages/builder/src/pages/builder/portal/manage/email/_layout.svelte index 22e786bcb9..410a7d4ff2 100644 --- a/packages/builder/src/pages/builder/portal/manage/email/_layout.svelte +++ b/packages/builder/src/pages/builder/portal/manage/email/_layout.svelte @@ -1,11 +1,5 @@ diff --git a/packages/builder/src/pages/builder/portal/manage/users/_layout.svelte b/packages/builder/src/pages/builder/portal/manage/users/_layout.svelte deleted file mode 100644 index 8b8295d2a3..0000000000 --- a/packages/builder/src/pages/builder/portal/manage/users/_layout.svelte +++ /dev/null @@ -1,14 +0,0 @@ - - - - - diff --git a/packages/builder/src/pages/builder/portal/settings/organisation.svelte b/packages/builder/src/pages/builder/portal/settings/organisation.svelte index 938e48039e..046f55615b 100644 --- a/packages/builder/src/pages/builder/portal/settings/organisation.svelte +++ b/packages/builder/src/pages/builder/portal/settings/organisation.svelte @@ -17,9 +17,11 @@ import { writable } from "svelte/store" import { redirect } from "@roxi/routify" - // only admins allowed here - if (!$auth.isAdmin) { - $redirect("../../portal") + // Only admins allowed here + $: { + if (!$auth.isAdmin) { + $redirect("../../portal") + } } const values = writable({ @@ -70,68 +72,70 @@ } - - - Organisation - - Organisation settings is where you can edit your organisation name and - logo. You can also configure your platform URL and enable or disable - analytics. - - - - - Information - Here you can update your logo and organization name. - -
-
- - -
- -
- - - Platform - Here you can set up general platform settings. - -
-
- - -
-
- - +{#if $auth.isAdmin} + - Analytics - - If you would like to send analytics that help us make Budibase better, - please let us know below. + Organisation + + Organisation settings is where you can edit your organisation name and + logo. You can also configure your platform URL and enable or disable + analytics. + + + Information + Here you can update your logo and organization name. +
- - + + +
+
+ + + Platform + Here you can set up general platform settings. + +
+
+ + +
+
+ + + + Analytics + + If you would like to send analytics that help us make Budibase better, + please let us know below. + + +
+
+ + +
+
+
+
+ +
-
- -
-
+{/if}