Merge branch 'master' into instrument-couch

This commit is contained in:
Sam Rose 2023-12-19 11:26:13 +00:00 committed by GitHub
commit 5b3ec0b94d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 23 additions and 9 deletions

View File

@ -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}

View File

@ -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}

View File

@ -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 ""

View File

@ -164,7 +164,8 @@
// Required constraint // Required constraint
if ( if (
field === dataSourceSchema?.table?.primaryDisplay || field === dataSourceSchema?.table?.primaryDisplay ||
constraints.presence?.allowEmpty === false constraints.presence?.allowEmpty === false ||
constraints.presence === true
) { ) {
rules.push({ rules.push({
constraint: "required", constraint: "required",

View File

@ -23,7 +23,8 @@ export const createValidatorFromConstraints = (
// Required constraint // Required constraint
if ( if (
field === table?.primaryDisplay || field === table?.primaryDisplay ||
schemaConstraints.presence?.allowEmpty === false schemaConstraints.presence?.allowEmpty === false ||
schemaConstraints.presence === true
) { ) {
rules.push({ rules.push({
type: schemaConstraints.type == "array" ? "array" : "string", type: schemaConstraints.type == "array" ? "array" : "string",

View File

@ -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]
} }