From 45a965b0411fb6cfad34bb6f3055e2362cc879b7 Mon Sep 17 00:00:00 2001 From: Michael Drury Date: Wed, 9 Feb 2022 23:16:24 +0000 Subject: [PATCH] Adding basic endpoints for API keys. --- packages/bbui/src/Modal/ModalContent.svelte | 4 +++ .../settings/UpdateAPIKeyModal.svelte | 30 +++++++++---------- .../src/pages/builder/apps/index.svelte | 11 ------- .../src/pages/builder/portal/_layout.svelte | 10 +++++++ .../src/api/controllers/global/users.js | 12 ++++++++ .../worker/src/api/routes/global/users.js | 3 ++ packages/worker/src/middleware/builderOnly.js | 9 ++++++ 7 files changed, 52 insertions(+), 27 deletions(-) create mode 100644 packages/worker/src/middleware/builderOnly.js diff --git a/packages/bbui/src/Modal/ModalContent.svelte b/packages/bbui/src/Modal/ModalContent.svelte index c18be1e4e1..9043fb748f 100644 --- a/packages/bbui/src/Modal/ModalContent.svelte +++ b/packages/bbui/src/Modal/ModalContent.svelte @@ -165,4 +165,8 @@ .secondary-action { margin-right: auto; } + + .spectrum-Dialog-buttonGroup { + padding-left: 0; + } diff --git a/packages/builder/src/components/settings/UpdateAPIKeyModal.svelte b/packages/builder/src/components/settings/UpdateAPIKeyModal.svelte index a63367cf4a..cb996df4f1 100644 --- a/packages/builder/src/components/settings/UpdateAPIKeyModal.svelte +++ b/packages/builder/src/components/settings/UpdateAPIKeyModal.svelte @@ -4,7 +4,6 @@ import { onMount } from "svelte" let apiKey = null - let loaded = false async function generateAPIKey() { try { @@ -16,21 +15,20 @@ } onMount(async () => { - apiKey = auth.fetchAPIKey() + apiKey = await auth.fetchAPIKey() }) -{#if loaded} - - - You can find information about your developer account here, such as the - API key used to access the Budibase API. - - - -{/if} + + + You can find information about your developer account here, such as the API + key used to access the Budibase API. + + + diff --git a/packages/builder/src/pages/builder/apps/index.svelte b/packages/builder/src/pages/builder/apps/index.svelte index 309e760ad1..39cc780ac7 100644 --- a/packages/builder/src/pages/builder/apps/index.svelte +++ b/packages/builder/src/pages/builder/apps/index.svelte @@ -19,14 +19,12 @@ import { gradient } from "actions" import UpdateUserInfoModal from "components/settings/UpdateUserInfoModal.svelte" import ChangePasswordModal from "components/settings/ChangePasswordModal.svelte" - import UpdateAPIKeyModal from "components/settings/UpdateAPIKeyModal.svelte" import { processStringSync } from "@budibase/string-templates" import Logo from "assets/bb-emblem.svg" let loaded = false let userInfoModal let changePasswordModal - let apiKeyModal onMount(async () => { try { @@ -83,12 +81,6 @@ userInfoModal.show()}> Update user information - apiKeyModal.show()} - > - View developer information - changePasswordModal.show()} @@ -163,9 +155,6 @@ - - - {/if}