From 3697ff3efcbced61dedbf701032787c0c05c48c4 Mon Sep 17 00:00:00 2001 From: melohagan <101575380+melohagan@users.noreply.github.com> Date: Tue, 19 Dec 2023 10:26:28 +0000 Subject: [PATCH] Support Barcode, BigInt and User column types in automations (#12610) * Support barcode and bigint in automations * Support users in LinkedRowSelector * Fix clear relationships if empty * Make sure clearRelationships is initialised to false * Revert yarn lock * Refactor * Refactor --- .../automation/SetupPanel/RowSelectorTypes.svelte | 10 +++++++++- .../src/components/common/LinkedRowSelector.svelte | 8 +++++--- .../common/bindings/DrawerBindableSlot.svelte | 2 +- packages/server/src/automations/steps/updateRow.ts | 6 ++++-- 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/packages/builder/src/components/automation/SetupPanel/RowSelectorTypes.svelte b/packages/builder/src/components/automation/SetupPanel/RowSelectorTypes.svelte index 3fd2708186..851c5b39c9 100644 --- a/packages/builder/src/components/automation/SetupPanel/RowSelectorTypes.svelte +++ b/packages/builder/src/components/automation/SetupPanel/RowSelectorTypes.svelte @@ -69,7 +69,15 @@ on:change={e => onChange(e, field)} useLabel={false} /> -{:else if schema.type === "string" || schema.type === "number"} +{:else if schema.type === "bb_reference"} + onChange(e, field)} + useLabel={false} + /> +{:else if ["string", "number", "bigint", "barcodeqr"].includes(schema.type)} row?._id || row ) - $: label = capitalise(schema.name) - $: linkedTableId = schema.tableId + $: label = label || capitalise(schema.name) + $: linkedTableId = linkedTableId || schema.tableId $: linkedTable = $tables.list.find(table => table._id === linkedTableId) $: fetchRows(linkedTableId) @@ -57,7 +59,7 @@ {:else} row._id} diff --git a/packages/builder/src/components/common/bindings/DrawerBindableSlot.svelte b/packages/builder/src/components/common/bindings/DrawerBindableSlot.svelte index bfef0acac1..6689ddb650 100644 --- a/packages/builder/src/components/common/bindings/DrawerBindableSlot.svelte +++ b/packages/builder/src/components/common/bindings/DrawerBindableSlot.svelte @@ -113,7 +113,7 @@ if (type === "json" && !isJSBinding(value)) { return "json-slot-icon" } - if (type !== "string" && type !== "number") { + if (!["string", "number", "bigint", "barcodeqr"].includes(type)) { return "slot-icon" } return "" diff --git a/packages/server/src/automations/steps/updateRow.ts b/packages/server/src/automations/steps/updateRow.ts index 5ed4e19f61..fea3e981f3 100644 --- a/packages/server/src/automations/steps/updateRow.ts +++ b/packages/server/src/automations/steps/updateRow.ts @@ -84,9 +84,11 @@ export async function run({ inputs, appId, emitter }: AutomationStepInput) { // clear any undefined, null or empty string properties so that they aren't updated for (let propKey of Object.keys(inputs.row)) { + const clearRelationships = + inputs.meta?.fields?.[propKey]?.clearRelationships if ( - (inputs.row[propKey] == null || inputs.row[propKey] === "") && - !inputs.meta?.fields?.[propKey]?.clearRelationships + (inputs.row[propKey] == null || inputs.row[propKey]?.length === 0) && + !clearRelationships ) { delete inputs.row[propKey] }