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

View File

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

View File

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

View File

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