diff --git a/packages/builder/src/pages/builder/portal/settings/environment/_components/CreateEditVariableModal.svelte b/packages/builder/src/pages/builder/portal/settings/environment/_components/CreateEditVariableModal.svelte new file mode 100644 index 0000000000..0ea487c885 --- /dev/null +++ b/packages/builder/src/pages/builder/portal/settings/environment/_components/CreateEditVariableModal.svelte @@ -0,0 +1,89 @@ + + + + save({ + name, + production: productionValue, + development: developmentValue, + })} + title={!row ? "Add new environment variable" : "Edit environment variable"} +> + +
+ Production + { + productionValue = e.detail + if (useProductionValue) { + developmentValue = e.detail + } + }} + value={productionValue} + /> +
+
+ Development + { + developmentValue = e.target.value + }} + disabled={useProductionValue} + label="Value" + value={useProductionValue ? productionValue : developmentValue} + /> + +
+ + +
+ + { + deleteVariable(row.name) + }} + 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/settings/environment/_components/EditVariableColumn.svelte b/packages/builder/src/pages/builder/portal/settings/environment/_components/EditVariableColumn.svelte new file mode 100644 index 0000000000..83f37d3fdb --- /dev/null +++ b/packages/builder/src/pages/builder/portal/settings/environment/_components/EditVariableColumn.svelte @@ -0,0 +1,35 @@ + + +Edit + + + + + + { + environment.deleteVariable(row.name) + }} + 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/settings/environment/_components/editVariableModal.svelte b/packages/builder/src/pages/builder/portal/settings/environment/_components/editVariableModal.svelte deleted file mode 100644 index a6e9cd50bb..0000000000 --- a/packages/builder/src/pages/builder/portal/settings/environment/_components/editVariableModal.svelte +++ /dev/null @@ -1,69 +0,0 @@ - - -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/settings/environment/index.svelte b/packages/builder/src/pages/builder/portal/settings/environment/index.svelte index ab52ceb1bf..06cfc02085 100644 --- a/packages/builder/src/pages/builder/portal/settings/environment/index.svelte +++ b/packages/builder/src/pages/builder/portal/settings/environment/index.svelte @@ -6,21 +6,15 @@ Button, Divider, Modal, - ModalContent, Table, - Input, - Checkbox, } from "@budibase/bbui" - import { envVars } from "stores/portal" + import { environment } from "stores/portal" import { onMount } from "svelte" - import EditVariableModal from "./_components/editVariableModal.svelte" + import CreateEditVariableModal from "./_components/CreateEditVariableModal.svelte" + import EditVariableColumn from "./_components/EditVariableColumn.svelte" let modal - let useProductionValue = true - - let developmentValue - let productionValue const schema = { name: { width: "2fr", @@ -32,11 +26,16 @@ }, } - const customRenderers = [{ column: "edit", component: EditVariableModal }] + const customRenderers = [{ column: "edit", component: EditVariableColumn }] onMount(async () => { - await envVars.load() + await environment.loadVariables() }) + + const save = data => { + environment.createVariable(data) + modal.hide() + } @@ -50,7 +49,7 @@ - - - -
- Production - -
-
- Development - - { - developmentValue = productionValue - }} - bind:value={useProductionValue} - text="Use production value" - /> -
-
+