From debef20af516b30e4ea6670044d9230ccf38d041 Mon Sep 17 00:00:00 2001 From: Peter Clement Date: Thu, 26 Jan 2023 15:09:20 +0000 Subject: [PATCH] gate env vars in binding drawers behind license --- .../builder/src/builderStore/dataBinding.js | 9 +++-- .../SetupPanel/AutomationBlockSetup.svelte | 33 ++++++++++--------- .../bindings/DrawerBindableInput.svelte | 1 - .../builder/src/stores/portal/licensing.js | 1 - 4 files changed, 24 insertions(+), 20 deletions(-) diff --git a/packages/builder/src/builderStore/dataBinding.js b/packages/builder/src/builderStore/dataBinding.js index 701d6b99ed..b7b479bf2d 100644 --- a/packages/builder/src/builderStore/dataBinding.js +++ b/packages/builder/src/builderStore/dataBinding.js @@ -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() : []), + ] } /** diff --git a/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte b/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte index 6230ea1c41..c2ad6324f7 100644 --- a/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte +++ b/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte @@ -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,21 +169,22 @@ } // 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, - }, - } - }) - ) + if ($licensing.environmentVariablesEnabled) { + bindings = bindings.concat( + $environment.variables.map(variable => { + return { + label: `env.${variable.name}`, + path: `env.${variable.name}`, + icon: "Key", + category: "Environment", + display: { + type: "string", + name: variable.name, + }, + } + }) + ) + } return bindings } diff --git a/packages/builder/src/components/common/bindings/DrawerBindableInput.svelte b/packages/builder/src/components/common/bindings/DrawerBindableInput.svelte index f115ab89ce..cc64e28835 100644 --- a/packages/builder/src/components/common/bindings/DrawerBindableInput.svelte +++ b/packages/builder/src/components/common/bindings/DrawerBindableInput.svelte @@ -28,7 +28,6 @@ $: readableValue = runtimeToReadableBinding(bindings, value) $: tempValue = readableValue - $: console.log(tempValue) $: isJS = isJSBinding(value) const saveBinding = () => { diff --git a/packages/builder/src/stores/portal/licensing.js b/packages/builder/src/stores/portal/licensing.js index ff302bfebd..96164ef2dc 100644 --- a/packages/builder/src/stores/portal/licensing.js +++ b/packages/builder/src/stores/portal/licensing.js @@ -64,7 +64,6 @@ export const createLicensingStore = () => { Constants.Features.ENVIRONMENT_VARIABLES ) - environmentVariablesEnabled = true store.update(state => { return { ...state,