diff --git a/packages/builder/package.json b/packages/builder/package.json index bf4c4b4a89..fdcb9ae4a1 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -63,7 +63,7 @@ } }, "dependencies": { - "@budibase/bbui": "^1.58.12", + "@budibase/bbui": "^1.58.13", "@budibase/client": "^0.7.8", "@budibase/colorpicker": "1.0.1", "@budibase/string-templates": "^0.7.8", diff --git a/packages/builder/src/builderStore/dataBinding.js b/packages/builder/src/builderStore/dataBinding.js index b2eb30c55a..eaf64b23b9 100644 --- a/packages/builder/src/builderStore/dataBinding.js +++ b/packages/builder/src/builderStore/dataBinding.js @@ -231,6 +231,15 @@ export const getSchemaForDatasource = (datasource, isForm = false) => { if (table) { if (type === "view") { schema = cloneDeep(table.views?.[datasource.name]?.schema) + + // Some calc views don't include a "name" property inside the schema + if (schema) { + Object.keys(schema).forEach(field => { + if (!schema[field].name) { + schema[field].name = field + } + }) + } } else if (type === "query" && isForm) { schema = {} const params = table.parameters || [] diff --git a/packages/builder/src/components/common/DrawerBindableInput.svelte b/packages/builder/src/components/common/DrawerBindableInput.svelte index 4b0109270a..b534376a55 100644 --- a/packages/builder/src/components/common/DrawerBindableInput.svelte +++ b/packages/builder/src/components/common/DrawerBindableInput.svelte @@ -10,10 +10,13 @@ export let value = "" export let bindings = [] + export let thin = true + export let title = "Bindings" + export let placeholder let bindingDrawer - let tempValue = value + $: tempValue = value $: readableValue = runtimeToReadableBinding(bindings, value) const handleClose = () => { @@ -28,15 +31,15 @@
onChange(event.target.value)} - placeholder="/screen" /> + {placeholder} />
- +
Add the objects on the left to enrich your text. @@ -57,7 +60,6 @@ diff --git a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/EventsEditor/EventPropertyControl.svelte b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/EventsEditor/EventPropertyControl.svelte index 241864839a..9a239a4e1b 100644 --- a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/EventsEditor/EventPropertyControl.svelte +++ b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/EventsEditor/EventPropertyControl.svelte @@ -17,7 +17,9 @@ const automationsToCreate = value.filter( action => action["##eventHandlerType"] === "Trigger Automation" ) - automationsToCreate.forEach(action => createAutomation(action.parameters)) + for (let action of automationsToCreate) { + await createAutomation(action.parameters) + } dispatch("change", value) notifier.success("Component actions saved.") @@ -27,11 +29,8 @@ // called by the parent modal when actions are saved const createAutomation = async parameters => { if (parameters.automationId || !parameters.newAutomationName) return - await automationStore.actions.create({ name: parameters.newAutomationName }) - const appActionDefinition = $automationStore.blockDefinitions.TRIGGER.APP - const newBlock = $automationStore.selectedAutomation.constructBlock( "TRIGGER", "APP", @@ -39,19 +38,14 @@ ) newBlock.inputs = { - fields: Object.entries(parameters.fields).reduce( - (fields, [key, value]) => { - fields[key] = value.type - return fields - }, - {} - ), + fields: Object.keys(parameters.fields).reduce((fields, key) => { + fields[key] = "string" + return fields + }, {}), } automationStore.actions.addBlockToAutomation(newBlock) - await automationStore.actions.save($automationStore.selectedAutomation) - parameters.automationId = $automationStore.selectedAutomation.automation._id delete parameters.newAutomationName } diff --git a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/EventsEditor/actions/DeleteRow.svelte b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/EventsEditor/actions/DeleteRow.svelte index 79ee23acd7..425c6f9c58 100644 --- a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/EventsEditor/actions/DeleteRow.svelte +++ b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/EventsEditor/actions/DeleteRow.svelte @@ -37,8 +37,8 @@ a List
{:else} - - @@ -50,22 +50,15 @@ diff --git a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/EventsEditor/actions/ExecuteQuery.svelte b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/EventsEditor/actions/ExecuteQuery.svelte index 68ed77f1d2..e18336fab5 100644 --- a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/EventsEditor/actions/ExecuteQuery.svelte +++ b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/EventsEditor/actions/ExecuteQuery.svelte @@ -3,63 +3,57 @@ import { store, backendUiStore, currentAsset } from "builderStore" import { getBindableProperties } from "builderStore/dataBinding" import ParameterBuilder from "components/integration/QueryParameterBuilder.svelte" + import IntegrationQueryEditor from "components/integration/index.svelte" export let parameters + $: query = $backendUiStore.queries.find(q => q._id === parameters.queryId) $: datasource = $backendUiStore.datasources.find( ds => ds._id === parameters.datasourceId ) $: bindableProperties = getBindableProperties( $currentAsset, $store.selectedComponentId - ).map(property => ({ - ...property, - category: property.type === "instance" ? "Component" : "Table", - label: property.readableBinding, - path: property.runtimeBinding, - })) + ) - $: query = - parameters.queryId && - $backendUiStore.queries.find(query => query._id === parameters.queryId) + function fetchQueryDefinition(query) { + const source = $backendUiStore.datasources.find( + ds => ds._id === query.datasourceId + ).source + return $backendUiStore.integrations[source].query[query.queryVerb] + } -
- - + + {/each} + + + + +{#if parameters.datasourceId} + + +{/if} - + - {#if parameters.datasourceId} - - - {/if} - - - - {#if query?.parameters?.length > 0} - - {#if query.fields.sql} -
{query.fields.queryString}
- {/if} - {/if} -
- - +{#if query?.parameters?.length > 0} + + +{/if} diff --git a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/EventsEditor/actions/NavigateTo.svelte b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/EventsEditor/actions/NavigateTo.svelte index 9d814bf369..65071837e7 100644 --- a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/EventsEditor/actions/NavigateTo.svelte +++ b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/EventsEditor/actions/NavigateTo.svelte @@ -13,8 +13,10 @@
- + (parameters.url = value.detail)} {bindings} /> diff --git a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/EventsEditor/actions/RefreshDatasource.svelte b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/EventsEditor/actions/RefreshDatasource.svelte deleted file mode 100644 index 7be21fe153..0000000000 --- a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/EventsEditor/actions/RefreshDatasource.svelte +++ /dev/null @@ -1,37 +0,0 @@ - - -
- - -
- - diff --git a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/EventsEditor/actions/SaveFields.svelte b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/EventsEditor/actions/SaveFields.svelte index a7c44a5d6a..fb5cb3ef16 100644 --- a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/EventsEditor/actions/SaveFields.svelte +++ b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/EventsEditor/actions/SaveFields.svelte @@ -1,115 +1,89 @@ {#if fields} - {#each fields as field} - + {#each fields as field, idx} + {#if schemaFields} - updateFieldName(idx, event.target.value)}> {/each} {:else} - + updateFieldName(idx, event.target.value)} /> {/if} - - - - {/each} - + + updateFieldValue(idx, event.detail)} />
- + removeField(field[0])}>
{/each} -
- Add {fieldLabel} diff --git a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/EventsEditor/actions/SaveRow.svelte b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/EventsEditor/actions/SaveRow.svelte index d28a61dc39..bea93615c2 100644 --- a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/EventsEditor/actions/SaveRow.svelte +++ b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/EventsEditor/actions/SaveRow.svelte @@ -37,8 +37,8 @@ Repeater
{:else} - - @@ -49,7 +49,7 @@ + on:change={onFieldsChanged} /> {/if} {/if}
@@ -57,7 +57,7 @@ diff --git a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/EventsEditor/actions/TriggerAutomation.svelte b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/EventsEditor/actions/TriggerAutomation.svelte index 3f61bbcb7e..1a3276800a 100644 --- a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/EventsEditor/actions/TriggerAutomation.svelte +++ b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/EventsEditor/actions/TriggerAutomation.svelte @@ -27,13 +27,11 @@ schema, } }) - $: hasAutomations = automations && automations.length > 0 - - $: selectedAutomation = - parameters && - parameters.automationId && - automations.find(a => a._id === parameters.automationId) + $: selectedAutomation = automations?.find( + a => a._id === parameters?.automationId + ) + $: selectedSchema = selectedAutomation?.schema const onFieldsChanged = e => { parameters.fields = e.detail @@ -42,95 +40,98 @@ const setNew = () => { automationStatus = AUTOMATION_STATUS.NEW parameters.automationId = undefined + parameters.fields = {} } const setExisting = () => { automationStatus = AUTOMATION_STATUS.EXISTING parameters.newAutomationName = "" + parameters.fields = {} + parameters.automationId = automations[0]?._id }
-
- - - +
+
+ + +
+
+ + +
-
- +
+ - + {#if automationStatus === AUTOMATION_STATUS.EXISTING} + + {:else} + + {/if} + + {#key parameters.automationId} + + {/key}
- - - - {#if automationStatus === AUTOMATION_STATUS.EXISTING} - - {:else} - - {/if} - -
diff --git a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/EventsEditor/actions/ValidateForm.svelte b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/EventsEditor/actions/ValidateForm.svelte index 3ebfda0bbb..d1f67015d5 100644 --- a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/EventsEditor/actions/ValidateForm.svelte +++ b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/EventsEditor/actions/ValidateForm.svelte @@ -13,8 +13,8 @@
- -
+ +
+ + Add the objects on the left to enrich your text. + +
+ + + +
+ (temporaryBindableValue = e.detail)} + {bindableProperties} /> +
+
{/if}
- -
- - Add the objects on the left to enrich your text. - -
- - - -
- (temporaryBindableValue = e.detail)} - {bindableProperties} /> -
-