diff --git a/frontend/src/lib/components/ObjectResourceInput.svelte b/frontend/src/lib/components/ObjectResourceInput.svelte index 911f8c61e7..5c3c0659d1 100644 --- a/frontend/src/lib/components/ObjectResourceInput.svelte +++ b/frontend/src/lib/components/ObjectResourceInput.svelte @@ -1,5 +1,6 @@
- { - path = e.detail - resourceToValue() - }} - bind:value={path} - resourceType={format.split('-').length > 1 ? format.substring('resource-'.length) : undefined} - {showSchemaExplorer} - /> + {#if format === 'resource-s3_object'} + + {:else} + { + path = e.detail + resourceToValue() + }} + bind:value={path} + resourceType={format.split('-').length > 1 ? format.substring('resource-'.length) : undefined} + {showSchemaExplorer} + /> + {/if}
diff --git a/frontend/src/lib/components/ResourceTypePicker.svelte b/frontend/src/lib/components/ResourceTypePicker.svelte index 9ce6c90231..5f59d907fc 100644 --- a/frontend/src/lib/components/ResourceTypePicker.svelte +++ b/frontend/src/lib/components/ResourceTypePicker.svelte @@ -4,7 +4,7 @@ import { ResourceService } from '$lib/gen' import { workspaceStore } from '$lib/stores' import IconedResourceType from './IconedResourceType.svelte' - import { Button } from './common' + import { Button, ClearableInput } from './common' let resources: string[] = [] @@ -27,10 +27,16 @@ $: if ($workspaceStore) { loadResources() } + let search: string = '' + + $: filteredResources = resources.filter((r) => r.toLowerCase().includes(search.toLowerCase())) +
+ +
- {#if nonePickable} + {#if nonePickable && search === ''} {@const isPicked = value === undefined} {/each} + + {#if filteredResources.length === 0 && search !== ''} +
No resources found
+ {/if}
diff --git a/frontend/src/lib/components/S3ObjectPicker.svelte b/frontend/src/lib/components/S3ObjectPicker.svelte new file mode 100644 index 0000000000..bfa185d776 --- /dev/null +++ b/frontend/src/lib/components/S3ObjectPicker.svelte @@ -0,0 +1,94 @@ + + + { + rawValue = JSON.stringify(value, null, 2) + editor?.setCode(rawValue) + }} + readOnlyMode={false} +/> + +
+ + {#if s3FileUploadRawMode} + { + dispatch('focus') + }} + code={JSON.stringify({ s3: '' }, null, 2)} + bind:value + /> + + {:else} + { + value = { + s3: evt.detail?.path ?? '' + } + }} + on:deletion={(evt) => { + value = { + s3: '' + } + }} + /> + {/if} +
diff --git a/frontend/src/lib/components/SchemaModal.svelte b/frontend/src/lib/components/SchemaModal.svelte index 3a40754b7e..f81c631ac7 100644 --- a/frontend/src/lib/components/SchemaModal.svelte +++ b/frontend/src/lib/components/SchemaModal.svelte @@ -5,7 +5,26 @@ import Tabs from './common/tabs/Tabs.svelte' import SchemaEditor from './SchemaEditor.svelte' - export const ARG_TYPES = ['integer', 'number', 'string', 'boolean', 'object', 'array'] as const + export const ARG_TYPES = [ + 'integer', + 'number', + 'string', + 'boolean', + 'object', + 'array', + 'S3' + ] as const + + const argTypesLabels = { + integer: 'Integer', + number: 'Number', + string: 'String', + boolean: 'Boolean', + object: 'Object', + array: 'Array', + S3: 'S3 Object' + } as const + export type ArgType = (typeof ARG_TYPES)[number] export function schemaToModal( @@ -123,6 +142,14 @@ let title = '' $: title = editing ? `Edit ${oldArgName} argument` : 'Add an argument' + + function getResourceTypesFromFormat(format: string | undefined): string[] { + if (format?.startsWith('resource-')) { + return [format.split('-')[1]] + } + + return [] + } @@ -162,15 +189,25 @@
Type
{#each ARG_TYPES as argType} - {@const isSelected = argType == property.selectedType} + {@const isSelected = + (argType === 'S3' && property.format === 'resource-s3_object') || + (argType === property.selectedType && property.format !== 'resource-s3_object')} {/each}