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
This commit is contained in:
parent
cc9ac15fd3
commit
3697ff3efc
|
@ -69,7 +69,15 @@
|
||||||
on:change={e => onChange(e, field)}
|
on:change={e => onChange(e, field)}
|
||||||
useLabel={false}
|
useLabel={false}
|
||||||
/>
|
/>
|
||||||
{:else if schema.type === "string" || schema.type === "number"}
|
{:else if schema.type === "bb_reference"}
|
||||||
|
<LinkedRowSelector
|
||||||
|
linkedRows={value[field]}
|
||||||
|
{schema}
|
||||||
|
linkedTableId={"ta_users"}
|
||||||
|
on:change={e => onChange(e, field)}
|
||||||
|
useLabel={false}
|
||||||
|
/>
|
||||||
|
{:else if ["string", "number", "bigint", "barcodeqr"].includes(schema.type)}
|
||||||
<svelte:component
|
<svelte:component
|
||||||
this={isTestModal ? ModalBindableInput : DrawerBindableInput}
|
this={isTestModal ? ModalBindableInput : DrawerBindableInput}
|
||||||
panel={AutomationBindingPanel}
|
panel={AutomationBindingPanel}
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
export let schema
|
export let schema
|
||||||
export let linkedRows = []
|
export let linkedRows = []
|
||||||
export let useLabel = true
|
export let useLabel = true
|
||||||
|
export let linkedTableId
|
||||||
|
export let label
|
||||||
const dispatch = createEventDispatcher()
|
const dispatch = createEventDispatcher()
|
||||||
|
|
||||||
let rows = []
|
let rows = []
|
||||||
|
@ -16,8 +18,8 @@
|
||||||
$: linkedIds = (Array.isArray(linkedRows) ? linkedRows : [])?.map(
|
$: linkedIds = (Array.isArray(linkedRows) ? linkedRows : [])?.map(
|
||||||
row => row?._id || row
|
row => row?._id || row
|
||||||
)
|
)
|
||||||
$: label = capitalise(schema.name)
|
$: label = label || capitalise(schema.name)
|
||||||
$: linkedTableId = schema.tableId
|
$: linkedTableId = linkedTableId || schema.tableId
|
||||||
$: linkedTable = $tables.list.find(table => table._id === linkedTableId)
|
$: linkedTable = $tables.list.find(table => table._id === linkedTableId)
|
||||||
$: fetchRows(linkedTableId)
|
$: fetchRows(linkedTableId)
|
||||||
|
|
||||||
|
@ -57,7 +59,7 @@
|
||||||
{:else}
|
{:else}
|
||||||
<Multiselect
|
<Multiselect
|
||||||
value={linkedIds}
|
value={linkedIds}
|
||||||
{label}
|
label={useLabel ? label : null}
|
||||||
options={rows}
|
options={rows}
|
||||||
getOptionLabel={getPrettyName}
|
getOptionLabel={getPrettyName}
|
||||||
getOptionValue={row => row._id}
|
getOptionValue={row => row._id}
|
||||||
|
|
|
@ -113,7 +113,7 @@
|
||||||
if (type === "json" && !isJSBinding(value)) {
|
if (type === "json" && !isJSBinding(value)) {
|
||||||
return "json-slot-icon"
|
return "json-slot-icon"
|
||||||
}
|
}
|
||||||
if (type !== "string" && type !== "number") {
|
if (!["string", "number", "bigint", "barcodeqr"].includes(type)) {
|
||||||
return "slot-icon"
|
return "slot-icon"
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
|
|
|
@ -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
|
// clear any undefined, null or empty string properties so that they aren't updated
|
||||||
for (let propKey of Object.keys(inputs.row)) {
|
for (let propKey of Object.keys(inputs.row)) {
|
||||||
|
const clearRelationships =
|
||||||
|
inputs.meta?.fields?.[propKey]?.clearRelationships
|
||||||
if (
|
if (
|
||||||
(inputs.row[propKey] == null || inputs.row[propKey] === "") &&
|
(inputs.row[propKey] == null || inputs.row[propKey]?.length === 0) &&
|
||||||
!inputs.meta?.fields?.[propKey]?.clearRelationships
|
!clearRelationships
|
||||||
) {
|
) {
|
||||||
delete inputs.row[propKey]
|
delete inputs.row[propKey]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue