mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-23 00:00:33 +00:00
fix(frontend): s3 file uploader works on public apps too
This commit is contained in:
@@ -34,7 +34,7 @@
|
||||
}
|
||||
|
||||
let fileUploads: Writable<FileUploadData[]> = writable([])
|
||||
const { app, worldStore, componentControl, runnableComponents } =
|
||||
const { app, worldStore, componentControl, runnableComponents, workspace } =
|
||||
getContext<AppViewerContext>('AppViewerContext')
|
||||
|
||||
$componentControl[id] = {
|
||||
@@ -124,6 +124,7 @@
|
||||
customResourceType="s3"
|
||||
customClass={css?.container?.class}
|
||||
customStyle={css?.container?.style}
|
||||
{workspace}
|
||||
on:addition={(evt) => {
|
||||
const curr = outputs.result.peak()
|
||||
outputs.result.set(curr.concat(evt.detail))
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
export let pathTransformer: any = undefined // function taking as input {file: File} and returning a string
|
||||
export let forceDisplayUploads: boolean = false
|
||||
export let defaultValue: string | undefined = undefined
|
||||
export let workspace: string | undefined = undefined
|
||||
|
||||
const dispatch = createEventDispatcher()
|
||||
|
||||
@@ -154,7 +155,7 @@
|
||||
})
|
||||
xhr?.open(
|
||||
'POST',
|
||||
`/api/w/${$workspaceStore}/job_helpers/upload_s3_file?${params.toString()}`,
|
||||
`/api/w/${workspace ?? $workspaceStore}/job_helpers/upload_s3_file?${params.toString()}`,
|
||||
true
|
||||
)
|
||||
xhr?.setRequestHeader('Content-Type', 'application/octet-stream')
|
||||
@@ -189,7 +190,7 @@
|
||||
|
||||
async function deleteFile(fileKey: string) {
|
||||
await HelpersService.deleteS3File({
|
||||
workspace: $workspaceStore!,
|
||||
workspace: workspace ?? $workspaceStore!,
|
||||
fileKey: fileKey
|
||||
})
|
||||
dispatch('deletion', { path: fileKey })
|
||||
|
||||
Reference in New Issue
Block a user