From ee94435c06055bbf00d7194ea94acfb0c8719721 Mon Sep 17 00:00:00 2001 From: Peter Clement Date: Mon, 30 Jan 2023 16:28:45 +0000 Subject: [PATCH 1/2] gate env vars for rest variables --- .../TableIntegrationMenu/rest/RestExtraConfigForm.svelte | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/builder/src/components/backend/DatasourceNavigator/TableIntegrationMenu/rest/RestExtraConfigForm.svelte b/packages/builder/src/components/backend/DatasourceNavigator/TableIntegrationMenu/rest/RestExtraConfigForm.svelte index 282ba712a6..60a7a9f30b 100644 --- a/packages/builder/src/components/backend/DatasourceNavigator/TableIntegrationMenu/rest/RestExtraConfigForm.svelte +++ b/packages/builder/src/components/backend/DatasourceNavigator/TableIntegrationMenu/rest/RestExtraConfigForm.svelte @@ -17,6 +17,7 @@ runtimeToReadableMap, } from "builderStore/dataBinding" import { cloneDeep } from "lodash/fp" + import { licensing } from "stores/portal" export let datasource export let queries @@ -94,7 +95,9 @@ headings bind:object={datasource.config.staticVariables} on:change - bindings={getEnvironmentBindings()} + bindings={$licensing.environmentVariablesEnabled + ? getEnvironmentBindings() + : []} />
From 71352f1ddc04ce6c0f7bf56cd7faf815456bf5a7 Mon Sep 17 00:00:00 2001 From: Peter Clement Date: Mon, 30 Jan 2023 16:30:51 +0000 Subject: [PATCH 2/2] add try catch to all environment variable loading --- .../automation/SetupPanel/AutomationBlockSetup.svelte | 6 +++++- .../TableIntegrationMenu/IntegrationConfigForm.svelte | 11 +++++++---- .../rest/auth/RestAuthenticationModal.svelte | 11 +++++++---- .../src/components/integration/KeyValueBuilder.svelte | 2 +- .../src/components/integration/RestQueryViewer.svelte | 2 +- .../portal/environment/CreateEditVariableModal.svelte | 2 +- .../environment/_components/EditVariableColumn.svelte | 8 ++++---- .../builder/portal/settings/environment/index.svelte | 11 ++++++++--- 8 files changed, 34 insertions(+), 19 deletions(-) diff --git a/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte b/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte index c2ad6324f7..5806189caa 100644 --- a/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte +++ b/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte @@ -218,7 +218,11 @@ } onMount(async () => { - await environment.loadVariables() + try { + await environment.loadVariables() + } catch (error) { + console.error(error) + } }) diff --git a/packages/builder/src/components/backend/DatasourceNavigator/TableIntegrationMenu/IntegrationConfigForm.svelte b/packages/builder/src/components/backend/DatasourceNavigator/TableIntegrationMenu/IntegrationConfigForm.svelte index 47cf2957d1..166e9474c6 100644 --- a/packages/builder/src/components/backend/DatasourceNavigator/TableIntegrationMenu/IntegrationConfigForm.svelte +++ b/packages/builder/src/components/backend/DatasourceNavigator/TableIntegrationMenu/IntegrationConfigForm.svelte @@ -96,10 +96,13 @@ } onMount(async () => { - await environment.loadVariables() - - if ($auth.user) { - await licensing.init() + try { + await environment.loadVariables() + if ($auth.user) { + await licensing.init() + } + } catch (err) { + console.error(err) } }) diff --git a/packages/builder/src/components/backend/DatasourceNavigator/TableIntegrationMenu/rest/auth/RestAuthenticationModal.svelte b/packages/builder/src/components/backend/DatasourceNavigator/TableIntegrationMenu/rest/auth/RestAuthenticationModal.svelte index d30ed72c94..f4dab4bb61 100644 --- a/packages/builder/src/components/backend/DatasourceNavigator/TableIntegrationMenu/rest/auth/RestAuthenticationModal.svelte +++ b/packages/builder/src/components/backend/DatasourceNavigator/TableIntegrationMenu/rest/auth/RestAuthenticationModal.svelte @@ -45,10 +45,13 @@ let formFieldkey onMount(async () => { - await environment.loadVariables() - - if ($auth.user) { - await licensing.init() + try { + await environment.loadVariables() + if ($auth.user) { + await licensing.init() + } + } catch (err) { + console.error(err) } if (currentConfig) { diff --git a/packages/builder/src/components/integration/KeyValueBuilder.svelte b/packages/builder/src/components/integration/KeyValueBuilder.svelte index 18715e2fe7..5d35498cfe 100644 --- a/packages/builder/src/components/integration/KeyValueBuilder.svelte +++ b/packages/builder/src/components/integration/KeyValueBuilder.svelte @@ -105,7 +105,7 @@ > {#each fields as field, idx} ds._id === query?.datasourceId) diff --git a/packages/builder/src/components/portal/environment/CreateEditVariableModal.svelte b/packages/builder/src/components/portal/environment/CreateEditVariableModal.svelte index 7cf2270c49..b456a29621 100644 --- a/packages/builder/src/components/portal/environment/CreateEditVariableModal.svelte +++ b/packages/builder/src/components/portal/environment/CreateEditVariableModal.svelte @@ -41,7 +41,7 @@ }) notifications.success("Environment variable saved") } catch (err) { - notifications.error("Error saving environment variable") + notifications.error(`Error saving environment variable - ${err.message}`) } } diff --git a/packages/builder/src/pages/builder/portal/settings/environment/_components/EditVariableColumn.svelte b/packages/builder/src/pages/builder/portal/settings/environment/_components/EditVariableColumn.svelte index c4f5bf8e55..fd754fa006 100644 --- a/packages/builder/src/pages/builder/portal/settings/environment/_components/EditVariableColumn.svelte +++ b/packages/builder/src/pages/builder/portal/settings/environment/_components/EditVariableColumn.svelte @@ -9,8 +9,8 @@ let editVariableModal let deleteDialog - const save = data => { - environment.updateVariable(data) + const save = async data => { + await environment.updateVariable(data) editVariableModal.hide() } @@ -23,8 +23,8 @@ { - environment.deleteVariable(row.name) + onOk={async () => { + await environment.deleteVariable(row.name) }} okText="Delete Environment Variable" title="Confirm Deletion" diff --git a/packages/builder/src/pages/builder/portal/settings/environment/index.svelte b/packages/builder/src/pages/builder/portal/settings/environment/index.svelte index 024c78df4c..6ffe261e31 100644 --- a/packages/builder/src/pages/builder/portal/settings/environment/index.svelte +++ b/packages/builder/src/pages/builder/portal/settings/environment/index.svelte @@ -10,6 +10,7 @@ Tags, Tag, InlineAlert, + notifications, } from "@budibase/bbui" import { environment, licensing, auth, admin } from "stores/portal" import { onMount } from "svelte" @@ -44,9 +45,13 @@ return schema } - const save = data => { - environment.createVariable(data) - modal.hide() + const save = async data => { + try { + await environment.createVariable(data) + modal.hide() + } catch (err) { + notifications.error(`Error saving variable: ${err.message}`) + } }