diff --git a/packages/builder/src/pages/builder/portal/_layout.svelte b/packages/builder/src/pages/builder/portal/_layout.svelte index a4bd22a692..27a914105e 100644 --- a/packages/builder/src/pages/builder/portal/_layout.svelte +++ b/packages/builder/src/pages/builder/portal/_layout.svelte @@ -53,10 +53,6 @@ title: "Plugins", href: "/builder/portal/plugins", }, - { - title: "Environment", - href: "/builder/portal/environment", - }, ] // Admin only pages @@ -74,6 +70,11 @@ title: "Plugins", href: "/builder/portal/plugins", }, + { + title: "Environment", + href: "/builder/portal/environment", + }, + { title: "Settings", href: "/builder/portal/settings", diff --git a/packages/builder/src/pages/builder/portal/environment/_components/editVariableModal.svelte b/packages/builder/src/pages/builder/portal/environment/_components/editVariableModal.svelte new file mode 100644 index 0000000000..a6e9cd50bb --- /dev/null +++ b/packages/builder/src/pages/builder/portal/environment/_components/editVariableModal.svelte @@ -0,0 +1,69 @@ + + +Edit + + + + + +
+ Production + (productionTouched = true)} + label="Value" + bind:value={productionValue} + /> +
+
+ Development + (developmentTouched = true)} + label="Value" + bind:value={developmentValue} + /> + +
+ + +
+
+ + { + console.log("delete") + }} + okText="Delete Environment Variable" + title="Confirm Deletion" +> + Are you sure you wish to delete the environment variable + {row.name}? + This action cannot be undone. + diff --git a/packages/builder/src/pages/builder/portal/environment/index.svelte b/packages/builder/src/pages/builder/portal/environment/index.svelte index 9fb19fe676..4c377d2051 100644 --- a/packages/builder/src/pages/builder/portal/environment/index.svelte +++ b/packages/builder/src/pages/builder/portal/environment/index.svelte @@ -7,33 +7,92 @@ Select, Divider, Modal, + ModalContent, Search, + Page, + Table, + Input, + Checkbox, } from "@budibase/bbui" - + import { envVars } from "stores/portal" import { onMount } from "svelte" + import EditVariableModal from "./_components/editVariableModal.svelte" + + let modal + + let useProductionValue = true + + let developmentValue + let productionValue + const schema = { + name: { + width: "2fr", + }, + edit: { + width: "auto", + borderLeft: true, + displayName: "", + }, + } + + const customRenderers = [{ column: "edit", component: EditVariableModal }] onMount(async () => { await envVars.load() }) - - - Envrironment Variables - Add and manage environment variable for development and production - - + - {#each $envVars as envVar} - - {envVar} - - - {/each} + + Envrironment Variables + Add and manage environment variable for development and production + + + + + +
+ +
- + + + + + + +
+ Production + +
+
+ Development + + { + developmentValue = productionValue + }} + bind:value={useProductionValue} + text="Use production value" + /> +
+
+
diff --git a/packages/builder/src/stores/portal/envVars.js b/packages/builder/src/stores/portal/envVars.js index 9c9880511a..81d3143f15 100644 --- a/packages/builder/src/stores/portal/envVars.js +++ b/packages/builder/src/stores/portal/envVars.js @@ -5,10 +5,15 @@ export function createEnvVarsStore() { const { subscribe, set, update } = writable([]) async function load() { - const envVars = await API.fetchEnvVars() + // const envVars = await API.fetchEnvVars() let testVars = ['blah', 'blah123'] - set(testVars) + + // turn the testVars array in to a map with "name" being the value of each + // item in the array + const vars = testVars.map((name) => ({ name })) + console.log(vars) + set(vars) } return { diff --git a/packages/builder/src/stores/portal/index.js b/packages/builder/src/stores/portal/index.js index 81d26b900e..370c448bb3 100644 --- a/packages/builder/src/stores/portal/index.js +++ b/packages/builder/src/stores/portal/index.js @@ -11,3 +11,4 @@ export { groups } from "./groups" export { plugins } from "./plugins" export { backups } from "./backups" export { overview } from "./overview" +export { envVars } from "./envVars" \ No newline at end of file