* feat: accept signed s3 objects for s3 file keys in apps + sign endpoint and helpers * Update backend/windmill-api/openapi.yaml Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com> * fix build * Update python-client/wmill/wmill/client.py Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com> * nti * fix build * fix build * presigned * Update frontend/src/lib/components/apps/editor/settingsPanel/InputsSpecEditor.svelte Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com> * Update frontend/src/lib/components/apps/editor/settingsPanel/InputsSpecEditor.svelte Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com> * fix build * b * fix sqlx * nit * typo --------- Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com> Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
99 lines
2.0 KiB
Svelte
99 lines
2.0 KiB
Svelte
<script lang="ts">
|
|
import { Loader2, Pipette } from 'lucide-svelte'
|
|
import { createEventDispatcher } from 'svelte'
|
|
// @ts-ignore
|
|
import type SimpleEditor from './SimpleEditor.svelte'
|
|
|
|
import { Button } from './common'
|
|
|
|
import Toggle from './Toggle.svelte'
|
|
|
|
import S3FilePicker from './S3FilePicker.svelte'
|
|
import FileUpload from './common/fileUpload/FileUpload.svelte'
|
|
|
|
export let value: any
|
|
export let editor: SimpleEditor | undefined = undefined
|
|
|
|
const dispatch = createEventDispatcher()
|
|
|
|
let s3FilePicker: S3FilePicker
|
|
let s3FileUploadRawMode: false
|
|
let el: HTMLTextAreaElement | undefined = undefined
|
|
let rawValue: string | undefined = undefined
|
|
|
|
function evalValueToRaw() {
|
|
rawValue = JSON.stringify(value, null, 2)
|
|
}
|
|
|
|
evalValueToRaw()
|
|
|
|
export function focus() {
|
|
el?.focus()
|
|
if (el) {
|
|
el.style.height = '5px'
|
|
el.style.height = el.scrollHeight + 50 + 'px'
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<S3FilePicker
|
|
bind:this={s3FilePicker}
|
|
bind:selectedFileKey={value}
|
|
on:close={() => {
|
|
rawValue = JSON.stringify(value, null, 2)
|
|
editor?.setCode(rawValue)
|
|
}}
|
|
readOnlyMode={false}
|
|
/>
|
|
|
|
<div class="flex flex-col w-full gap-1">
|
|
<Toggle
|
|
class="flex justify-end"
|
|
bind:checked={s3FileUploadRawMode}
|
|
size="xs"
|
|
options={{ left: 'Raw S3 object input' }}
|
|
/>
|
|
{#if s3FileUploadRawMode}
|
|
{#await import('$lib/components/JsonEditor.svelte')}
|
|
<Loader2 class="animate-spin" />
|
|
{:then Module}
|
|
<Module.default
|
|
bind:editor
|
|
on:focus={(e) => {
|
|
dispatch('focus')
|
|
}}
|
|
code={JSON.stringify(value ?? { s3: '' }, null, 2)}
|
|
bind:value
|
|
/>
|
|
{/await}
|
|
{:else}
|
|
<FileUpload
|
|
allowMultiple={false}
|
|
randomFileKey={true}
|
|
on:addition={(evt) => {
|
|
value = {
|
|
s3: evt.detail?.path ?? ''
|
|
}
|
|
}}
|
|
on:deletion={(evt) => {
|
|
value = {
|
|
s3: ''
|
|
}
|
|
}}
|
|
defaultValue={value?.s3}
|
|
/>
|
|
{/if}
|
|
<Button
|
|
variant="border"
|
|
color="light"
|
|
size="xs"
|
|
btnClasses="mt-1"
|
|
on:click={() => {
|
|
s3FilePicker?.open?.(value)
|
|
}}
|
|
startIcon={{ icon: Pipette }}
|
|
>
|
|
Choose an object from the catalog
|
|
</Button>
|
|
</div>
|