diff --git a/frontend/src/lib/components/DBTable.svelte b/frontend/src/lib/components/DBTable.svelte index 2892805e68..4091bb3d48 100644 --- a/frontend/src/lib/components/DBTable.svelte +++ b/frontend/src/lib/components/DBTable.svelte @@ -165,7 +165,6 @@ // ── Filters ────────────────────────────────────────────────────────────── let filterSchema = $derived(buildDbTableFilterSchema(columns)) - let hasColumnFilters = $derived(Object.values(filterSchema.schema).some((f) => !f.hidden)) let filters: Record = $state({}) let quicksearch = $derived(unescapeFreeText(String(filters[FREE_TEXT_KEY] ?? ''))) let filterWhere = $derived( @@ -1055,7 +1054,7 @@ dropdownOffsetY={1} schema={filterSchema.schema} bind:value={filters} - placeholder={compact || !hasColumnFilters ? 'Search' : 'Search, or filter by column...'} + placeholder={compact ? 'Search' : 'Search, or filter by column...'} />
{@render toolbar?.()} diff --git a/frontend/src/lib/components/DisplayResult.svelte b/frontend/src/lib/components/DisplayResult.svelte index e9c67eeb7b..8ae0fd4a32 100644 --- a/frontend/src/lib/components/DisplayResult.svelte +++ b/frontend/src/lib/components/DisplayResult.svelte @@ -213,7 +213,10 @@ if (serverTableFormat(key)) return 'table' if (['.png', '.jpeg', '.jpg', '.webp'].some((ext) => key.endsWith(ext))) return 'image' if (key.endsWith('.pdf')) return 'pdf' - if (key.endsWith('.txt') || key.endsWith('.log')) return 'text' + // Fetched on display, unlike an image, so not for a viewer who cannot read the file (a + // logged-out public page). + if (!$userStore && !appPath) return undefined + if (/\.(txt|log)$/i.test(key)) return 'text' if (isMarkdownFile(key)) return 'markdown' return undefined } @@ -351,7 +354,8 @@ let is_render_all = $state(false) let download_as_csv = $state(false) function inferResultKind(result: any) { - if (typeof result === 'string' && result.match(/s3:\/\/[^/]*\/.+/)) { + // Anchored: a sentence that mentions an `s3://` URI is a plain string. + if (typeof result === 'string' && result.match(/^s3:\/\/[^/]*\/.+/)) { largeObject = false return 's3object' } @@ -530,6 +534,8 @@ let jsonViewer: Drawer | undefined = $state() let s3FileViewer: S3FilePicker | undefined = $state() + // The file browser is only mounted with the result's controls. + let canExplore = $derived(!!$userStore && !disableExpand && !noControls) function checkIfHasBigInt(result: any) { if (typeof result === 'number' && Number.isInteger(result) && !Number.isSafeInteger(result)) { @@ -897,8 +903,8 @@ }} > {#snippet children({ item })} - - + + {/snippet}
@@ -945,11 +951,11 @@ > {#snippet children({ item })} {#if ['table-col', 'table-row', 'table-row-object'].includes(resultKind ?? '')} - + {:else} - + {/if} - + {/snippet} {/if} @@ -1241,7 +1247,7 @@ {s3object} {workspaceId} {appPath} - onExplore={$userStore ? () => s3FileViewer?.open?.(s3object) : undefined} + onExplore={canExplore ? () => s3FileViewer?.open?.(s3object) : undefined} markdownSource={s3PreviewKind(s3object.s3) === 'markdown' ? markdownSourceKeys.includes(s3object.s3) : undefined} @@ -1273,7 +1279,7 @@ {s3object} {workspaceId} {appPath} - onExplore={$userStore ? () => s3FileViewer?.open?.(s3object) : undefined} + onExplore={canExplore ? () => s3FileViewer?.open?.(s3object) : undefined} previewOpen={collapsible ? previewOpen : undefined} onTogglePreview={() => { seeS3PreviewFileFromList = previewOpen ? '' : s3object?.s3 diff --git a/frontend/src/lib/components/FilterSearchbar.svelte b/frontend/src/lib/components/FilterSearchbar.svelte index 590ada6b17..76c0fa1cdb 100644 --- a/frontend/src/lib/components/FilterSearchbar.svelte +++ b/frontend/src/lib/components/FilterSearchbar.svelte @@ -715,15 +715,6 @@ }) ) - // The filter list has nothing to show when no filter is left to pick (a table with no - // filterable column, or a term matching none) and there are no presets: opening it would - // leave a bare "Filters" heading over the content below. - let hasMenuContent = $derived( - (!!currentTag && !!schema[currentTag]) || - presets.length > 0 || - menuItems.some((i) => i.type === 'filter') - ) - function appendFilterAsText(presetValue: string) { // For allowMultiple fields, append value with comma to existing filter instead of adding duplicate key const match = presetValue.match(/^(\w+):\\\s+(.+)$/) @@ -830,7 +821,7 @@ { const r = inputElement?.getBoundingClientRect() ?? new DOMRect() diff --git a/frontend/src/lib/components/S3FilePickerInner.svelte b/frontend/src/lib/components/S3FilePickerInner.svelte index 6ea017a7f1..73c7e73a0b 100644 --- a/frontend/src/lib/components/S3FilePickerInner.svelte +++ b/frontend/src/lib/components/S3FilePickerInner.svelte @@ -794,6 +794,8 @@ // the same key, so comparing keys would let an older request speak for a newer one. const requestId = ++metadataRequestId fileInfoLoading = true + // Each file opens rendered, as the separator resets per file. + markdownView = 'rendered' let fileMetadataRaw: LoadFileMetadataResponse try { fileMetadataRaw = await loadFileMetadataRequest({ diff --git a/frontend/src/lib/components/S3FilePreview.svelte b/frontend/src/lib/components/S3FilePreview.svelte index 7c246c9e1e..03f3cbdf96 100644 --- a/frontend/src/lib/components/S3FilePreview.svelte +++ b/frontend/src/lib/components/S3FilePreview.svelte @@ -270,7 +270,7 @@ {/if}
{/if} {#if filePreview.contentPreview && !emptyString(filePreview.contentPreview)} - + +
+ +
{:else if filePreview.contentType !== undefined}
Preview impossible.
{/if} diff --git a/frontend/src/lib/components/common/fileDownload/FileTextPreview.svelte b/frontend/src/lib/components/common/fileDownload/FileTextPreview.svelte index 259700a488..9ecd69e97c 100644 --- a/frontend/src/lib/components/common/fileDownload/FileTextPreview.svelte +++ b/frontend/src/lib/components/common/fileDownload/FileTextPreview.svelte @@ -1,6 +1,7 @@