diff --git a/.github/workflows/budibase_ci.yml b/.github/workflows/budibase_ci.yml index a15e3d9110..4e0bc8b3a9 100644 --- a/.github/workflows/budibase_ci.yml +++ b/.github/workflows/budibase_ci.yml @@ -44,7 +44,10 @@ jobs: node-version: 14.x cache: "yarn" - run: yarn - - run: yarn nx run-many -t=build --configuration=production + # Run build all the projects + - run: yarn build + # Check the types of the projects built via esbuild + - run: yarn check:types test-libraries: runs-on: ubuntu-latest diff --git a/.github/workflows/release-develop.yml b/.github/workflows/release-develop.yml index c724b717e2..ebd2f4c3ef 100644 --- a/.github/workflows/release-develop.yml +++ b/.github/workflows/release-develop.yml @@ -54,6 +54,9 @@ jobs: - run: yarn build --configuration=production - run: yarn build:sdk + - name: Reset pro dependencies + run: node scripts/resetProDependencies.js + - name: Publish budibase packages to NPM env: NPM_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/release-master.yml b/.github/workflows/release-master.yml index 4959194064..304b0de100 100644 --- a/.github/workflows/release-master.yml +++ b/.github/workflows/release-master.yml @@ -60,6 +60,9 @@ jobs: - run: yarn build --configuration=production - run: yarn build:sdk + - name: Reset pro dependencies + run: node scripts/resetProDependencies.js + - name: Publish budibase packages to NPM env: NPM_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/lerna.json b/lerna.json index ebaf23cfb6..c476c86ebb 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.6.19-alpha.11", + "version": "2.6.19-alpha.21", "npmClient": "yarn", "packages": [ "packages/backend-core", diff --git a/package.json b/package.json index edbb82b892..35452b024a 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,6 @@ "devDependencies": { "@esbuild-plugins/node-resolve": "^0.2.2", "@esbuild-plugins/tsconfig-paths": "^0.1.2", - "@nx/esbuild": "16.2.1", "@nx/js": "16.2.1", "@rollup/plugin-json": "^4.0.2", "@typescript-eslint/parser": "5.45.0", @@ -34,6 +33,7 @@ "bootstrap": "./scripts/link-dependencies.sh && echo '***BOOTSTRAP ONLY REQUIRED FOR USE WITH ACCOUNT PORTAL***'", "build": "yarn nx run-many -t=build", "build:dev": "lerna run --stream prebuild && yarn nx run-many --target=build --output-style=dynamic --watch --preserveWatchOutput", + "check:types": "lerna run check:types --skip-nx-cache", "backend:bootstrap": "./scripts/scopeBackend.sh && yarn run bootstrap", "backend:build": "./scripts/scopeBackend.sh 'lerna run --stream build'", "build:sdk": "lerna run --stream build:sdk", @@ -52,7 +52,7 @@ "dev:noserver": "yarn run kill-builder && lerna run --stream dev:stack:up && lerna run --stream --parallel dev:builder --ignore @budibase/backend-core --ignore @budibase/server --ignore @budibase/worker", "dev:server": "yarn run kill-server && lerna run --stream --parallel dev:builder --scope @budibase/worker --scope @budibase/server", "dev:built": "yarn run kill-all && cd packages/server && yarn dev:stack:up && cd ../../ && lerna run --stream --parallel dev:built", - "dev:docker": "yarn build && docker-compose -f hosting/docker-compose.dev.yaml -f hosting/docker-compose.build.yaml up --build --scale proxy-service=0 ", + "dev:docker": "yarn build && docker-compose -f hosting/docker-compose.build.yaml -f hosting/docker-compose.dev.yaml --env-file hosting/.env up --build --scale proxy-service=0", "test": "lerna run --stream test --stream", "lint:eslint": "eslint packages && eslint qa-core", "lint:prettier": "prettier --check \"packages/**/*.{js,ts,svelte}\" && prettier --write \"examples/**/*.{js,ts,svelte}\" && prettier --check \"qa-core/**/*.{js,ts,svelte}\"", diff --git a/packages/backend-core/tests/core/utilities/mocks/licenses.ts b/packages/backend-core/tests/core/utilities/mocks/licenses.ts index 839b22e5f9..4272e78eb8 100644 --- a/packages/backend-core/tests/core/utilities/mocks/licenses.ts +++ b/packages/backend-core/tests/core/utilities/mocks/licenses.ts @@ -90,6 +90,10 @@ export const useScimIntegration = () => { return useFeature(Feature.SCIM) } +export const useSyncAutomations = () => { + return useFeature(Feature.SYNC_AUTOMATIONS) +} + // QUOTAS export const setAutomationLogsQuota = (value: number) => { diff --git a/packages/builder/src/builderStore/datasource.js b/packages/builder/src/builderStore/datasource.js index e12b318e1c..6509216a5b 100644 --- a/packages/builder/src/builderStore/datasource.js +++ b/packages/builder/src/builderStore/datasource.js @@ -2,6 +2,7 @@ import { datasources, tables } from "../stores/backend" import { IntegrationNames } from "../constants/backend" import { get } from "svelte/store" import cloneDeep from "lodash/cloneDeepWith" +import { API } from "api" function prepareData(config) { let datasource = {} @@ -37,3 +38,9 @@ export async function createRestDatasource(integration) { const config = cloneDeep(integration) return saveDatasource(config) } + +export async function validateDatasourceConfig(config) { + const datasource = prepareData(config) + const resp = await API.validateDatasource(datasource) + return resp +} diff --git a/packages/builder/src/builderStore/utils.js b/packages/builder/src/builderStore/utils.js index 3ddf6fb667..86c63f20ee 100644 --- a/packages/builder/src/builderStore/utils.js +++ b/packages/builder/src/builderStore/utils.js @@ -1,3 +1,4 @@ +import { ActionStepID } from "constants/backend/automations" import { TableNames } from "../constants" import { AUTO_COLUMN_DISPLAY_NAMES, @@ -53,3 +54,9 @@ export function buildAutoColumn(tableName, name, subtype) { } return base } + +export function checkForCollectStep(automation) { + return automation.definition.steps.some( + step => step.stepId === ActionStepID.COLLECT + ) +} diff --git a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/ActionModal.svelte b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/ActionModal.svelte index 7c9f31352f..c5e4eaf61f 100644 --- a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/ActionModal.svelte +++ b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/ActionModal.svelte @@ -6,24 +6,48 @@ Body, Icon, notifications, + Tags, + Tag, } from "@budibase/bbui" - import { automationStore } from "builderStore" - import { admin } from "stores/portal" + import { automationStore, selectedAutomation } from "builderStore" + import { admin, licensing } from "stores/portal" import { externalActions } from "./ExternalActions" + import { TriggerStepID } from "constants/backend/automations" + import { checkForCollectStep } from "builderStore/utils" export let blockIdx + export let lastStep - const disabled = { - SEND_EMAIL_SMTP: { - disabled: !$admin.checklist.smtp.checked, - message: "Please configure SMTP", - }, - } - + let syncAutomationsEnabled = $licensing.syncAutomationsEnabled + let collectBlockAllowedSteps = [TriggerStepID.APP, TriggerStepID.WEBHOOK] let selectedAction let actionVal let actions = Object.entries($automationStore.blockDefinitions.ACTION) + $: collectBlockExists = checkForCollectStep($selectedAutomation) + + const disabled = () => { + return { + SEND_EMAIL_SMTP: { + disabled: !$admin.checklist.smtp.checked, + message: "Please configure SMTP", + }, + COLLECT: { + disabled: !lastStep || !syncAutomationsEnabled || collectBlockExists, + message: collectDisabledMessage(), + }, + } + } + + const collectDisabledMessage = () => { + if (collectBlockExists) { + return "Only one Collect step allowed" + } + if (!lastStep) { + return "Only available as the last step" + } + } + const external = actions.reduce((acc, elm) => { const [k, v] = elm if (!v.internal && !v.custom) { @@ -38,6 +62,15 @@ acc[k] = v } delete acc.LOOP + + // Filter out Collect block if not App Action or Webhook + if ( + !collectBlockAllowedSteps.includes( + $selectedAutomation.definition.trigger.stepId + ) + ) { + delete acc.COLLECT + } return acc }, {}) @@ -48,7 +81,6 @@ } return acc }, {}) - console.log(plugins) const selectAction = action => { actionVal = action @@ -72,7 +104,7 @@ @@ -107,7 +139,7 @@ Actions
{#each Object.entries(internal) as [idx, action]} - {@const isDisabled = disabled[idx] && disabled[idx].disabled} + {@const isDisabled = disabled()[idx] && disabled()[idx].disabled}
{action.name} - {#if isDisabled} - + {#if isDisabled && !syncAutomationsEnabled} +
+ + Business + +
+ {:else if isDisabled} + {/if}
@@ -152,6 +190,7 @@ display: flex; margin-left: var(--spacing-m); gap: var(--spacing-m); + align-items: center; } .item-list { display: grid; @@ -181,4 +220,8 @@ .disabled :global(.spectrum-Body) { color: var(--spectrum-global-color-gray-600); } + + .tag-color :global(.spectrum-Tags-item) { + background: var(--spectrum-global-color-gray-200); + } diff --git a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItem.svelte b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItem.svelte index 7484a60502..092138170f 100644 --- a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItem.svelte +++ b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItem.svelte @@ -17,7 +17,11 @@ import ActionModal from "./ActionModal.svelte" import FlowItemHeader from "./FlowItemHeader.svelte" import RoleSelect from "components/design/settings/controls/RoleSelect.svelte" - import { ActionStepID, TriggerStepID } from "constants/backend/automations" + import { + ActionStepID, + TriggerStepID, + Features, + } from "constants/backend/automations" import { permissions } from "stores/backend" export let block @@ -31,6 +35,9 @@ let showLooping = false let role + $: collectBlockExists = $selectedAutomation.definition.steps.some( + step => step.stepId === ActionStepID.COLLECT + ) $: automationId = $selectedAutomation?._id $: showBindingPicker = block.stepId === ActionStepID.CREATE_ROW || @@ -184,7 +191,7 @@ {#if !isTrigger}
- {#if !loopBlock} + {#if block?.features?.[Features.LOOPING] || !block.features} addLooping()} icon="Reuse"> Add Looping @@ -224,21 +231,28 @@
{/if} - - - - - - - -
-
- actionModal.show()} hoverable name="AddCircle" size="S" /> -{#if isTrigger ? totalBlocks > 1 : blockIdx !== totalBlocks - 2} +{#if !collectBlockExists || !lastStep}
+ actionModal.show()} + hoverable + name="AddCircle" + size="S" + /> + {#if isTrigger ? totalBlocks > 1 : blockIdx !== totalBlocks - 2} +
+ {/if} {/if} + + + + + + + +