Merge branch 'feature/environment-variables' of github.com:Budibase/budibase into feature/environment-variables

This commit is contained in:
mike12345567 2023-01-30 17:05:51 +00:00
commit 2373ad016a
2 changed files with 16 additions and 6 deletions

View File

@ -9,6 +9,7 @@
Modal, Modal,
EnvDropdown, EnvDropdown,
Accordion, Accordion,
notifications,
} from "@budibase/bbui" } from "@budibase/bbui"
import KeyValueBuilder from "components/integration/KeyValueBuilder.svelte" import KeyValueBuilder from "components/integration/KeyValueBuilder.svelte"
import { capitalise } from "helpers" import { capitalise } from "helpers"
@ -80,9 +81,13 @@
} }
async function save(data) { async function save(data) {
await environment.createVariable(data) try {
config[selectedKey] = `{{ env.${data.name} }}` await environment.createVariable(data)
createVariableModal.hide() config[selectedKey] = `{{ env.${data.name} }}`
createVariableModal.hide()
} catch (err) {
notifications.error(`Failed to create variable: ${err.message}`)
}
} }
function showModal(configKey) { function showModal(configKey) {

View File

@ -8,6 +8,7 @@
Input, Input,
EnvDropdown, EnvDropdown,
Modal, Modal,
notifications,
} from "@budibase/bbui" } from "@budibase/bbui"
import { AUTH_TYPE_LABELS, AUTH_TYPES } from "./authTypes" import { AUTH_TYPE_LABELS, AUTH_TYPES } from "./authTypes"
import BindableCombobox from "components/common/bindings/BindableCombobox.svelte" import BindableCombobox from "components/common/bindings/BindableCombobox.svelte"
@ -172,9 +173,13 @@
} }
const save = async data => { const save = async data => {
await environment.createVariable(data) try {
form.basic[formFieldkey] = `{{ env.${data.name} }}` await environment.createVariable(data)
createVariableModal.hide() form.basic[formFieldkey] = `{{ env.${data.name} }}`
createVariableModal.hide()
} catch (err) {
notifications.error(`Failed to create variable: ${err.message}`)
}
} }
const onFieldChange = () => { const onFieldChange = () => {