Skip to content

Modern Docker Management, Designed for Everyone

feat: add search to template selection dialog (#4183)

Kyle Mendell4bbcbfea6274
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index ce7a1edd2..07e879f24 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -283,7 +283,7 @@ jobs:
docker pull "$PLAYWRIGHT_DOCKER_IMAGE_REPOSITORY:v$version-noble"
docker pull public.ecr.aws/nginx/nginx:stable-alpine
docker pull public.ecr.aws/docker/library/busybox:1.37
- docker pull quay.io/minio/minio:RELEASE.2025-09-07T16-13-09Z
+ docker pull cgr.dev/chainguard/minio:latest-dev@sha256:d7c906993247627c19f37fc1fa302c34cf2d209ae0e7dc7d52fb0be6ac2849ba
docker pull ghcr.io/rustic-rs/rustic:v0.11.2
docker save public.ecr.aws/nginx/nginx:stable-alpine public.ecr.aws/docker/library/busybox:1.37 > /tmp/test-images.tar
diff --git a/frontend/src/lib/components/dialogs/template-selection-dialog.svelte b/frontend/src/lib/components/dialogs/template-selection-dialog.svelte
index 55ef42a2e..4a334be9e 100644
--- a/frontend/src/lib/components/dialogs/template-selection-dialog.svelte
+++ b/frontend/src/lib/components/dialogs/template-selection-dialog.svelte
@@ -11,6 +11,8 @@
import { Label } from '#lib/components/ui/label/index.js';
import * as Select from '#lib/components/ui/select/index.js';
import * as Collapsible from '#lib/components/ui/collapsible/index.js';
+ import * as InputGroup from '#lib/components/ui/input-group/index.js';
+ import EmptyState from '#lib/components/states/empty-state.svelte';
import SwitchWithLabel from '#lib/components/form/labeled-switch.svelte';
import IconImage from '#lib/components/icon-image.svelte';
import {
@@ -20,7 +22,9 @@
ProjectsIcon,
DownloadIcon,
SettingsIcon,
- FileTextIcon
+ FileTextIcon,
+ SearchIcon,
+ CloseIcon
} from '#lib/icons/index.js';
import { toast } from 'svelte-sonner';
@@ -41,6 +45,8 @@
const loadingStates = new SvelteSet<string>();
let sortBy = $state<'name-asc' | 'name-desc'>('name-asc');
let groupByRegistry = $state(true);
+ let searchQuery = $state('');
+ let searchInput = $state<HTMLInputElement | null>(null);
const selectTemplateMutation = createMutation(() => ({
mutationFn: (template: Template) => templateService.getTemplateContent(template.id)
}));
@@ -49,9 +55,20 @@
}));
const allTemplates = $derived(templates ?? []);
+ const normalizedQuery = $derived(searchQuery.trim().toLowerCase());
+
+ // Case-insensitive substring match against name, description, tags and registry label.
+ const filteredTemplates = $derived.by(() => {
+ if (!normalizedQuery) return allTemplates;
+ return allTemplates.filter((template) =>
+ [template.name, template.description ?? '', registryLabel(template), ...normalizeTags(template.metadata?.tags)].some(
+ (field) => field.toLowerCase().includes(normalizedQuery)
+ )
+ );
+ });
const sortedTemplates = $derived.by(() => {
- const sorted = [...allTemplates];
+ const sorted = [...filteredTemplates];
sorted.sort((a, b) => (sortBy === 'name-asc' ? a.name.localeCompare(b.name) : b.name.localeCompare(a.name)));
return sorted;
});
@@ -61,7 +78,7 @@
const groups = new Map<string, Template[]>();
for (const template of sortedTemplates) {
- const key = template.registry?.name ?? (template.isRemote ? m.templates_remote() : m.local());
+ const key = registryLabel(template);
const items = groups.get(key) ?? [];
items.push(template);
groups.set(key, items);
@@ -77,6 +94,21 @@
'name-desc': m.templates_sort_name_desc()
};
+ function registryLabel(template: Template): string {
+ return template.registry?.name ?? (template.isRemote ? m.templates_remote() : m.local());
+ }
+
+ function clearSearch() {
+ searchQuery = '';
+ searchInput?.focus();
+ }
+
+ // The dialog stays mounted while closed, so drop the query rather than showing stale results on reopen.
+ function closeDialog() {
+ searchQuery = '';
+ open = false;
+ }
+
function normalizeTags(tags: unknown): string[] {
if (!tags || tags === null || tags === undefined) return [];
@@ -126,7 +158,7 @@
content: details.content,
envContent: details.envContent
});
- open = false;
+ closeDialog();
toast.success(m.templates_loaded_success({ name: template.name }));
})()
);
@@ -206,7 +238,7 @@
{:else}
<ProjectsIcon class="size-3" />
{/if}
- {template.registry?.name ?? (template.isRemote ? m.templates_remote() : m.local())}
+ {registryLabel(template)}
</Badge>
</div>
{/if}
@@ -257,14 +289,52 @@
</Card>
{/snippet}
+{#snippet groupGrid(items: Template[])}
+ <div class="px-6 pb-6">
+ <div class="grid grid-cols-1 gap-4 md:grid-cols-2">
+ {#each items as template (template.id)}
+ {@render templateCard(template)}
+ {/each}
+ </div>
+ </div>
+{/snippet}
+
<ResponsiveDialog
bind:open
title={m.templates_choose_title()}
description={m.templates_choose_description()}
contentClass="sm:max-w-225"
+ onOpenChange={(next) => {
+ if (!next) searchQuery = '';
+ }}
>
{#snippet children()}
<div class="space-y-4">
+ <InputGroup.Root>
+ <InputGroup.Addon>
+ <SearchIcon aria-hidden="true" />
+ </InputGroup.Addon>
+ <InputGroup.Input
+ type="text"
+ placeholder={m.templates_search_placeholder()}
+ aria-label={m.common_search()}
+ bind:value={searchQuery}
+ bind:ref={searchInput}
+ />
+ {#if searchQuery}
+ <InputGroup.Addon align="inline-end">
+ <InputGroup.Button
+ size="icon-xs"
+ onclick={clearSearch}
+ title={m.common_clear_search()}
+ aria-label={m.common_clear_search()}
+ >
+ <CloseIcon class="size-4" />
+ </InputGroup.Button>
+ </InputGroup.Addon>
+ {/if}
+ </InputGroup.Root>
+
<div class="flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between">
<div class="flex items-center gap-3">
<SwitchWithLabel
@@ -300,34 +370,47 @@
{m.templates_add_registry_prompt_part2()}
</p>
</div>
- {:else if groupByRegistry && groupedTemplates.length > 0}
+ {:else if filteredTemplates.length === 0}
+ <EmptyState
+ icon={SearchIcon}
+ title={m.common_no_results_found()}
+ description={m.common_no_results_hint()}
+ actionLabel={m.common_clear_search()}
+ onAction={clearSearch}
+ />
+ {:else if groupByRegistry}
<div class="space-y-3">
{#each groupedTemplates as group (group.name)}
- <Collapsible.Root class="w-full">
+ {#if normalizedQuery}
+ <!-- Static headings while searching so matches are never hidden in a collapsed group. -->
<Card>
- <Collapsible.Trigger>
- {#snippet child({ props })}
- <button {...props} type="button" class="flex w-full items-center justify-between px-4 py-3 text-left">
- <div class="flex items-center gap-2">
- <ArrowDownIcon class="hidden size-4 data-[state=open]:block" />
- <ArrowRightIcon class="block size-4 data-[state=open]:hidden" />
- <span class="font-semibold">{group.name}</span>
- <Badge variant="secondary" class="ml-2">{group.items.length}</Badge>
- </div>
- </button>
- {/snippet}
- </Collapsible.Trigger>
- <Collapsible.Content>
- <div class="px-6 pb-6">
- <div class="grid grid-cols-1 gap-4 md:grid-cols-2">
- {#each group.items as template (template.id)}
- {@render templateCard(template)}
- {/each}
- </div>
- </div>
- </Collapsible.Content>
+ <div class="flex items-center gap-2 px-4 py-3">
+ <span class="font-semibold">{group.name}</span>
+ <Badge variant="secondary" class="ml-2">{group.items.length}</Badge>
+ </div>
+ {@render groupGrid(group.items)}
</Card>
- </Collapsible.Root>
+ {:else}
+ <Collapsible.Root class="w-full">
+ <Card>
+ <Collapsible.Trigger>
+ {#snippet child({ props })}
+ <button {...props} type="button" class="flex w-full items-center justify-between px-4 py-3 text-left">
+ <div class="flex items-center gap-2">
+ <ArrowDownIcon class="hidden size-4 data-[state=open]:block" />
+ <ArrowRightIcon class="block size-4 data-[state=open]:hidden" />
+ <span class="font-semibold">{group.name}</span>
+ <Badge variant="secondary" class="ml-2">{group.items.length}</Badge>
+ </div>
+ </button>
+ {/snippet}
+ </Collapsible.Trigger>
+ <Collapsible.Content>
+ {@render groupGrid(group.items)}
+ </Collapsible.Content>
+ </Card>
+ </Collapsible.Root>
+ {/if}
{/each}
</div>
{:else}
@@ -342,7 +425,7 @@
{/snippet}
{#snippet footer()}
- <ArcaneButton action="cancel" onclick={() => (open = false)} />
+ <ArcaneButton action="cancel" onclick={closeDialog} />
{/snippet}
</ResponsiveDialog>
diff --git a/frontend/src/lib/components/ui/input-group/input-group-input.svelte b/frontend/src/lib/components/ui/input-group/input-group-input.svelte
index 29b0647db..fc896699b 100644
--- a/frontend/src/lib/components/ui/input-group/input-group-input.svelte
+++ b/frontend/src/lib/components/ui/input-group/input-group-input.svelte
@@ -3,12 +3,18 @@
import type { HTMLInputAttributes } from 'svelte/elements';
let {
+ ref = $bindable(null),
value = $bindable(),
size = 'default',
mono = false,
class: className,
...props
- }: Omit<HTMLInputAttributes, 'size'> & { value?: string; size?: 'default' | 'sm'; mono?: boolean } = $props();
+ }: Omit<HTMLInputAttributes, 'size'> & {
+ ref?: HTMLInputElement | null;
+ value?: string;
+ size?: 'default' | 'sm';
+ mono?: boolean;
+ } = $props();
</script>
<input
@@ -19,6 +25,7 @@
mono && 'font-mono',
className
)}
+ bind:this={ref}
bind:value
{...props}
/>
diff --git a/tests/setup/compose-postgres.yaml b/tests/setup/compose-postgres.yaml
index 8d3c2af19..5259ee435 100644
--- a/tests/setup/compose-postgres.yaml
+++ b/tests/setup/compose-postgres.yaml
@@ -1,6 +1,7 @@
services:
minio:
- image: quay.io/minio/minio:RELEASE.2025-09-07T16-13-09Z
+ # quay.io/minio/minio went private on 2026-09-24; Chainguard's build is the anonymous-pull replacement.
+ image: cgr.dev/chainguard/minio:latest-dev@sha256:d7c906993247627c19f37fc1fa302c34cf2d209ae0e7dc7d52fb0be6ac2849ba
# A directory created under the data dir is served as a bucket, so backups
# have somewhere to write without a separate provisioning container.
entrypoint:
@@ -13,7 +14,7 @@ services:
- MINIO_ROOT_USER=arcane-test
- MINIO_ROOT_PASSWORD=arcane-test-secret
healthcheck:
- test: ['CMD', 'curl', '-fs', 'http://localhost:9000/minio/health/live']
+ test: ['CMD', 'mc', 'ready', 'local']
interval: 2s
timeout: 5s
retries: 15
diff --git a/tests/setup/compose-proxy.yaml b/tests/setup/compose-proxy.yaml
index 4e5c060ef..c561b1ee7 100644
--- a/tests/setup/compose-proxy.yaml
+++ b/tests/setup/compose-proxy.yaml
@@ -1,6 +1,7 @@
services:
minio:
- image: quay.io/minio/minio:RELEASE.2025-09-07T16-13-09Z
+ # quay.io/minio/minio went private on 2026-09-24; Chainguard's build is the anonymous-pull replacement.
+ image: cgr.dev/chainguard/minio:latest-dev@sha256:d7c906993247627c19f37fc1fa302c34cf2d209ae0e7dc7d52fb0be6ac2849ba
# A directory created under the data dir is served as a bucket, so backups
# have somewhere to write without a separate provisioning container.
entrypoint:
@@ -13,7 +14,7 @@ services:
- MINIO_ROOT_USER=arcane-test
- MINIO_ROOT_PASSWORD=arcane-test-secret
healthcheck:
- test: ['CMD', 'curl', '-fs', 'http://localhost:9000/minio/health/live']
+ test: ['CMD', 'mc', 'ready', 'local']
interval: 2s
timeout: 5s
retries: 15
diff --git a/tests/setup/compose.yaml b/tests/setup/compose.yaml
index bfc73f278..e2dc29416 100644
--- a/tests/setup/compose.yaml
+++ b/tests/setup/compose.yaml
@@ -1,6 +1,7 @@
services:
minio:
- image: quay.io/minio/minio:RELEASE.2025-09-07T16-13-09Z
+ # quay.io/minio/minio went private on 2026-09-24; Chainguard's build is the anonymous-pull replacement.
+ image: cgr.dev/chainguard/minio:latest-dev@sha256:d7c906993247627c19f37fc1fa302c34cf2d209ae0e7dc7d52fb0be6ac2849ba
# A directory created under the data dir is served as a bucket, so backups
# have somewhere to write without a separate provisioning container.
entrypoint:
@@ -13,7 +14,7 @@ services:
- MINIO_ROOT_USER=arcane-test
- MINIO_ROOT_PASSWORD=arcane-test-secret
healthcheck:
- test: ['CMD', 'curl', '-fs', 'http://localhost:9000/minio/health/live']
+ test: ['CMD', 'mc', 'ready', 'local']
interval: 2s
timeout: 5s
retries: 15