Merge remote-tracking branch 'origin/master' into feature/builder-filtering-update

This commit is contained in:
Dean 2024-09-09 16:51:00 +01:00
commit 1d3130f8cc
8 changed files with 20 additions and 22 deletions

View File

@ -1,6 +1,6 @@
{ {
"$schema": "node_modules/lerna/schemas/lerna-schema.json", "$schema": "node_modules/lerna/schemas/lerna-schema.json",
"version": "2.31.7", "version": "2.31.8",
"npmClient": "yarn", "npmClient": "yarn",
"packages": [ "packages": [
"packages/*", "packages/*",

View File

@ -267,6 +267,7 @@ export class FlagSet<V extends Flag<any>, T extends { [key: string]: V }> {
// default values set correctly and their types flow through the system. // default values set correctly and their types flow through the system.
export const flags = new FlagSet({ export const flags = new FlagSet({
DEFAULT_VALUES: Flag.boolean(env.isDev()), DEFAULT_VALUES: Flag.boolean(env.isDev()),
AUTOMATION_BRANCHING: Flag.boolean(env.isDev()),
SQS: Flag.boolean(env.isDev()), SQS: Flag.boolean(env.isDev()),
[FeatureFlag.ENRICHED_RELATIONSHIPS]: Flag.boolean(false), [FeatureFlag.ENRICHED_RELATIONSHIPS]: Flag.boolean(false),
}) })

View File

@ -219,7 +219,7 @@
on:close={() => (relationshipFieldName = null)} on:close={() => (relationshipFieldName = null)}
open={relationshipFieldName} open={relationshipFieldName}
anchor={relationshipPanelAnchor} anchor={relationshipPanelAnchor}
align="right-outside" align="left"
> >
{#if relationshipPanelColumns.length} {#if relationshipPanelColumns.length}
<div class="relationship-header"> <div class="relationship-header">

View File

@ -44,6 +44,7 @@
{wrap} {wrap}
portalTarget="#{gridID} .grid-popover-container" portalTarget="#{gridID} .grid-popover-container"
offset={0} offset={0}
clickOutsideOverride
> >
<div <div
class="grid-popover-contents" class="grid-popover-contents"

View File

@ -76,7 +76,9 @@ export const ExtendedBudibaseRoleOptions = [
value: BudibaseRoles.Owner, value: BudibaseRoles.Owner,
sortOrder: 0, sortOrder: 0,
}, },
].concat(BudibaseRoleOptions) ]
.concat(BudibaseRoleOptions)
.concat(BudibaseRoleOptionsOld)
export const PlanType = { export const PlanType = {
FREE: "free", FREE: "free",

View File

@ -16,6 +16,7 @@ import * as delay from "./steps/delay"
import * as queryRow from "./steps/queryRows" import * as queryRow from "./steps/queryRows"
import * as loop from "./steps/loop" import * as loop from "./steps/loop"
import * as collect from "./steps/collect" import * as collect from "./steps/collect"
import * as branch from "./steps/branch"
import * as triggerAutomationRun from "./steps/triggerAutomationRun" import * as triggerAutomationRun from "./steps/triggerAutomationRun"
import env from "../environment" import env from "../environment"
import { import {
@ -28,6 +29,7 @@ import {
} from "@budibase/types" } from "@budibase/types"
import sdk from "../sdk" import sdk from "../sdk"
import { getAutomationPlugin } from "../utilities/fileSystem" import { getAutomationPlugin } from "../utilities/fileSystem"
import { features } from "@budibase/backend-core"
type ActionImplType = ActionImplementations< type ActionImplType = ActionImplementations<
typeof env.SELF_HOSTED extends "true" ? Hosting.SELF : Hosting.CLOUD typeof env.SELF_HOSTED extends "true" ? Hosting.SELF : Hosting.CLOUD
@ -98,6 +100,9 @@ if (env.SELF_HOSTED) {
} }
export async function getActionDefinitions() { export async function getActionDefinitions() {
if (await features.flags.isEnabled("AUTOMATION_BRANCHING")) {
BUILTIN_ACTION_DEFINITIONS["BRANCH"] = branch.definition
}
const actionDefinitions = BUILTIN_ACTION_DEFINITIONS const actionDefinitions = BUILTIN_ACTION_DEFINITIONS
if (env.SELF_HOSTED) { if (env.SELF_HOSTED) {
const plugins = await sdk.plugins.fetch(PluginType.AUTOMATION) const plugins = await sdk.plugins.fetch(PluginType.AUTOMATION)

View File

@ -566,24 +566,20 @@ class GoogleSheetsIntegration implements DatasourcePlus {
query.filters.equal[`_${GOOGLE_SHEETS_PRIMARY_KEY}`] = id 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) { if (hasFilters && query.paginate) {
filtered = filtered.slice(offset, offset + limit) rows = rows.slice(offset, offset + limit)
} }
const headerValues = sheet.headerValues const headerValues = sheet.headerValues
let response = [] let response = []
for (let row of filtered) { for (let row of rows) {
response.push( 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 (query.sort) {
if (Object.keys(query.sort).length !== 1) { if (Object.keys(query.sort).length !== 1) {
console.warn("Googlesheets does not support multiple sorting", { console.warn("Googlesheets does not support multiple sorting", {

View File

@ -508,15 +508,8 @@ export const search = (
* Performs a client-side search on an array of data * Performs a client-side search on an array of data
* @param docs the data * @param docs the data
* @param query the JSON query * @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 = ( export const runQuery = (docs: Record<string, any>[], query: SearchFilters) => {
docs: Record<string, any>[],
query: SearchFilters,
findInDoc: Function = deepGet
) => {
if (!docs || !Array.isArray(docs)) { if (!docs || !Array.isArray(docs)) {
return [] return []
} }
@ -543,7 +536,7 @@ export const runQuery = (
for (const [key, testValue] of Object.entries(query[type] || {})) { for (const [key, testValue] of Object.entries(query[type] || {})) {
const valueToCheck = isLogicalSearchOperator(type) const valueToCheck = isLogicalSearchOperator(type)
? doc ? doc
: findInDoc(doc, removeKeyNumbering(key)) : deepGet(doc, removeKeyNumbering(key))
const result = test(valueToCheck, testValue) const result = test(valueToCheck, testValue)
if (query.allOr && result) { if (query.allOr && result) {
return true return true