From cb1f87083195399b7beb0469461c2341c4df8ca0 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Wed, 8 Dec 2021 08:35:19 +0000 Subject: [PATCH 1/8] Key links by URL as the svelte-spa-router link svelte action does not update correctly --- .../client/src/components/app/Link.svelte | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/packages/client/src/components/app/Link.svelte b/packages/client/src/components/app/Link.svelte index 851b2f0b66..91537b5b38 100644 --- a/packages/client/src/components/app/Link.svelte +++ b/packages/client/src/components/app/Link.svelte @@ -79,18 +79,20 @@ {componentText} {:else} - - {componentText} - + {#key url} + + {componentText} + + {/key} {/if} {/if} From 49551ceb54fcc020f1e0edc7a7a45b63237310a2 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Wed, 8 Dec 2021 08:36:01 +0000 Subject: [PATCH 2/8] Fix incorrect icon used for repeater layout in settings bar --- packages/client/manifest.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/client/manifest.json b/packages/client/manifest.json index d16b117215..de2ebc51e0 100644 --- a/packages/client/manifest.json +++ b/packages/client/manifest.json @@ -393,13 +393,13 @@ { "label": "Column", "value": "column", - "barIcon": "ViewRow", + "barIcon": "ViewColumn", "barTitle": "Column layout" }, { "label": "Row", "value": "row", - "barIcon": "ViewColumn", + "barIcon": "ViewRow", "barTitle": "Row layout" } ], From 6b20d5cf4616b656eaf7739e17e33b7a743ea329 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Wed, 8 Dec 2021 09:03:56 +0000 Subject: [PATCH 3/8] Allow internal links to be opened in a new tab --- .../client/src/components/app/Link.svelte | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/packages/client/src/components/app/Link.svelte b/packages/client/src/components/app/Link.svelte index 91537b5b38..f47a2a0522 100644 --- a/packages/client/src/components/app/Link.svelte +++ b/packages/client/src/components/app/Link.svelte @@ -21,11 +21,25 @@ $: target = openInNewTab ? "_blank" : "_self" $: placeholder = $builderStore.inBuilder && !text $: componentText = getComponentText(text, $builderStore, $component) + $: sanitizedUrl = getSanitizedUrl(url, externalLink, openInNewTab) // Add color styles to main styles object, otherwise the styleable helper // overrides the color when it's passed as inline style. $: styles = enrichStyles($component.styles, color) + const getSanitizedUrl = (url, externalLink, newTab) => { + if (!url) { + return externalLink || newTab ? "#/" : "/" + } + if (externalLink) { + return url + } + if (openInNewTab) { + return `#${url}` + } + return url + } + const getComponentText = (text, builderState, componentState) => { if (!builderState.inBuilder || componentState.editing) { return text || "" @@ -65,10 +79,10 @@ {componentText} {:else if $builderStore.inBuilder || componentText} - {#if externalLink} + {#if externalLink || openInNewTab} {:else} - {#key url} + {#key sanitizedUrl} Date: Wed, 8 Dec 2021 09:31:39 +0000 Subject: [PATCH 4/8] Fix query params directly mutating the stored app definition --- .../PropertyControls/DataSourceSelect.svelte | 34 +++++++++++-------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/DataSourceSelect.svelte b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/DataSourceSelect.svelte index dc1b24077a..4cb080d0c9 100644 --- a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/DataSourceSelect.svelte +++ b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/DataSourceSelect.svelte @@ -31,6 +31,7 @@ const arrayTypes = ["attachment", "array"] let anchorRight, dropdownRight let drawer + let tmpQueryParams $: text = value?.label ?? "Choose an option" $: tables = $tablesStore.list.map(m => ({ @@ -105,12 +106,12 @@ } }) - function handleSelected(selected) { + const handleSelected = selected => { dispatch("change", selected) dropdownRight.hide() } - function fetchQueryDefinition(query) { + const fetchQueryDefinition = query => { const source = $datasources.list.find( ds => ds._id === query.datasourceId ).source @@ -124,6 +125,19 @@ const getQueryDatasource = query => { return $datasources.list.find(ds => ds._id === query?.datasourceId) } + + const openQueryParamsDrawer = () => { + tmpQueryParams = value.queryParams + drawer.show() + } + + const saveQueryParams = () => { + handleSelected({ + ...value, + queryParams: tmpQueryParams, + }) + drawer.hide() + }
@@ -134,24 +148,14 @@ on:click={dropdownRight.show} /> {#if value?.type === "query"} - + - + {#if getQueryParams(value).length > 0} From 96e2ada5bd06dcf97c4afdc4b42f90f15e58d58b Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Wed, 8 Dec 2021 09:42:19 +0000 Subject: [PATCH 5/8] Lint --- .../PropertiesPanel/PropertyControls/DataSourceSelect.svelte | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/DataSourceSelect.svelte b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/DataSourceSelect.svelte index 4cb080d0c9..220bd41205 100644 --- a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/DataSourceSelect.svelte +++ b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/DataSourceSelect.svelte @@ -17,7 +17,6 @@ queries as queriesStore, } from "stores/backend" import { datasources, integrations } from "stores/backend" - import { notifications } from "@budibase/bbui" import ParameterBuilder from "components/integration/QueryParameterBuilder.svelte" import IntegrationQueryEditor from "components/integration/index.svelte" import { makePropSafe as safe } from "@budibase/string-templates" From a90cfc3e73a16e26651aeb2838b2cb10332b1bc0 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Wed, 8 Dec 2021 09:45:50 +0000 Subject: [PATCH 6/8] Coerce picker option labels to string to fix bug when using autocomplete with numeric labels --- packages/bbui/src/Form/Core/Picker.svelte | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/bbui/src/Form/Core/Picker.svelte b/packages/bbui/src/Form/Core/Picker.svelte index 5f4da1cad9..1af819e44a 100644 --- a/packages/bbui/src/Form/Core/Picker.svelte +++ b/packages/bbui/src/Form/Core/Picker.svelte @@ -63,9 +63,9 @@ const getFilteredOptions = (options, term, getLabel) => { if (autocomplete && term) { const lowerCaseTerm = term.toLowerCase() - return options.filter(option => - getLabel(option)?.toLowerCase().includes(lowerCaseTerm) - ) + return options.filter(option => { + return `${getLabel(option)}`?.toLowerCase().includes(lowerCaseTerm) + }) } return options } From b8b66b0c0715c16d0d611baf24fceeb99a877f4f Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Wed, 8 Dec 2021 09:47:43 +0000 Subject: [PATCH 7/8] Remove unnecessary optional chaining --- packages/bbui/src/Form/Core/Picker.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/bbui/src/Form/Core/Picker.svelte b/packages/bbui/src/Form/Core/Picker.svelte index 1af819e44a..143536a60a 100644 --- a/packages/bbui/src/Form/Core/Picker.svelte +++ b/packages/bbui/src/Form/Core/Picker.svelte @@ -64,7 +64,7 @@ if (autocomplete && term) { const lowerCaseTerm = term.toLowerCase() return options.filter(option => { - return `${getLabel(option)}`?.toLowerCase().includes(lowerCaseTerm) + return `${getLabel(option)}`.toLowerCase().includes(lowerCaseTerm) }) } return options From 90011b53ccd1af548c1fedbddb0b9427a97d7653 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Wed, 8 Dec 2021 10:59:26 +0000 Subject: [PATCH 8/8] Use full runtime bindings in automation settings and enable JS bindings for backend log action --- .../SetupPanel/AutomationBlockSetup.svelte | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte b/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte index e7208518d5..acda9b89e0 100644 --- a/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte +++ b/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte @@ -96,13 +96,16 @@ allSteps[idx].schema?.outputs?.properties ?? {} ) bindings = bindings.concat( - outputs.map(([name, value]) => ({ - label: name, - type: value.type, - description: value.description, - category: idx === 0 ? "Trigger outputs" : `Step ${idx} outputs`, - path: idx === 0 ? `trigger.${name}` : `steps.${idx}.${name}`, - })) + outputs.map(([name, value]) => { + const runtime = idx === 0 ? `trigger.${name}` : `steps.${idx}.${name}` + return { + label: runtime, + type: value.type, + description: value.description, + category: idx === 0 ? "Trigger outputs" : `Step ${idx} outputs`, + path: runtime, + } + }) ) } return bindings @@ -261,7 +264,6 @@ value={inputData[key]} on:change={e => onChange(e, key)} {bindings} - allowJS={false} />
{/if}