From 47663ca395c2f54ac2507f13229d148fcc983004 Mon Sep 17 00:00:00 2001 From: Peter Clement Date: Thu, 19 Jan 2023 16:43:06 +0000 Subject: [PATCH] update datasource config to allow env var selection --- .../bbui/src/Form/Core/EnvDropdown.svelte | 241 ++++++++++++++++++ packages/bbui/src/Form/EnvDropdown.svelte | 48 ++++ packages/bbui/src/index.js | 1 + .../IntegrationConfigForm.svelte | 28 +- .../common/bindings/BindingPanel.svelte | 1 + .../bindings/DrawerBindableInput.svelte | 3 +- .../integration/KeyValueBuilder.svelte | 2 +- .../CreateEditVariableModal.svelte | 0 .../components/start/ExportAppModal.svelte | 9 +- .../_components/EditVariableColumn.svelte | 2 +- .../portal/settings/environment/index.svelte | 4 +- .../builder/src/stores/portal/environment.js | 1 - .../builder/src/stores/portal/licensing.js | 2 + 13 files changed, 331 insertions(+), 11 deletions(-) create mode 100644 packages/bbui/src/Form/Core/EnvDropdown.svelte create mode 100644 packages/bbui/src/Form/EnvDropdown.svelte rename packages/builder/src/{pages/builder/portal/settings/environment/_components => components/portal/environment}/CreateEditVariableModal.svelte (100%) diff --git a/packages/bbui/src/Form/Core/EnvDropdown.svelte b/packages/bbui/src/Form/Core/EnvDropdown.svelte new file mode 100644 index 0000000000..9b6346a8e1 --- /dev/null +++ b/packages/bbui/src/Form/Core/EnvDropdown.svelte @@ -0,0 +1,241 @@ + + +
+
+ + + +
+ {#if open} +
+
    + {#if variables.length} + {#each variables as variable, idx} +
  • handleVarSelect(variable.name)} + > + +
    + {variable.name} + +
    + +
    +
  • + {/each} + {:else} +
  • + +
    + You don't have any environment variables yet +
    +
    +
  • + {/if} +
+ +
+ +
showModal()} class="primary-text"> + Add Variable +
+
+
+ {/if} +
+ + diff --git a/packages/bbui/src/Form/EnvDropdown.svelte b/packages/bbui/src/Form/EnvDropdown.svelte new file mode 100644 index 0000000000..941b036e24 --- /dev/null +++ b/packages/bbui/src/Form/EnvDropdown.svelte @@ -0,0 +1,48 @@ + + + + + diff --git a/packages/bbui/src/index.js b/packages/bbui/src/index.js index 601c4dcbca..06f3c22037 100644 --- a/packages/bbui/src/index.js +++ b/packages/bbui/src/index.js @@ -27,6 +27,7 @@ export { default as RadioGroup } from "./Form/RadioGroup.svelte" export { default as Checkbox } from "./Form/Checkbox.svelte" export { default as InputDropdown } from "./Form/InputDropdown.svelte" export { default as PickerDropdown } from "./Form/PickerDropdown.svelte" +export { default as EnvDropdown } from "./Form/EnvDropdown.svelte" export { default as DetailSummary } from "./DetailSummary/DetailSummary.svelte" export { default as Popover } from "./Popover/Popover.svelte" export { default as ProgressBar } from "./ProgressBar/ProgressBar.svelte" diff --git a/packages/builder/src/components/backend/DatasourceNavigator/TableIntegrationMenu/IntegrationConfigForm.svelte b/packages/builder/src/components/backend/DatasourceNavigator/TableIntegrationMenu/IntegrationConfigForm.svelte index 05649e1773..fab633ffa2 100644 --- a/packages/builder/src/components/backend/DatasourceNavigator/TableIntegrationMenu/IntegrationConfigForm.svelte +++ b/packages/builder/src/components/backend/DatasourceNavigator/TableIntegrationMenu/IntegrationConfigForm.svelte @@ -6,16 +6,22 @@ Toggle, Button, TextArea, + Modal, + EnvDropdown, } from "@budibase/bbui" import KeyValueBuilder from "components/integration/KeyValueBuilder.svelte" import { capitalise } from "helpers" import { IntegrationTypes } from "constants/backend" import { createValidationStore } from "helpers/validation/yup" - import { createEventDispatcher } from "svelte" + import { createEventDispatcher, onMount } from "svelte" + import { environment } from "stores/portal" + import CreateEditVariableModal from "components/portal/environment/CreateEditVariableModal.svelte" export let datasource export let schema export let creating + + let createVariableModal const validation = createValidationStore() const dispatch = createEventDispatcher() @@ -60,6 +66,18 @@ } return capitalise(name) } + + function save(data) { + environment.createVariable(data) + createVariableModal.hide() + } + + function showModal() { + createVariableModal.show() + } + onMount(async () => { + await environment.loadVariables() + })
@@ -103,7 +121,9 @@ {:else}
- + + + +