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 858bfa8801..429ba1c683 100644 --- a/packages/builder/src/builderStore/dataBinding.js +++ b/packages/builder/src/builderStore/dataBinding.js @@ -232,6 +232,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/backend/DataTable/RowFieldControl.svelte b/packages/builder/src/components/backend/DataTable/RowFieldControl.svelte index 3390b95288..075b556134 100644 --- a/packages/builder/src/components/backend/DataTable/RowFieldControl.svelte +++ b/packages/builder/src/components/backend/DataTable/RowFieldControl.svelte @@ -11,8 +11,9 @@ import { capitalise } from "../../../helpers" import LinkedRowSelector from "components/common/LinkedRowSelector.svelte" + export let defaultValue export let meta - export let value = meta.type === "boolean" ? false : "" + export let value = defaultValue || (meta.type === "boolean" ? false : "") export let readonly $: type = meta.type diff --git a/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte b/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte index 1e3f820d69..ae19489575 100644 --- a/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte +++ b/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte @@ -7,7 +7,6 @@ Select, Toggle, Radio, - } from "@budibase/bbui" import { cloneDeep } from "lodash/fp" import { backendUiStore } from "builderStore" @@ -38,12 +37,14 @@ $backendUiStore.selectedTable.primaryDisplay === field.name let relationshipTypes = [ - {text: 'Many to many (N:N)', value: 'many-to-many',}, - {text: 'One to many (1:N)', value: 'one-to-many',} + { text: "Many to many (N:N)", value: "many-to-many" }, + { text: "One to many (1:N)", value: "one-to-many" }, ] - let types = ['Many to many (N:N)', 'One to many (1:N)'] + let types = ["Many to many (N:N)", "One to many (1:N)"] - let selectedRelationshipType = relationshipTypes.find(type => type.value === field.relationshipType)?.text || 'Many to many (N:N)' + let selectedRelationshipType = + relationshipTypes.find(type => type.value === field.relationshipType) + ?.text || "Many to many (N:N)" let indexes = [...($backendUiStore.selectedTable.indexes || [])] let confirmDeleteDialog @@ -68,10 +69,12 @@ field.type !== LINK_TYPE && !uneditable && field.type !== AUTO_COL async function saveColumn() { - // Set relationship type if it's - if (field.type === 'link') { - field.relationshipType = relationshipTypes.find(type => type.text === selectedRelationshipType).value - } + // Set relationship type if it's + if (field.type === "link") { + field.relationshipType = relationshipTypes.find( + type => type.text === selectedRelationshipType + ).value + } if (field.type === AUTO_COL) { field = buildAutoColumn( @@ -228,11 +231,15 @@ label="Max Value" bind:value={field.constraints.numericality.lessThanOrEqualTo} /> {:else if field.type === 'link'} -
+
{#each types as type} - + {/each} @@ -282,7 +289,7 @@ .radio-buttons { display: flex; gap: var(--spacing-m); - font-size: var(--font-size-xs) + font-size: var(--font-size-xs); } .actions { display: grid; diff --git a/packages/builder/src/components/backend/DataTable/modals/CreateEditUser.svelte b/packages/builder/src/components/backend/DataTable/modals/CreateEditUser.svelte index aac515e74b..5753b7d5bb 100644 --- a/packages/builder/src/components/backend/DataTable/modals/CreateEditUser.svelte +++ b/packages/builder/src/components/backend/DataTable/modals/CreateEditUser.svelte @@ -29,6 +29,7 @@ let customSchema = { ...schema } delete customSchema["email"] delete customSchema["roleId"] + delete customSchema["status"] return Object.entries(customSchema) } @@ -79,7 +80,13 @@ {/each} + {#each customSchemaKeys as [key, meta]} - + {#if !meta.autocolumn} + + {/if} {/each} 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} /> -
-
diff --git a/packages/builder/src/pages/[application]/data/datasource/[selectedDatasource]/index.svelte b/packages/builder/src/pages/[application]/data/datasource/[selectedDatasource]/index.svelte index e6821e16fe..6415f3f9de 100644 --- a/packages/builder/src/pages/[application]/data/datasource/[selectedDatasource]/index.svelte +++ b/packages/builder/src/pages/[application]/data/datasource/[selectedDatasource]/index.svelte @@ -45,20 +45,22 @@ {#if datasource}
- +
+ height="26" + width="26" />

{datasource.name}

{integration.description} - +
+ +
@@ -70,14 +72,14 @@ Connect your database to Budibase using the config below. - + - - +
- + +
Queries @@ -99,15 +101,16 @@