From b1b861139dbb1d607978395e5df2d9f468054316 Mon Sep 17 00:00:00 2001 From: Peter Clement Date: Thu, 5 Sep 2024 14:25:04 +0100 Subject: [PATCH 01/10] feature flag the branch action definition --- packages/backend-core/src/features/index.ts | 1 + packages/server/src/automations/actions.ts | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/packages/backend-core/src/features/index.ts b/packages/backend-core/src/features/index.ts index 49f8044e8f..5951bbc292 100644 --- a/packages/backend-core/src/features/index.ts +++ b/packages/backend-core/src/features/index.ts @@ -267,6 +267,7 @@ export class FlagSet, T extends { [key: string]: V }> { // default values set correctly and their types flow through the system. export const flags = new FlagSet({ DEFAULT_VALUES: Flag.boolean(env.isDev()), + AUTOMATION_BRANCHING: Flag.boolean(env.isDev()), SQS: Flag.boolean(env.isDev()), [FeatureFlag.ENRICHED_RELATIONSHIPS]: Flag.boolean(false), }) diff --git a/packages/server/src/automations/actions.ts b/packages/server/src/automations/actions.ts index 2058723faa..a9b839fedd 100644 --- a/packages/server/src/automations/actions.ts +++ b/packages/server/src/automations/actions.ts @@ -16,6 +16,7 @@ import * as delay from "./steps/delay" import * as queryRow from "./steps/queryRows" import * as loop from "./steps/loop" import * as collect from "./steps/collect" +import * as branch from "./steps/branch" import * as triggerAutomationRun from "./steps/triggerAutomationRun" import env from "../environment" import { @@ -25,9 +26,11 @@ import { Hosting, ActionImplementation, AutomationStepDefinition, + FeatureFlag, } from "@budibase/types" import sdk from "../sdk" import { getAutomationPlugin } from "../utilities/fileSystem" +import { features } from "@budibase/backend-core" type ActionImplType = ActionImplementations< typeof env.SELF_HOSTED extends "true" ? Hosting.SELF : Hosting.CLOUD @@ -98,6 +101,9 @@ if (env.SELF_HOSTED) { } export async function getActionDefinitions() { + if (await features.flags.isEnabled("AUTOMATION_BRANCHING")) { + BUILTIN_ACTION_DEFINITIONS["BRANCH"] = branch.definition + } const actionDefinitions = BUILTIN_ACTION_DEFINITIONS if (env.SELF_HOSTED) { const plugins = await sdk.plugins.fetch(PluginType.AUTOMATION) From 2f13773240dd1d93286cc75a626dce5f545d3e63 Mon Sep 17 00:00:00 2001 From: melohagan <101575380+melohagan@users.noreply.github.com> Date: Mon, 9 Sep 2024 11:46:08 +0100 Subject: [PATCH 02/10] Add old roles (#14538) --- packages/frontend-core/src/constants.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/frontend-core/src/constants.js b/packages/frontend-core/src/constants.js index 1f82610408..d2f25b351a 100644 --- a/packages/frontend-core/src/constants.js +++ b/packages/frontend-core/src/constants.js @@ -76,7 +76,9 @@ export const ExtendedBudibaseRoleOptions = [ value: BudibaseRoles.Owner, sortOrder: 0, }, -].concat(BudibaseRoleOptions) +] + .concat(BudibaseRoleOptions) + .concat(BudibaseRoleOptionsOld) export const PlanType = { FREE: "free", From 68678235d63de9f3ec74e44c2a7e8358c7f6f38d Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Mon, 9 Sep 2024 10:52:12 +0000 Subject: [PATCH 03/10] Bump version to 2.31.8 --- lerna.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lerna.json b/lerna.json index f24c0e095b..0292b863e8 100644 --- a/lerna.json +++ b/lerna.json @@ -1,6 +1,6 @@ { "$schema": "node_modules/lerna/schemas/lerna-schema.json", - "version": "2.31.7", + "version": "2.31.8", "npmClient": "yarn", "packages": [ "packages/*", From bb3dd6e27ac98b62b6a562ed584e77314dee3597 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Mon, 9 Sep 2024 15:23:06 +0200 Subject: [PATCH 04/10] Fix relationship popover click behaviour --- .../src/components/grid/overlays/GridPopover.svelte | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/frontend-core/src/components/grid/overlays/GridPopover.svelte b/packages/frontend-core/src/components/grid/overlays/GridPopover.svelte index ac2a998428..9f79a5eb22 100644 --- a/packages/frontend-core/src/components/grid/overlays/GridPopover.svelte +++ b/packages/frontend-core/src/components/grid/overlays/GridPopover.svelte @@ -44,6 +44,7 @@ {wrap} portalTarget="#{gridID} .grid-popover-container" offset={0} + clickOutsideOverride >
Date: Mon, 9 Sep 2024 14:26:37 +0100 Subject: [PATCH 05/10] remove uneeded import --- packages/server/src/automations/actions.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/server/src/automations/actions.ts b/packages/server/src/automations/actions.ts index a9b839fedd..f78174aa7a 100644 --- a/packages/server/src/automations/actions.ts +++ b/packages/server/src/automations/actions.ts @@ -26,7 +26,6 @@ import { Hosting, ActionImplementation, AutomationStepDefinition, - FeatureFlag, } from "@budibase/types" import sdk from "../sdk" import { getAutomationPlugin } from "../utilities/fileSystem" From 725aa180609ba4211b42381933efb722bde084d7 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Mon, 9 Sep 2024 16:05:09 +0200 Subject: [PATCH 06/10] Fix long popover for relationship column pickers --- .../src/components/grid/controls/ColumnsSettingContent.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/frontend-core/src/components/grid/controls/ColumnsSettingContent.svelte b/packages/frontend-core/src/components/grid/controls/ColumnsSettingContent.svelte index 02ed0a504c..79e457aa16 100644 --- a/packages/frontend-core/src/components/grid/controls/ColumnsSettingContent.svelte +++ b/packages/frontend-core/src/components/grid/controls/ColumnsSettingContent.svelte @@ -219,7 +219,7 @@ on:close={() => (relationshipFieldName = null)} open={relationshipFieldName} anchor={relationshipPanelAnchor} - align="right-outside" + align="left" > {#if relationshipPanelColumns.length}
From ee968b212a4b0c4da13cef3859a2d8526e95b998 Mon Sep 17 00:00:00 2001 From: Dean Date: Mon, 9 Sep 2024 16:10:39 +0100 Subject: [PATCH 07/10] Fix to accommodate filtering updates for GoogleSheets --- packages/server/src/integrations/googlesheets.ts | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/packages/server/src/integrations/googlesheets.ts b/packages/server/src/integrations/googlesheets.ts index f8f5209890..ea62281d4b 100644 --- a/packages/server/src/integrations/googlesheets.ts +++ b/packages/server/src/integrations/googlesheets.ts @@ -566,24 +566,20 @@ class GoogleSheetsIntegration implements DatasourcePlus { query.filters.equal[`_${GOOGLE_SHEETS_PRIMARY_KEY}`] = id } } - let filtered = dataFilters.runQuery( - rows, - query.filters || {}, - (row: GoogleSpreadsheetRow, headerKey: string) => { - return row.get(headerKey) - } - ) + if (hasFilters && query.paginate) { - filtered = filtered.slice(offset, offset + limit) + rows = rows.slice(offset, offset + limit) } const headerValues = sheet.headerValues let response = [] - for (let row of filtered) { + for (let row of rows) { response.push( - this.buildRowObject(headerValues, row.toObject(), row._rowNumber) + this.buildRowObject(headerValues, row.toObject(), row.rowNumber) ) } + response = dataFilters.runQuery(response, query.filters || {}) + if (query.sort) { if (Object.keys(query.sort).length !== 1) { console.warn("Googlesheets does not support multiple sorting", { From 6e10c528d89a8204d8ff8fe8e4dfe8958aca37bc Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Mon, 9 Sep 2024 16:25:34 +0100 Subject: [PATCH 08/10] Getting rid of findInDoc as its not used anymore. --- packages/shared-core/src/filters.ts | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/packages/shared-core/src/filters.ts b/packages/shared-core/src/filters.ts index 70fb24b373..bcd2e0e338 100644 --- a/packages/shared-core/src/filters.ts +++ b/packages/shared-core/src/filters.ts @@ -471,15 +471,8 @@ export const search = ( * Performs a client-side search on an array of data * @param docs the data * @param query the JSON query - * @param findInDoc optional fn when trying to extract a value - * from custom doc type e.g. Google Sheets - * */ -export const runQuery = ( - docs: Record[], - query: SearchFilters, - findInDoc: Function = deepGet -) => { +export const runQuery = (docs: Record[], query: SearchFilters) => { if (!docs || !Array.isArray(docs)) { return [] } @@ -503,11 +496,8 @@ export const runQuery = ( test: (docValue: any, testValue: any) => boolean ) => (doc: Record) => { - for (const [key, testValue] of Object.entries(query[type] || {})) { - const valueToCheck = isLogicalSearchOperator(type) - ? doc - : findInDoc(doc, removeKeyNumbering(key)) - const result = test(valueToCheck, testValue) + for (const testValue of Object.values(query[type] || {})) { + const result = test(doc, testValue) if (query.allOr && result) { return true } else if (!query.allOr && !result) { From ac2416dc0b2a5b43d1fdd705e7432c52af7d5d97 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Mon, 9 Sep 2024 16:30:38 +0100 Subject: [PATCH 09/10] Lint. --- packages/shared-core/src/filters.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/shared-core/src/filters.ts b/packages/shared-core/src/filters.ts index bcd2e0e338..971b59a6fb 100644 --- a/packages/shared-core/src/filters.ts +++ b/packages/shared-core/src/filters.ts @@ -22,7 +22,7 @@ import { } from "@budibase/types" import dayjs from "dayjs" import { OperatorOptions, SqlNumberTypeRangeMap } from "./constants" -import { deepGet, schema } from "./helpers" +import { schema } from "./helpers" import { isPlainObject, isEmpty } from "lodash" import { decodeNonAscii } from "./helpers/schema" From 1a27cf9d5b4931e2b15e711def1c4132fcce16cb Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Mon, 9 Sep 2024 16:40:04 +0100 Subject: [PATCH 10/10] Fix - thanks tests. --- packages/shared-core/src/filters.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/shared-core/src/filters.ts b/packages/shared-core/src/filters.ts index 971b59a6fb..31934371f6 100644 --- a/packages/shared-core/src/filters.ts +++ b/packages/shared-core/src/filters.ts @@ -22,7 +22,7 @@ import { } from "@budibase/types" import dayjs from "dayjs" import { OperatorOptions, SqlNumberTypeRangeMap } from "./constants" -import { schema } from "./helpers" +import { deepGet, schema } from "./helpers" import { isPlainObject, isEmpty } from "lodash" import { decodeNonAscii } from "./helpers/schema" @@ -496,8 +496,11 @@ export const runQuery = (docs: Record[], query: SearchFilters) => { test: (docValue: any, testValue: any) => boolean ) => (doc: Record) => { - for (const testValue of Object.values(query[type] || {})) { - const result = test(doc, testValue) + for (const [key, testValue] of Object.entries(query[type] || {})) { + const valueToCheck = isLogicalSearchOperator(type) + ? doc + : deepGet(doc, removeKeyNumbering(key)) + const result = test(valueToCheck, testValue) if (query.allOr && result) { return true } else if (!query.allOr && !result) {