1
0
Fork 0
mirror of synced 2024-08-15 18:11:40 +12:00

add envrionment bindings to automations

This commit is contained in:
Peter Clement 2023-01-26 14:59:29 +00:00
parent 4eaefa677a
commit 843649eb54
2 changed files with 24 additions and 2 deletions

View file

@ -92,7 +92,7 @@ export const getAuthBindings = () => {
export const getEnvironmentBindings = () => {
let envVars = get(environment).variables
let test = envVars.map(variable => {
return envVars.map(variable => {
return {
type: "context",
runtimeBinding: `env.${makePropSafe(variable.name)}`,
@ -102,7 +102,6 @@ export const getEnvironmentBindings = () => {
display: { type: "string", name: variable.name },
}
})
return test
}
/**

View file

@ -18,6 +18,7 @@
import { automationStore } from "builderStore"
import { tables } from "stores/backend"
import { environment } from "stores/portal"
import WebhookDisplay from "../Shared/WebhookDisplay.svelte"
import DrawerBindableInput from "../../common/bindings/DrawerBindableInput.svelte"
import AutomationBindingPanel from "../../common/bindings/ServerBindingPanel.svelte"
@ -33,6 +34,7 @@
import { Utils } from "@budibase/frontend-core"
import { TriggerStepID, ActionStepID } from "constants/backend/automations"
import { cloneDeep } from "lodash/fp"
import { onMount } from "svelte"
export let block
export let testData
@ -166,6 +168,23 @@
)
}
// Environment bindings
bindings = bindings.concat(
$environment.variables.map(variable => {
return {
label: `env.${variable.name}`,
path: `env.${variable.name}`,
type: "test",
icon: "Key",
category: "Environment",
display: {
type: "string",
name: variable.name,
},
}
})
)
return bindings
}
@ -196,6 +215,10 @@
onChange({ detail: tempFilters }, defKey)
drawer.hide()
}
onMount(async () => {
await environment.loadVariables()
})
</script>
<div class="fields">