{#if workspaceSettingsInitialized === false} {#if fromWorkspaceSettings}

Double check the S3 resource fields and try again.

{:else}

The workspace needs to be connected to an S3 storage to use this feature. You can configure it here.

{/if} {:else} {#if fileListUnavailable == true} {#if replaceUnauthorizedWarning} {@render replaceUnauthorizedWarning()} {:else}

You don't have access to the S3 bucket resource and your administrator has restricted the access to it. You are not authorized to browse the bucket content. If you think this is incorrect, please contact your workspace administrator.

More info in Windmill's documentation

{/if} {/if}
{#if !fileListUnavailable}
{#if !rootPath}
{/if} {#if displayedFileKeys.length === 0} {#if fileListLoading}
Loading content
{:else}
No files in the workspace S3 bucket at that prefix
{/if} {:else}
{#snippet header()}{/snippet} {#snippet footer()}{/snippet} {#snippet item({ index, style })} {@const file_info = allFilesByKey[displayedFileKeys[index]]}
{#if file_info} {@const nestingLevel = file_info.nestingLevel - 2 * rootPathNestingLevel}
selectItem(index)} class={twMerge( 'flex flex-row h-full font-semibold text-xs items-center justify-start', selectedFileKey !== undefined && selectedFileKey.s3 === file_info.full_key ? 'bg-surface-hover' : '' )} >
{#if file_info.type === 'folder'} {#if file_info.collapsed}{:else}{/if}
{file_info.display_name} ({file_info.count}{count % 1000 === 0 && lastKeyFolders[file_info.nestingLevel / 2] === file_info.display_name ? '+' : ''} item{file_info.count === 1 ? '' : 's'})
{:else}
{file_info.display_name}
{/if}
{/if}
{/snippet}
{#if fileListLoading === true}
Loading content
{:else}
{displayedCount}{count % maxKeys === 0 ? '+' : ''} {displayedCount !== count ? 'filtered ' : ''}items (including inside folders)
{#if count % maxKeys === 0} {/if} {/if}
{/if}
{/if}
{#if fileMetadata === undefined}
{#if fileInfoLoading}
{:else if fileListUnavailable}
{:else}
{/if}
{:else}

{((p) => (p.startsWith(rootPath) ? p.slice(rootPath.length) : p))( fileMetadata.fileKey )}

{#if filePreview !== undefined && (!hideS3SpecificDetails || !readOnlyMode || allowDelete)}
{#if !hideS3SpecificDetails} {@const downloadApiPath = `/w/${$workspaceStore}/job_helpers/download_s3_file?file_key=${encodeURIComponent(fileMetadata?.fileKey ?? '')}${storage ? `&storage=${storage}` : ''}`} {@const downloadName = fileMetadata?.fileKey.split('/').pop() ?? 'unnamed_download.file'} {#if shouldDownloadViaClient()}
{/if}
{#if !hideS3SpecificDetails} {/if}
{/if}
{#if filePreviewLoading || fileMetadata} {#if fileMetadata?.fileKey.endsWith('.png') || fileMetadata?.fileKey.endsWith('.jpg') || fileMetadata?.fileKey.endsWith('.jpeg') || fileMetadata?.fileKey.endsWith('.webp')}
S3 preview
{:else if fileMetadata?.fileKey.endsWith('.pdf')}
{#await import('$lib/components/display/PdfViewer.svelte')} {:then Module} {/await}
{:else if filePreviewLoading}
File preview loading
{:else if fileMetadata !== undefined && filePreview !== undefined} {#if filePreview.contentType === 'Unknown' || filePreview.contentType === 'Csv' || !hideS3SpecificDetails}
{#if filePreview.contentType === 'Unknown'} Type of file not supported for preview. {:else if filePreview.contentType === 'Csv'} Previewing a {filePreview.contentType?.toLowerCase()} file. Separator character:
Header row:
loadFilePreview( fileMetadata?.fileKey ?? '', fileMetadata?.size, fileMetadata?.mimeType ) )} />
{:else} Previewing a {filePreview.contentType?.toLowerCase()} file. {/if}
{/if}
{#if !emptyString(filePreview.contentPreview)}{filePreview.contentPreview}{:else if filePreview.contentType !== undefined}Preview impossible.{/if}
					
{/if} {/if}
{/if} { deletionModalOpen = false }} on:confirmed={() => { deleteFileFromS3(fileMetadata?.fileKey) }} keyListen={false} loading={fileDeletionInProgress} >
Are you sure you want to permanently delete {fileMetadata?.fileKey} from the S3 bucket?
{ moveModalOpen = false }} on:confirmed={() => { moveS3File(fileMetadata?.fileKey, moveDestKey) }} keyListen={false} loading={fileMoveInProgress} >
New key:
Are you sure you want to permanently move {fileMetadata?.fileKey}?
{ uploadModalOpen = false if (evt.detail !== undefined && evt.detail !== null) { selectedFileKey = { s3: evt.detail, storage } await clearAndLoadFiles() loadFileMetadataPlusPreviewAsync(evt.detail) } }} />