Merge branch 'ak-fixes' of github.com:Budibase/budibase into fix/incoming-webhooks
This commit is contained in:
commit
acfe5ac0d7
|
@ -63,9 +63,9 @@
|
||||||
const getFilteredOptions = (options, term, getLabel) => {
|
const getFilteredOptions = (options, term, getLabel) => {
|
||||||
if (autocomplete && term) {
|
if (autocomplete && term) {
|
||||||
const lowerCaseTerm = term.toLowerCase()
|
const lowerCaseTerm = term.toLowerCase()
|
||||||
return options.filter(option =>
|
return options.filter(option => {
|
||||||
getLabel(option)?.toLowerCase().includes(lowerCaseTerm)
|
return `${getLabel(option)}`.toLowerCase().includes(lowerCaseTerm)
|
||||||
)
|
})
|
||||||
}
|
}
|
||||||
return options
|
return options
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,13 +96,16 @@
|
||||||
allSteps[idx].schema?.outputs?.properties ?? {}
|
allSteps[idx].schema?.outputs?.properties ?? {}
|
||||||
)
|
)
|
||||||
bindings = bindings.concat(
|
bindings = bindings.concat(
|
||||||
outputs.map(([name, value]) => ({
|
outputs.map(([name, value]) => {
|
||||||
label: name,
|
const runtime = idx === 0 ? `trigger.${name}` : `steps.${idx}.${name}`
|
||||||
type: value.type,
|
return {
|
||||||
description: value.description,
|
label: runtime,
|
||||||
category: idx === 0 ? "Trigger outputs" : `Step ${idx} outputs`,
|
type: value.type,
|
||||||
path: idx === 0 ? `trigger.${name}` : `steps.${idx}.${name}`,
|
description: value.description,
|
||||||
}))
|
category: idx === 0 ? "Trigger outputs" : `Step ${idx} outputs`,
|
||||||
|
path: runtime,
|
||||||
|
}
|
||||||
|
})
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
return bindings
|
return bindings
|
||||||
|
@ -261,7 +264,6 @@
|
||||||
value={inputData[key]}
|
value={inputData[key]}
|
||||||
on:change={e => onChange(e, key)}
|
on:change={e => onChange(e, key)}
|
||||||
{bindings}
|
{bindings}
|
||||||
allowJS={false}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
queries as queriesStore,
|
queries as queriesStore,
|
||||||
} from "stores/backend"
|
} from "stores/backend"
|
||||||
import { datasources, integrations } from "stores/backend"
|
import { datasources, integrations } from "stores/backend"
|
||||||
import { notifications } from "@budibase/bbui"
|
|
||||||
import ParameterBuilder from "components/integration/QueryParameterBuilder.svelte"
|
import ParameterBuilder from "components/integration/QueryParameterBuilder.svelte"
|
||||||
import IntegrationQueryEditor from "components/integration/index.svelte"
|
import IntegrationQueryEditor from "components/integration/index.svelte"
|
||||||
import { makePropSafe as safe } from "@budibase/string-templates"
|
import { makePropSafe as safe } from "@budibase/string-templates"
|
||||||
|
@ -31,6 +30,7 @@
|
||||||
const arrayTypes = ["attachment", "array"]
|
const arrayTypes = ["attachment", "array"]
|
||||||
let anchorRight, dropdownRight
|
let anchorRight, dropdownRight
|
||||||
let drawer
|
let drawer
|
||||||
|
let tmpQueryParams
|
||||||
|
|
||||||
$: text = value?.label ?? "Choose an option"
|
$: text = value?.label ?? "Choose an option"
|
||||||
$: tables = $tablesStore.list.map(m => ({
|
$: tables = $tablesStore.list.map(m => ({
|
||||||
|
@ -105,12 +105,12 @@
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
function handleSelected(selected) {
|
const handleSelected = selected => {
|
||||||
dispatch("change", selected)
|
dispatch("change", selected)
|
||||||
dropdownRight.hide()
|
dropdownRight.hide()
|
||||||
}
|
}
|
||||||
|
|
||||||
function fetchQueryDefinition(query) {
|
const fetchQueryDefinition = query => {
|
||||||
const source = $datasources.list.find(
|
const source = $datasources.list.find(
|
||||||
ds => ds._id === query.datasourceId
|
ds => ds._id === query.datasourceId
|
||||||
).source
|
).source
|
||||||
|
@ -124,6 +124,19 @@
|
||||||
const getQueryDatasource = query => {
|
const getQueryDatasource = query => {
|
||||||
return $datasources.list.find(ds => ds._id === query?.datasourceId)
|
return $datasources.list.find(ds => ds._id === query?.datasourceId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const openQueryParamsDrawer = () => {
|
||||||
|
tmpQueryParams = value.queryParams
|
||||||
|
drawer.show()
|
||||||
|
}
|
||||||
|
|
||||||
|
const saveQueryParams = () => {
|
||||||
|
handleSelected({
|
||||||
|
...value,
|
||||||
|
queryParams: tmpQueryParams,
|
||||||
|
})
|
||||||
|
drawer.hide()
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="container" bind:this={anchorRight}>
|
<div class="container" bind:this={anchorRight}>
|
||||||
|
@ -134,24 +147,14 @@
|
||||||
on:click={dropdownRight.show}
|
on:click={dropdownRight.show}
|
||||||
/>
|
/>
|
||||||
{#if value?.type === "query"}
|
{#if value?.type === "query"}
|
||||||
<i class="ri-settings-5-line" on:click={drawer.show} />
|
<i class="ri-settings-5-line" on:click={openQueryParamsDrawer} />
|
||||||
<Drawer title={"Query Parameters"} bind:this={drawer}>
|
<Drawer title={"Query Parameters"} bind:this={drawer}>
|
||||||
<Button
|
<Button slot="buttons" cta on:click={saveQueryParams}>Save</Button>
|
||||||
slot="buttons"
|
|
||||||
cta
|
|
||||||
on:click={() => {
|
|
||||||
notifications.success("Query parameters saved.")
|
|
||||||
handleSelected(value)
|
|
||||||
drawer.hide()
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
Save
|
|
||||||
</Button>
|
|
||||||
<DrawerContent slot="body">
|
<DrawerContent slot="body">
|
||||||
<Layout noPadding>
|
<Layout noPadding>
|
||||||
{#if getQueryParams(value).length > 0}
|
{#if getQueryParams(value).length > 0}
|
||||||
<ParameterBuilder
|
<ParameterBuilder
|
||||||
bind:customParams={value.queryParams}
|
bind:customParams={tmpQueryParams}
|
||||||
parameters={getQueryParams(value)}
|
parameters={getQueryParams(value)}
|
||||||
{bindings}
|
{bindings}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -393,13 +393,13 @@
|
||||||
{
|
{
|
||||||
"label": "Column",
|
"label": "Column",
|
||||||
"value": "column",
|
"value": "column",
|
||||||
"barIcon": "ViewRow",
|
"barIcon": "ViewColumn",
|
||||||
"barTitle": "Column layout"
|
"barTitle": "Column layout"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "Row",
|
"label": "Row",
|
||||||
"value": "row",
|
"value": "row",
|
||||||
"barIcon": "ViewColumn",
|
"barIcon": "ViewRow",
|
||||||
"barTitle": "Row layout"
|
"barTitle": "Row layout"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
|
@ -21,11 +21,25 @@
|
||||||
$: target = openInNewTab ? "_blank" : "_self"
|
$: target = openInNewTab ? "_blank" : "_self"
|
||||||
$: placeholder = $builderStore.inBuilder && !text
|
$: placeholder = $builderStore.inBuilder && !text
|
||||||
$: componentText = getComponentText(text, $builderStore, $component)
|
$: componentText = getComponentText(text, $builderStore, $component)
|
||||||
|
$: sanitizedUrl = getSanitizedUrl(url, externalLink, openInNewTab)
|
||||||
|
|
||||||
// Add color styles to main styles object, otherwise the styleable helper
|
// Add color styles to main styles object, otherwise the styleable helper
|
||||||
// overrides the color when it's passed as inline style.
|
// overrides the color when it's passed as inline style.
|
||||||
$: styles = enrichStyles($component.styles, color)
|
$: 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) => {
|
const getComponentText = (text, builderState, componentState) => {
|
||||||
if (!builderState.inBuilder || componentState.editing) {
|
if (!builderState.inBuilder || componentState.editing) {
|
||||||
return text || ""
|
return text || ""
|
||||||
|
@ -65,10 +79,10 @@
|
||||||
{componentText}
|
{componentText}
|
||||||
</div>
|
</div>
|
||||||
{:else if $builderStore.inBuilder || componentText}
|
{:else if $builderStore.inBuilder || componentText}
|
||||||
{#if externalLink}
|
{#if externalLink || openInNewTab}
|
||||||
<a
|
<a
|
||||||
{target}
|
{target}
|
||||||
href={url || "/"}
|
href={sanitizedUrl}
|
||||||
use:styleable={styles}
|
use:styleable={styles}
|
||||||
class:placeholder
|
class:placeholder
|
||||||
class:bold
|
class:bold
|
||||||
|
@ -79,18 +93,20 @@
|
||||||
{componentText}
|
{componentText}
|
||||||
</a>
|
</a>
|
||||||
{:else}
|
{:else}
|
||||||
<a
|
{#key sanitizedUrl}
|
||||||
use:linkable
|
<a
|
||||||
href={url || "/"}
|
use:linkable
|
||||||
use:styleable={styles}
|
href={sanitizedUrl}
|
||||||
class:placeholder
|
use:styleable={styles}
|
||||||
class:bold
|
class:placeholder
|
||||||
class:italic
|
class:bold
|
||||||
class:underline
|
class:italic
|
||||||
class="align--{align || 'left'} size--{size || 'M'}"
|
class:underline
|
||||||
>
|
class="align--{align || 'left'} size--{size || 'M'}"
|
||||||
{componentText}
|
>
|
||||||
</a>
|
{componentText}
|
||||||
|
</a>
|
||||||
|
{/key}
|
||||||
{/if}
|
{/if}
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue