gate env vars in binding drawers behind license

This commit is contained in:
Peter Clement 2023-01-26 15:09:20 +00:00
parent 843649eb54
commit debef20af5
4 changed files with 24 additions and 20 deletions

View File

@ -21,7 +21,7 @@ import {
import { TableNames } from "../constants"
import { JSONUtils } from "@budibase/frontend-core"
import ActionDefinitions from "components/design/settings/controls/ButtonActionEditor/manifest.json"
import { environment } from "stores/portal"
import { environment, licensing } from "stores/portal"
// Regex to match all instances of template strings
const CAPTURE_VAR_INSIDE_TEMPLATE = /{{([^}]+)}}/g
@ -54,8 +54,13 @@ export const getBindableProperties = (asset, componentId) => {
* Gets all rest bindable data fields
*/
export const getRestBindings = () => {
const hasEnvironmentVariablesEnabled = get(licensing).hasEnvironmentVariables
const userBindings = getUserBindings()
return [...userBindings, ...getAuthBindings(), ...getEnvironmentBindings()]
return [
...userBindings,
...getAuthBindings(),
...(hasEnvironmentVariablesEnabled ? getEnvironmentBindings() : []),
]
}
/**

View File

@ -18,7 +18,7 @@
import { automationStore } from "builderStore"
import { tables } from "stores/backend"
import { environment } from "stores/portal"
import { environment, licensing } from "stores/portal"
import WebhookDisplay from "../Shared/WebhookDisplay.svelte"
import DrawerBindableInput from "../../common/bindings/DrawerBindableInput.svelte"
import AutomationBindingPanel from "../../common/bindings/ServerBindingPanel.svelte"
@ -169,12 +169,12 @@
}
// Environment bindings
if ($licensing.environmentVariablesEnabled) {
bindings = bindings.concat(
$environment.variables.map(variable => {
return {
label: `env.${variable.name}`,
path: `env.${variable.name}`,
type: "test",
icon: "Key",
category: "Environment",
display: {
@ -184,6 +184,7 @@
}
})
)
}
return bindings
}

View File

@ -28,7 +28,6 @@
$: readableValue = runtimeToReadableBinding(bindings, value)
$: tempValue = readableValue
$: console.log(tempValue)
$: isJS = isJSBinding(value)
const saveBinding = () => {

View File

@ -64,7 +64,6 @@ export const createLicensingStore = () => {
Constants.Features.ENVIRONMENT_VARIABLES
)
environmentVariablesEnabled = true
store.update(state => {
return {
...state,