Modern Docker Management, Designed for Everyone
Go composecontainer-managementcontainersdockerdocker-composedocker-managementgoself-hostedsveltekittypescriptweb-ui
fix: virtualize large tables and confirm loading all vulnerabilities (#4340)
Kyle Mendell011d2ccc127c
diff --git a/frontend/messages/en.json b/frontend/messages/en.jsonindex 8fc884399..385e254eb 100644--- a/frontend/messages/en.json+++ b/frontend/messages/en.json@@ -227,6 +227,10 @@"common_select_all": "Select all","common_select_row": "Select row","common_showing_of_total": "Showing {shown} of {total} item(s).",+ "table_pagination_bottom": "Bottom table pagination",+ "table_expand_row": "Expand row",+ "table_collapse_row": "Collapse row",+ "table_group_items": "{count} item(s)","common_rows_per_page": "Rows per page","common_all": "All","common_go_first_page": "Go to first page",@@ -903,6 +907,9 @@"vuln_exporting": "Exporting…","vuln_export_failed": "Failed to export vulnerabilities","vuln_bulk_ignore_selected": "Ignore selected ({count})",+ "vuln_load_all_title": "Load all vulnerabilities?",+ "vuln_load_all_message": "Loading all {count} matching vulnerabilities may use a lot of memory and slow down your browser. Continue?",+ "vuln_load_all_confirm": "Load all","vuln_bulk_ignore_all_matching": "Ignore all matching ({count})","vuln_bulk_restore_selected": "Restore selected ({count})","vuln_bulk_restore_all_matching": "Restore all matching ({count})",diff --git a/frontend/src/lib/components/arcane-table/arcane-table-desktop-view.svelte b/frontend/src/lib/components/arcane-table/arcane-table-desktop-view.svelteindex 54c65652d..9627cd880 100644--- a/frontend/src/lib/components/arcane-table/arcane-table-desktop-view.svelte+++ b/frontend/src/lib/components/arcane-table/arcane-table-desktop-view.svelte@@ -2,12 +2,12 @@import { FlexRender as FlexRenderBase } from '@tanstack/svelte-table';import { untrack, type Component, type Snippet } from 'svelte';import type { Attachment } from 'svelte/attachments';- import { slide } from 'svelte/transition';import Skeleton from '#lib/components/ui/skeleton/skeleton.svelte';import * as Table from '#lib/components/ui/table/index.js';import { ArrowRightIcon, ArrowDownIcon } from '#lib/icons/index.js';import { m } from '#lib/paraglide/messages.js';+ import type { TableDisplayEntry } from '#lib/types/table-display.js';import { cn } from '#lib/utils.js';import { createVirtualizer } from '../ui/virtualizer.svelte';@@ -18,11 +18,9 @@type GroupSelectionState,type SelectionModifiers} from './arcane-table.types.svelte';- import { getTableRowsForItems } from './arcane-table.utils';+ import { getTableDisplayEntries } from './arcane-table.utils';import type { ArcaneCell, ArcaneFeatures, ArcaneRow, ArcaneSvelteTable } from './table-features';- void slide;-let {table,rowIndex,@@ -63,13 +61,13 @@expandedRowContent?: Snippet<[{ row: ArcaneRow<TData>; item: TData }]>;expandedRows?: Set<string>;onToggleRowExpanded?: (rowId: string) => void;- /** The scrollable ancestor, supplied by the wrapper, used to virtualize long flat lists. */+ /** The scrollable ancestor, supplied by the wrapper, used to virtualize displayed entries. */scrollElement?: HTMLElement;/** First-load flag — when set and there's no data, render skeleton rows. */loading?: boolean;/** Renders the empty state; receives an optional wrapper class. */empty: Snippet;- /** Wrap cell content instead of truncating (disables virtualization: rows lose their fixed height). */+ /** Wrap cell content instead of truncating. */wrapText?: boolean;} = $props();@@ -95,10 +93,7 @@if (event.shiftKey && !hasExpand && !selectionDisabled && !shouldIgnoreTableRowClick(event)) event.preventDefault();}- // Get rows for a specific group from the table model- const isGrouped = $derived(groupedRows !== null && groupedRows.length > 0);-- // Keep small pages and variable-layout views on the regular table path.+ // Keep small views on the regular table path.const VIRTUALIZE_THRESHOLD = 100;const ROW_ESTIMATE_PX = 44;let measuredRowHeight = $state<number | null>(null);@@ -106,32 +101,32 @@let bodyElement = $state<HTMLTableSectionElement | null>(null);let scrollMargin = $state(0);const flatRows = $derived(table.getRowModel().rows);- const shouldVirtualize = $derived(- !isGrouped && !hasExpand && !wrapText && !!scrollElement && flatRows.length > VIRTUALIZE_THRESHOLD+ const entries = $derived(+ getTableDisplayEntries(flatRows, rowIndex, groupedRows, groupCollapsedState, hasExpand ? expandedRows : undefined));+ const shouldVirtualize = $derived(entries.length > VIRTUALIZE_THRESHOLD);// Natural column widths (% of the table) measured from an auto-layout pass, then locked for table-fixed.let lockedColumns = $state<{ key: string; widths: number[] } | null>(null);const columnKey = $derived(table.getVisibleLeafColumns().map((column) => column.id)- .join('|')+ .join('|') + `:${hasExpand}:${wrapText}`);const columnWidths = $derived(shouldVirtualize && lockedColumns?.key === columnKey ? lockedColumns.widths : null);const getItemKey = $derived.by(() => {- const rows = flatRows;- return (index: number) => rows[index]?.id ?? index;+ const displayed = entries;+ return (index: number) => displayed[index]?.key ?? index;});function measureRow(node: HTMLTableRowElement) {- untrack(() => {- if (measuredRowHeight === null) {+ return untrack(() => {+ if (node.dataset['entryKind'] === 'row' && measuredRowHeight === null) {const height = node.getBoundingClientRect().height;if (height > 0) measuredRowHeight = height;}- rowVirtualizer.measureElement(node);+ return rowVirtualizer.measureElement(node);});- return () => queueMicrotask(() => rowVirtualizer.measureElement(null));}$effect(() => {@@ -140,10 +135,10 @@const body = bodyElement;if (!shouldVirtualize || !container || !tableNode || !body) return;- table.getVisibleLeafColumns();+ const layoutKey = columnKey;let width = 0;const remeasure = () => {- const row = body.querySelector<HTMLTableRowElement>('tr[data-index]');+ const row = body.querySelector<HTMLTableRowElement>('tr[data-entry-kind="row"]');const height = row?.getBoundingClientRect().height;if (height) measuredRowHeight = height;rowVirtualizer.measure();@@ -163,7 +158,7 @@const tableWidth = tableNode.getBoundingClientRect().width;if (!cells || !tableWidth) return;lockedColumns = {- key: columnKey,+ key: layoutKey,widths: Array.from(cells, (cell) => (cell.getBoundingClientRect().width / tableWidth) * 100)};};@@ -176,6 +171,7 @@updateLayout();});observer.observe(tableNode);+ observer.observe(container);if (tableNode.tHead) observer.observe(tableNode.tHead);document.fonts.addEventListener('loadingdone', fontsChanged);untrack(updateLayout);@@ -188,18 +184,28 @@// Runes can't be created conditionally, so the virtualizer always exists but is `enabled` only// when we actually virtualize; disabled, it stays cheap and reports an empty window.const rowVirtualizer = createVirtualizer<HTMLElement, HTMLTableRowElement>(() => {- const rowSize = measuredRowHeight ?? ROW_ESTIMATE_PX;return {- count: flatRows.length,+ count: entries.length,getScrollElement: () => scrollElement ?? null,- estimateSize: () => rowSize,+ estimateSize: (index) => (entries[index]?.kind === 'detail' ? 160 : (measuredRowHeight ?? ROW_ESTIMATE_PX)),overscan: 10,getItemKey,initialOffset: initialScrollTop,scrollMargin,- enabled: shouldVirtualize+ enabled: shouldVirtualize && !!scrollElement};});+ $effect(() => {+ const container = scrollElement;+ const size = rowVirtualizer.totalSize;+ const margin = scrollMargin;+ if (!container || !shouldVirtualize) return;+ const frame = requestAnimationFrame(() => {+ const max = Math.max(0, size + margin - container.clientHeight);+ if (container.scrollTop > max) container.scrollTop = max;+ });+ return () => cancelAnimationFrame(frame);+ });</script>{#snippet cellContent(cell: ArcaneCell<TData>)}@@ -228,6 +234,7 @@<Table.Row{@attach rowMeasurement}data-index={virtualIndex}+ data-entry-kind="row"data-state={selectedIdSet.has(rowId) && 'selected'}data-expanded={isExpanded ? true : undefined}onclick={(event) => handleRowClick(event, rowId)}@@ -245,7 +252,7 @@e.stopPropagation();onToggleRowExpanded?.(rowId);}}- aria-label={isExpanded ? 'Collapse row' : 'Expand row'}+ aria-label={isExpanded ? m.table_collapse_row() : m.table_expand_row()}><ArrowRightIcon class="size-4" /></button>@@ -280,14 +287,14 @@</Table.Cell>{/each}</Table.Row>+{/snippet}- {#if hasExpand && isExpanded && expandedRowContent}- <Table.Row variant="detail">+{#snippet detailRow(row: ArcaneRow<TData>, rowMeasurement?: Attachment<HTMLTableRowElement>, virtualIndex?: number)}+ {#if expandedRowContent}+ <Table.Row variant="detail" {@attach rowMeasurement} data-index={virtualIndex}><Table.Cell colspan={columnsCount} variant="flush">- <div transition:slide={{ duration: 200 }}>- <div class="px-6 py-4">- {@render expandedRowContent({ row, item: row.original })}- </div>+ <div class="px-6 py-4">+ {@render expandedRowContent({ row, item: row.original })}</div></Table.Cell></Table.Row>@@ -319,12 +326,16 @@{#each table.getHeaderGroups() as headerGroup (headerGroup.id)}<Table.Row>{#if hasExpand}- <Table.Head variant="expander"></Table.Head>+ <Table.Head+ variant="expander"+ style={columnWidths ? `--col-width: ${columnWidths[0]}%` : undefined}+ class={columnWidths ? 'w-(--col-width)' : undefined}+ ></Table.Head>{/if}{#each headerGroup.headers as header, i (header.id)}{@const meta = header.column.columnDef.meta}{@const pxWidth = typeof meta?.width === 'number' ? `${meta.width}px` : undefined}- {@const colWidth = columnWidths ? `${columnWidths[i]}%` : pxWidth}+ {@const colWidth = columnWidths ? `${columnWidths[i + (hasExpand ? 1 : 0)]}%` : pxWidth}<Table.Headcolspan={header.colSpan}pinned={header.column.id === 'actions'}@@ -347,13 +358,15 @@</Table.Header>{/snippet}-{#snippet tableGroup(group: GroupedData<TData>)}+{#snippet tableGroup(group: GroupedData<TData>, rowMeasurement?: Attachment<HTMLTableRowElement>, virtualIndex?: number)}{@const isCollapsed = groupCollapsedState[group.groupName] ?? true}{@const selectionState = getGroupSelectionState?.(group.items) ?? 'none'}{@const hasSelection = selectionState !== 'none'}{@const IconComponent = groupIcon?.(group.groupName)}<Table.Row+ {@attach rowMeasurement}+ data-index={virtualIndex}variant={unstyled ? 'static' : 'default'}data-state={hasSelection ? 'selected' : undefined}onclick={() => onGroupToggle?.(group.groupName)}@@ -384,13 +397,16 @@</div></Table.Cell></Table.Row>+{/snippet}- <!-- Group Items (if not collapsed) -->- {#if !isCollapsed}- {@const groupRows = getTableRowsForItems(rowIndex, group.items)}- {#each groupRows as row (row.id)}- {@render dataRow(row, true)}- {/each}+{#snippet displayEntry(entry: TableDisplayEntry<TData>, virtualIndex?: number)}+ {@const measurement = virtualIndex !== undefined ? measureRow : undefined}+ {#if entry.kind === 'group'}+ {@render tableGroup(entry.group, measurement, virtualIndex)}+ {:else if entry.kind === 'detail'}+ {@render detailRow(entry.row, measurement, virtualIndex)}+ {:else}+ {@render dataRow(entry.row, entry.grouped, measurement, virtualIndex)}{/if}{/snippet}@@ -399,14 +415,14 @@{@const first = vItems[0]}{@const last = vItems[vItems.length - 1]}{@const padTop = first ? Math.max(0, first.start - scrollMargin) : 0}- {@const padBottom = last ? Math.max(0, rowVirtualizer.totalSize - (last.end - scrollMargin)) : 0}+ {@const padBottom = last ? Math.max(0, rowVirtualizer.totalSize - (last.end - scrollMargin)) : rowVirtualizer.totalSize}{#if padTop > 0}<tr aria-hidden="true"><td colspan={columnsCount} class="h-(--pad) border-0 p-0" style="--pad: {padTop}px"></td></tr>{/if}{#each vItems as vItem (vItem.key)}- {@const row = flatRows[vItem.index]}- {#if row}- {@render dataRow(row, false, measureRow, vItem.index)}+ {@const entry = entries[vItem.index]}+ {#if entry}+ {@render displayEntry(entry, vItem.index)}{/if}{/each}{#if padBottom > 0}@@ -424,19 +440,15 @@<Table.Root bind:ref={tableElement} class={columnWidths ? 'table-fixed' : undefined}>{@render tableHeader()}<Table.Body bind:ref={bodyElement}>- {#if isGrouped && groupedRows}- {#each groupedRows as group (group.groupName)}- {@render tableGroup(group)}- {/each}- {:else if loading && flatRows.length === 0}+ {#if loading && entries.length === 0}{@render skeletonRows()}- {:else if flatRows.length === 0}+ {:else if entries.length === 0}{@render emptyState()}{:else if shouldVirtualize}{@render virtualRows()}{:else}- {#each flatRows as row (row.id)}- {@render dataRow(row, false)}+ {#each entries as entry (entry.key)}+ {@render displayEntry(entry)}{/each}{/if}</Table.Body>diff --git a/frontend/src/lib/components/arcane-table/arcane-table-mobile-view.svelte b/frontend/src/lib/components/arcane-table/arcane-table-mobile-view.svelteindex f40959dcd..64fb637d8 100644--- a/frontend/src/lib/components/arcane-table/arcane-table-mobile-view.svelte+++ b/frontend/src/lib/components/arcane-table/arcane-table-mobile-view.svelte@@ -1,18 +1,20 @@<script lang="ts" generics="TData extends Record<string, any> & { id: string }">- import type { Snippet, Component } from 'svelte';- import { slide } from 'svelte/transition';+ import { PersistedState } from 'runed';+ import { untrack, type Snippet, type Component } from 'svelte';- import DropdownCard from '#lib/components/dropdown-card.svelte';+ import * as Card from '#lib/components/ui/card/index.js';import Skeleton from '#lib/components/ui/skeleton/skeleton.svelte';+ import { createVirtualizer } from '#lib/components/ui/virtualizer.svelte.js';+ import VirtualRows from '#lib/components/virtual-rows.svelte';+ import { ArrowDownIcon } from '#lib/icons/index.js';import { m } from '#lib/paraglide/messages.js';+ import type { TableDisplayEntry } from '#lib/types/table-display.js';import { cn } from '#lib/utils.js';import { shouldIgnoreTableRowClick, type GroupedData } from './arcane-table.types.svelte';- import { getTableRowsForItems } from './arcane-table.utils';+ import { getTableDisplayEntries } from './arcane-table.utils';import type { ArcaneRow, ArcaneSvelteTable } from './table-features';- void slide;-let {table,rowIndex,@@ -23,6 +25,8 @@expandedRowContent,expandedRows,onToggleRowExpanded,+ scrollElement,+ initialScrollTop = 0,loading = false,empty}: {@@ -37,6 +41,8 @@onToggleRowExpanded?: (rowId: string) => void;/** First-load flag — when set and there's no data, render skeleton cards. */loading?: boolean;+ scrollElement?: HTMLElement;+ initialScrollTop?: number;/** Renders the empty state; receives an optional wrapper class. */empty: Snippet;} = $props();@@ -48,8 +54,69 @@if (hasExpand) onToggleRowExpanded?.(rowId);}- // Check if we should render grouped view- const isGrouped = $derived(groupedRows !== null && groupedRows.length > 0);+ const groupExpansion = new PersistedState<Record<string, boolean>>('collapsible-cards-expanded', {}, { syncTabs: false });+ const collapsedGroups = $derived.by(() => {+ const collapsed: Record<string, boolean> = {};+ for (const group of groupedRows ?? []) {+ collapsed[group.groupName] = !(groupExpansion.current[`mobile-group-${group.groupName}`] ?? false);+ }+ return collapsed;+ });+ const entries = $derived(getTableDisplayEntries(table.getRowModel().rows, rowIndex, groupedRows, collapsedGroups));+ const shouldVirtualize = $derived(entries.length > 100);+ const getItemKey = $derived.by(() => {+ const displayed = entries;+ return (index: number) => displayed[index]?.key ?? index;+ });+ const rowVirtualizer = createVirtualizer<HTMLElement, HTMLDivElement>(() => ({+ count: entries.length,+ getScrollElement: () => scrollElement ?? null,+ estimateSize: (index) => (entries[index]?.kind === 'group' ? 90 : 160),+ overscan: 10,+ getItemKey,+ initialOffset: initialScrollTop,+ enabled: shouldVirtualize && !!scrollElement+ }));++ function toggleGroup(groupName: string) {+ groupExpansion.current = {+ ...groupExpansion.current,+ [`mobile-group-${groupName}`]: collapsedGroups[groupName] ?? true+ };+ }++ $effect(() => {+ const container = scrollElement;+ if (!container || !shouldVirtualize) return;+ // Field changes invalidate cached heights for cards outside the viewport.+ JSON.stringify(mobileFieldVisibility);+ let width = container.clientWidth;+ const observer = new ResizeObserver(() => {+ if (container.clientWidth !== width) {+ width = container.clientWidth;+ rowVirtualizer.measure();+ }+ });+ observer.observe(container);+ const remeasure = () => rowVirtualizer.measure();+ document.fonts.addEventListener('loadingdone', remeasure);+ untrack(remeasure);+ return () => {+ observer.disconnect();+ document.fonts.removeEventListener('loadingdone', remeasure);+ };+ });++ $effect(() => {+ const container = scrollElement;+ const size = rowVirtualizer.totalSize;+ if (!container || !shouldVirtualize) return;+ const frame = requestAnimationFrame(() => {+ const max = Math.max(0, size - container.clientHeight);+ if (container.scrollTop > max) container.scrollTop = max;+ });+ return () => cancelAnimationFrame(frame);+ });</script>{#snippet mobileSkeleton()}@@ -75,7 +142,7 @@{@render mobileCard({ row, item: row.original, mobileFieldVisibility })}</div>{#if hasExpand && isExpanded && expandedRowContent}- <div class="bg-muted/30 px-4 py-3" transition:slide={{ duration: 200 }}>+ <div class="bg-muted/30 px-4 py-3">{@render expandedRowContent({ row, item: row.original })}</div>{/if}@@ -87,39 +154,50 @@</div>{/snippet}-<div class="divide-y divide-border/30">- {#if isGrouped && groupedRows}- <div class="space-y-4 py-2">- {#each groupedRows as group (group.groupName)}- {@const groupRows = getTableRowsForItems(rowIndex, group.items)}- {@const IconComponent = groupIcon?.(group.groupName)}-- <DropdownCard- id={`mobile-group-${group.groupName}`}- title={group.groupName}- description={`${group.items.length} ${group.items.length === 1 ? 'item' : 'items'}`}- icon={IconComponent}- >- <div class="divide-y divide-border/30">- {#each groupRows as row (row.id)}- {@render mobileRow(row)}- {:else}- <div class="flex h-24 items-center justify-center text-center text-muted-foreground">- {m.common_no_results_found()}- </div>- {/each}- </div>- </DropdownCard>- {/each}- </div>- {:else if loading && table.getRowModel().rows.length === 0}- {@render mobileSkeleton()}+{#snippet displayEntry(entry: TableDisplayEntry<TData>)}+ {#if entry.kind === 'group'}+ {@const group = entry.group}+ {@const expanded = !collapsedGroups[group.groupName]}+ <Card.Root>+ <Card.Header+ icon={groupIcon?.(group.groupName)}+ enableHover+ class="cursor-pointer select-none"+ role="button"+ tabindex={0}+ aria-expanded={expanded}+ onclick={() => toggleGroup(group.groupName)}+ onkeydown={(event) => {+ if (event.key === 'Enter' || event.key === ' ') {+ event.preventDefault();+ toggleGroup(group.groupName);+ }+ }}+ >+ <div>+ <Card.Title>{group.groupName}</Card.Title>+ <Card.Description class="mt-1">{m.table_group_items({ count: group.items.length })}</Card.Description>+ </div>+ <Card.Action class="ml-auto">+ <ArrowDownIcon class={cn('size-5', expanded && 'rotate-180')} />+ </Card.Action>+ </Card.Header>+ </Card.Root>{:else}- <!-- Non-grouped view (original behavior) -->- {#each table.getRowModel().rows as row (row.id)}- {@render mobileRow(row)}- {:else}- {@render emptyState()}- {/each}+ <div class="border-b border-border/30">+ {@render mobileRow(entry.row)}+ </div>{/if}-</div>+{/snippet}++{#if loading && entries.length === 0}+ {@render mobileSkeleton()}+{:else if entries.length === 0}+ {@render emptyState()}+{:else if shouldVirtualize}+ <VirtualRows virtualizer={rowVirtualizer} rows={entries} row={displayEntry} />+{:else}+ {#each entries as entry (entry.key)}+ {@render displayEntry(entry)}+ {/each}+{/if}diff --git a/frontend/src/lib/components/arcane-table/arcane-table-pagination.svelte b/frontend/src/lib/components/arcane-table/arcane-table-pagination.svelteindex 9840965bb..f33215c87 100644--- a/frontend/src/lib/components/arcane-table/arcane-table-pagination.svelte+++ b/frontend/src/lib/components/arcane-table/arcane-table-pagination.svelte@@ -48,8 +48,8 @@<div class="order-1 flex flex-col gap-4 sm:order-2 sm:flex-row sm:items-center sm:space-x-6 lg:space-x-8"><div class="flex items-center justify-between space-x-2 sm:justify-start"><p class="text-sm font-medium">{m.common_rows_per_page()}</p>- <Select.Root allowDeselect={false} type="single" value={selectValue} onValueChange={handlePageSizeChange}>- <Select.Trigger class="h-11 w-17.5 sm:h-8">+ <Select.Root allowDeselect={false} type="single" bind:value={() => selectValue, handlePageSizeChange}>+ <Select.Trigger aria-label={m.common_rows_per_page()} class="h-11 w-17.5 sm:h-8">{displayValue}</Select.Trigger><Select.Content side="top">diff --git a/frontend/src/lib/components/arcane-table/arcane-table.svelte b/frontend/src/lib/components/arcane-table/arcane-table.svelteindex 5b2861bdd..0225697fc 100644--- a/frontend/src/lib/components/arcane-table/arcane-table.svelte+++ b/frontend/src/lib/components/arcane-table/arcane-table.svelte@@ -6,6 +6,7 @@import type { Snippet } from 'svelte';import type { Component } from 'svelte';+ import { TABLE_PAGE_SIZE_ALL } from '#lib/constants/table-pagination.js';import { IsMobile } from '#lib/hooks/is-mobile.svelte.js';import { m } from '#lib/paraglide/messages.js';import type { Paginated, SearchPaginationSortRequest } from '#lib/types/shared.js';@@ -49,10 +50,12 @@withoutSearch = $bindable(),withoutFilters = false,withoutPagination = false,+ restoreAllPageSize = true,selectionDisabled = false,loading = false,unstyled = false,onRefresh,+ onPageSizeChangeRequest,columns,rowActions,mobileCard,@@ -84,11 +87,15 @@withoutSearch?: boolean;withoutFilters?: boolean;withoutPagination?: boolean;+ /** Restore the default limit instead of a saved All selection when false. */+ restoreAllPageSize?: boolean;selectionDisabled?: boolean;/** When true and there's no data yet, the desktop view shows skeleton rows (first-load). */loading?: boolean;unstyled?: boolean;onRefresh: (requestOptions: SearchPaginationSortRequest) => Promise<Paginated<TData>>;+ /** Allows a caller to confirm a page-size change before applying it. */+ onPageSizeChangeRequest?: (limit: number, apply: () => void) => void;columns: ColumnSpec<TData>[];rowActions?: Snippet<[{ row: ArcaneRow<TData>; item: TData }]>;mobileCard: Snippet<[{ row: ArcaneRow<TData>; item: TData; mobileFieldVisibility: Record<string, boolean> }]>;@@ -166,9 +173,9 @@wrapTextPref.current = !wrapTextPref.current;}- // The desktop scroll container, bound below and handed to the desktop view so it can virtualize- // long flat lists. The unstyled/styled branches are mutually exclusive, so one ref suffices.+ // Each view owns its virtualizer and restores its own scroll position.let desktopScrollEl = $state<HTMLElement>();+ let mobileScrollEl = $state<HTMLElement>();const isMobile = new IsMobile();const scrollPositions = { desktop: { top: 0, left: 0 }, mobile: { top: 0, left: 0 } };const selectedIdSet = $derived(new Set(selectedIds ?? []));@@ -251,6 +258,9 @@return;}const snapshot = extractPersistedPreferences(prefs?.current, getEffectiveLimit());+ if (!restoreAllPageSize && snapshot.limit === TABLE_PAGE_SIZE_ALL) {+ snapshot.limit = DEFAULT_LIMIT;+ }const patchedVisibility = { ...columnVisibility };applyHiddenPatch(patchedVisibility, snapshot.hiddenColumns);@@ -291,6 +301,10 @@page: items?.pagination?.currentPage ?? 1,limit: items?.pagination?.itemsPerPage ?? 10};+ scrollPositions.desktop.top = 0;+ scrollPositions.mobile.top = 0;+ if (desktopScrollEl) desktopScrollEl.scrollTop = 0;+ if (mobileScrollEl) mobileScrollEl.scrollTop = 0;const next = { ...prev, ...patch };requestOptions = { ...requestOptions, pagination: next };onRefresh(requestOptions);@@ -303,9 +317,16 @@}function setPageSize(limit: number) {- // Persist page size- if (enablePersist && prefs) prefs.current = { ...prefs.current, l: limit };- updatePagination({ limit, page: 1 });+ if (limit === pageSize) return;+ const apply = () => {+ if (enablePersist && prefs) prefs.current = { ...prefs.current, l: limit };+ updatePagination({ limit, page: 1 });+ };+ if (onPageSizeChangeRequest) {+ onPageSizeChangeRequest(limit, apply);+ } else {+ apply();+ }}function onToggleAll(checked: boolean, table: ArcaneTable<TData>) {@@ -744,6 +765,8 @@{#snippet MobileViewSnippet()}<ArcaneTableMobileView+ scrollElement={mobileScrollEl}+ initialScrollTop={scrollPositions.mobile.top}{rowIndex}{table}{mobileCard}@@ -787,7 +810,8 @@<div{@attach (node) => restoreScroll(node, 'desktop')}bind:this={desktopScrollEl}- class="isolate h-full min-h-0 flex-1 overflow-auto bg-background"+ data-table-scroll="desktop"+ class="isolate h-full max-h-dvh min-h-0 flex-1 overflow-auto bg-background"><ArcaneTableDesktopView{rowIndex}@@ -814,7 +838,12 @@/></div>{:else}- <div {@attach (node) => restoreScroll(node, 'mobile')} class="isolate block flex-1 overflow-auto bg-background/80">+ <div+ {@attach (node) => restoreScroll(node, 'mobile')}+ bind:this={mobileScrollEl}+ data-table-scroll="mobile"+ class="isolate block max-h-dvh min-h-0 flex-1 overflow-auto bg-background/80"+ >{#if unstyled}<div class="divide-y divide-border/40">{@render MobileViewSnippet()}@@ -826,9 +855,9 @@{/if}{#if !withoutPagination}- <div class="shrink-0 border-t border-border/50 px-4 py-3">+ <nav aria-label={m.table_pagination_bottom()} class="shrink-0 border-t border-border/50 px-4 py-3">{@render PaginationSnippet()}- </div>+ </nav>{/if}</div>{/if}diff --git a/frontend/src/lib/components/arcane-table/arcane-table.utils.ts b/frontend/src/lib/components/arcane-table/arcane-table.utils.tsindex 9784ce457..b4c0e7110 100644--- a/frontend/src/lib/components/arcane-table/arcane-table.utils.ts+++ b/frontend/src/lib/components/arcane-table/arcane-table.utils.ts@@ -3,9 +3,10 @@ import type { ColumnFiltersState } from '@tanstack/table-core';import type { FilterMap, FilterValue } from '#lib/types/shared.js';import type { SearchPaginationSortRequest } from '#lib/types/shared.js';+import type { TableDisplayEntry } from '#lib/types/table-display.js';import type { PersistedPreferencesSnapshot } from '#lib/types/table-preferences.js';-import type { CompactTablePrefs } from './arcane-table.types.svelte';+import type { CompactTablePrefs, GroupedData } from './arcane-table.types.svelte';import { decodeFilters, decodeSort } from './arcane-table.types.svelte';import type { ArcaneRow } from './table-features';@@ -128,3 +129,33 @@ export function getTableRowsForItems<T extends RowData>(.sort((a, b) => a.index - b.index).map((entry) => entry.row);}++export function getTableDisplayEntries<T extends RowData & { id: string }>(+ rows: ArcaneRow<T>[],+ rowIndex: ReadonlyMap<string, { row: ArcaneRow<T>; index: number }>,+ groups: GroupedData<T>[] | null,+ collapsed: Record<string, boolean>,+ expanded?: ReadonlySet<string>+): TableDisplayEntry<T>[] {+ const entries: TableDisplayEntry<T>[] = [];+ const appendRows = (groupRows: ArcaneRow<T>[], groupName?: string) => {+ for (const row of groupRows) {+ const key = JSON.stringify([groupName ?? null, row.id]);+ entries.push({ kind: 'row', key: `row:${key}`, row, grouped: groupName !== undefined });+ if (expanded?.has(row.id)) {+ entries.push({ kind: 'detail', key: `detail:${key}`, row, grouped: groupName !== undefined });+ }+ }+ };+ if (groups?.length) {+ for (const group of groups) {+ entries.push({ kind: 'group', key: `group:${group.groupName}`, group });+ if (!(collapsed[group.groupName] ?? true)) {+ appendRows(getTableRowsForItems(rowIndex, group.items), group.groupName);+ }+ }+ } else {+ appendRows(rows);+ }+ return entries;+}diff --git a/frontend/src/lib/types/table-display.ts b/frontend/src/lib/types/table-display.tsnew file mode 100644index 000000000..dfdcbfb30--- /dev/null+++ b/frontend/src/lib/types/table-display.ts@@ -0,0 +1,8 @@+import type { RowData } from '@tanstack/table-core';++import type { GroupedData } from '#lib/components/arcane-table/arcane-table.types.svelte.js';+import type { ArcaneRow } from '#lib/components/arcane-table/table-features.js';++export type TableDisplayEntry<T extends RowData> =+ | { kind: 'group'; key: string; group: GroupedData<T> }+ | { kind: 'row' | 'detail'; key: string; row: ArcaneRow<T>; grouped: boolean };diff --git a/frontend/src/lib/utils/tables.ts b/frontend/src/lib/utils/tables.tsindex 6ef7d8884..f4fcc87b0 100644--- a/frontend/src/lib/utils/tables.ts+++ b/frontend/src/lib/utils/tables.ts@@ -67,7 +67,7 @@ function normalizeSearch(value: unknown): string | undefined {export function resolveInitialTableRequest(persistKey: string,defaults: SearchPaginationSortRequest,- options: { deferredSortColumns?: readonly string[] } = {}+ options: { deferredSortColumns?: readonly string[]; restoreAllPageSize?: boolean } = {}): SearchPaginationSortRequest {const base = cloneRequest(defaults);const fallbackLimit = base.pagination?.limit ?? DEFAULT_LIMIT;@@ -103,7 +103,10 @@ export function resolveInitialTableRequest(base.pagination = { ...base.pagination!, page: 1 };}- const limit = normalizeTablePageSize(current.l);+ let limit = normalizeTablePageSize(current.l);+ if (limit === TABLE_PAGE_SIZE_ALL && options.restoreAllPageSize === false) {+ limit = fallbackLimit;+ }if (limit !== undefined && base.pagination?.limit !== limit) {base.pagination = { page: 1, limit };}diff --git a/frontend/src/routes/(app)/security/+page.ts b/frontend/src/routes/(app)/security/+page.tsindex fbff7ab73..a1ab6a09a 100644--- a/frontend/src/routes/(app)/security/+page.ts+++ b/frontend/src/routes/(app)/security/+page.ts@@ -14,16 +14,20 @@ export const load: PageLoad = async ({ parent }) => {const { queryClient } = await parent();const envId = await environmentStore.getCurrentEnvironmentId();- const vulnerabilityRequestOptions = resolveInitialTableRequest('arcane-security-vuln-table', {- pagination: {- page: 1,- limit: 20- },- sort: {- column: 'vulnSeverity',- direction: 'desc'- }- } satisfies SearchPaginationSortRequest);+ const vulnerabilityRequestOptions = resolveInitialTableRequest(+ 'arcane-security-vuln-table',+ {+ pagination: {+ page: 1,+ limit: 20+ },+ sort: {+ column: 'vulnSeverity',+ direction: 'desc'+ }+ } satisfies SearchPaginationSortRequest,+ { restoreAllPageSize: false }+ );const patchRequestOptions = resolveInitialTableRequest('arcane-security-patch-table', {pagination: {diff --git a/frontend/src/routes/(app)/security/components/security-vulnerability-table.svelte b/frontend/src/routes/(app)/security/components/security-vulnerability-table.svelteindex f70535804..b3da9a0ec 100644--- a/frontend/src/routes/(app)/security/components/security-vulnerability-table.svelte+++ b/frontend/src/routes/(app)/security/components/security-vulnerability-table.svelte@@ -7,6 +7,7 @@import type { BulkAction, ColumnSpec } from '#lib/components/arcane-table/arcane-table.types.svelte.js';import UniversalMobileCard from '#lib/components/arcane-table/cards/universal-mobile-card.svelte';import RowActionsMenu from '#lib/components/arcane-table/row-actions-menu.svelte';+ import { openConfirmDialog } from '#lib/components/confirm-dialog/index.js';// Patching happens on the Patches tab, per image; CVE rows only inspect and ignore.import * as DropdownMenu from '#lib/components/ui/dropdown-menu/index.js';import { Label } from '#lib/components/ui/label/index.js';@@ -15,6 +16,7 @@import FixedCell from '#lib/components/vulnerability/fixed-cell.svelte';import MonoCell from '#lib/components/vulnerability/mono-cell.svelte';import SeverityBadge from '#lib/components/vulnerability/severity-badge.svelte';+ import { TABLE_PAGE_SIZE_ALL } from '#lib/constants/table-pagination.js';import {ShieldAlertIcon,CodeIcon,@@ -80,6 +82,25 @@const matchingCount = $derived(vulnerabilities.pagination?.totalItems ?? vulnerabilities.data.length);+ function handlePageSizeChangeRequest(limit: number, apply: () => void) {+ if (limit !== TABLE_PAGE_SIZE_ALL) {+ apply();+ return;+ }+ const requestedEnvId = currentEnvId;+ openConfirmDialog({+ title: m.vuln_load_all_title(),+ message: m.vuln_load_all_message({ count: matchingCount }),+ confirm: {+ label: m.vuln_load_all_confirm(),+ action: () => {+ if (!mounted || requestedEnvId !== currentEnvId || !vulnerabilityManagementEnabled) return;+ apply();+ }+ }+ });+ }+async function reloadFromFirstPage(requestedEnvId: string) {if (requestedEnvId !== currentEnvId) return;// The rows are already changed on the server; clear before refreshing so a failed reload cannot re-submit them.@@ -475,10 +496,12 @@items={vulnerabilities}bind:requestOptionsonRefresh={refreshVulnerabilityTable}+ onPageSizeChangeRequest={handlePageSizeChangeRequest}{columns}mobileCard={VulnerabilityMobileCard}{mobileFields}persistKey="arcane-security-vuln-table"+ restoreAllPageSize={false}selectionDisabled={!canManageVuln}bind:selectedIds{bulkActions}diff --git a/tests/spec/security.spec.ts b/tests/spec/security.spec.tsindex 3f3a55a9e..ae1189dc4 100644--- a/tests/spec/security.spec.ts+++ b/tests/spec/security.spec.ts@@ -348,7 +348,10 @@ test.describe('Security Page', () => {await refreshed;refreshed = tableRequest((params) => params.get('start') === '20');- await panel.getByRole('button', { name: 'Go to next page', exact: true }).click();+ await panel+ .getByRole('navigation', { name: 'Bottom table pagination' })+ .getByRole('button', { name: 'Go to next page', exact: true })+ .click();await refreshed;await expect(page.getByRole('row').filter({ hasText: 'CVE-2026-0003' })).toBeVisible();diff --git a/tests/spec/volumes.spec.ts b/tests/spec/volumes.spec.tsindex 40c6d5b03..c553de34e 100644--- a/tests/spec/volumes.spec.ts+++ b/tests/spec/volumes.spec.ts@@ -514,14 +514,20 @@ test.describe('Volumes shift-select', () => {await openShiftSelectVolumes(page, 30);await rowCheckbox(page, 2).click();- await page.getByRole('button', { name: 'Go to next page' }).click();+ await page+ .getByRole('navigation', { name: 'Bottom table pagination' })+ .getByRole('button', { name: 'Go to next page' })+ .click();await expect(page.getByRole('link', { name: mockVolume(21).name, exact: true })).toBeVisible();await rowCheckbox(page, 25).click({ modifiers: ['Shift'] });await expectSelected(page, [25], true);await expectSelected(page, [21, 22, 23, 24], false);await expect(removeSelectedButton(page, 2)).toBeVisible();- await page.getByRole('button', { name: 'Go to first page' }).click();+ await page+ .getByRole('navigation', { name: 'Bottom table pagination' })+ .getByRole('button', { name: 'Go to first page' })+ .click();await expect(page.getByRole('link', { name: mockVolume(1).name, exact: true })).toBeVisible();await rowCheckbox(page, 4).click();await page.getByRole('button', { name: 'Name', exact: true }).click();@@ -629,15 +635,32 @@ test.describe('Volumes shift-select', () => {await expect(page.getByRole('link', { name: mockVolume(1).name, exact: true })).toBeVisible();await expect(page.locator('table tbody tr[data-index]').first()).toBeAttached();+ const scrollContainer = page.locator('[data-table-scroll="desktop"]');+ await expect+ .poll(() =>+ scrollContainer.evaluate((container) => container.scrollHeight > container.clientHeight)+ )+ .toBe(true);+ const scrollToRow = async (index: number) => {+ await scrollContainer.evaluate((container, rowIndex) => {+ const row = container.querySelector('tr[data-index]');+ if (!row) throw new Error('Expected a mounted virtual row');+ container.scrollTop = (rowIndex - 1) * row.getBoundingClientRect().height;+ }, index);+ await expect(rowCheckbox(page, index)).toBeAttached();+ };+ await expect.poll(() => page.locator('table tbody tr[data-index]').count()).toBeLessThan(100);await rowCheckbox(page, 1).click();- await rowCheckbox(page, 140).scrollIntoViewIfNeeded();+ await scrollToRow(140);await rowCheckbox(page, 140).click({ modifiers: ['Shift'] });await expect(removeSelectedButton(page, 140)).toBeVisible();await expectSelected(page, [140], true);await expectSelected(page, [141, 150], false);- await rowCheckbox(page, 1).scrollIntoViewIfNeeded();- await expectSelected(page, [1, 2, 3, 70], true);+ await scrollToRow(1);+ await expectSelected(page, [1, 2, 3], true);+ await scrollToRow(70);+ await expectSelected(page, [70], true);});});