Fix for progress circle appearing in the builder and allow binding of S3Upload value in S3Upload settings

This commit is contained in:
Dean 2024-12-13 09:26:53 +00:00
parent 8144f04e05
commit 87bfbf0e93
2 changed files with 15 additions and 3 deletions

View File

@ -5139,7 +5139,8 @@
{ {
"type": "text", "type": "text",
"label": "File name", "label": "File name",
"key": "key" "key": "key",
"nested": true
}, },
{ {
"type": "event", "type": "event",

View File

@ -2,6 +2,8 @@
import Field from "./Field.svelte" import Field from "./Field.svelte"
import { CoreDropzone, ProgressCircle, Helpers } from "@budibase/bbui" import { CoreDropzone, ProgressCircle, Helpers } from "@budibase/bbui"
import { getContext, onMount, onDestroy } from "svelte" import { getContext, onMount, onDestroy } from "svelte"
import { builderStore } from "stores/builder.js"
import { processStringSync } from "@budibase/string-templates"
export let datasourceId export let datasourceId
export let bucket export let bucket
@ -42,6 +44,9 @@
// Process the file input and return a serializable structure expected by // Process the file input and return a serializable structure expected by
// the dropzone component to display the file // the dropzone component to display the file
const processFiles = async fileList => { const processFiles = async fileList => {
if ($builderStore.inBuilder) {
return []
}
return await new Promise(resolve => { return await new Promise(resolve => {
if (!fileList?.length) { if (!fileList?.length) {
return [] return []
@ -78,12 +83,15 @@
} }
const upload = async () => { const upload = async () => {
const processedFileKey = processStringSync(key, {
[$component.id]: fieldState,
})
loading = true loading = true
try { try {
const res = await API.externalUpload({ const res = await API.externalUpload({
datasourceId, datasourceId,
bucket, bucket,
key, key: processedFileKey,
data, data,
}) })
notificationStore.actions.success("File uploaded successfully") notificationStore.actions.success("File uploaded successfully")
@ -131,7 +139,7 @@
bind:fieldApi bind:fieldApi
defaultValue={[]} defaultValue={[]}
> >
<div class="content"> <div class="content" class:builder={$builderStore.inBuilder}>
{#if fieldState} {#if fieldState}
<CoreDropzone <CoreDropzone
value={localFiles} value={localFiles}
@ -154,6 +162,9 @@
</Field> </Field>
<style> <style>
.content.builder :global(.spectrum-Dropzone) {
pointer-events: none;
}
.content { .content {
position: relative; position: relative;
} }