Modern Docker Management, Designed for Everyone
Go composecontainer-managementcontainersdockerdocker-composedocker-managementgoself-hostedsveltekittypescriptweb-ui
fix: image polling value allows any number (#501)
Kyle Mendelle895bec298c1
diff --git a/backend/.air.toml b/backend/.air.tomlindex 2918e4591..752d6a4cf 100644--- a/backend/.air.toml+++ b/backend/.air.toml@@ -3,7 +3,7 @@ tmp_dir = ".bin"[build]bin = "./.bin/arcane"- cmd = "CGO_ENABLED=0 go build -o ./.bin/arcane ./cmd"+ cmd = "CGO_ENABLED=0 go build -o ./.bin/arcane ./cmd"exclude_dir = [".bin", "data"]stop_on_error = truedelay = 1000diff --git a/frontend/messages/en.json b/frontend/messages/en.jsonindex 21d3a55a5..7a6c67383 100644--- a/frontend/messages/en.json+++ b/frontend/messages/en.json@@ -134,9 +134,9 @@"general_save_instructions": "Save your updated settings.","docker_enable_polling_label": "Enable Image Polling","docker_enable_polling_description": "Periodically check registries for newer image versions",- "docker_polling_interval_label": "Polling Interval (minutes)",+ "docker_polling_interval_label": "Polling Interval","docker_polling_interval_placeholder": "60",- "docker_polling_interval_description": "How often to check for new images (5-1440 minutes)",+ "docker_polling_interval_description": "How often to check for new images (5-10080 minutes)","docker_auto_update_label": "Auto-update Containers","docker_auto_update_description": "Automatically update containers when newer images are found","docker_auto_update_interval_label": "Auto-update Interval (minutes)",@@ -1049,5 +1049,14 @@"common_skip": "Skip","language": "Language","bridge": "Bridge",- "ports": "Ports"+ "ports": "Ports",+ "custom": "Custom",+ "weekly": "Weekly",+ "daily": "Daily",+ "hourly": "Hourly",+ "polling_hourly_description": "Check for new images every 60 minutes",+ "polling_daily_description": "Check for new images every 1440 minutes",+ "polling_weekly_description": "Check for new images every 10080 minutes",+ "use_custom_polling_value": "Use a custom polling value between 5-10080 minutes",+ "custom_polling_interval": "Custom Polling Interval (minutes)"}diff --git a/frontend/src/lib/components/form/select-with-label.svelte b/frontend/src/lib/components/form/select-with-label.svelteindex 9073e2643..a581b1269 100644--- a/frontend/src/lib/components/form/select-with-label.svelte+++ b/frontend/src/lib/components/form/select-with-label.svelte@@ -58,7 +58,12 @@{:else}{#each options as option (option.value)}<Select.Item value={option.value}>- {option.label}+ <div class="flex flex-col items-start gap-1">+ <span class="font-medium">{option.label}</span>+ {#if option.description}+ <span class="text-muted-foreground text-xs">{option.description}</span>+ {/if}+ </div></Select.Item>{/each}{/if}diff --git a/frontend/src/routes/onboarding/docker/+page.svelte b/frontend/src/routes/onboarding/docker/+page.svelteindex 868d317c9..de7de1bce 100644--- a/frontend/src/routes/onboarding/docker/+page.svelte+++ b/frontend/src/routes/onboarding/docker/+page.svelte@@ -22,6 +22,28 @@let isLoading = $state(false);let pruneMode = $derived(currentSettings.dockerPruneMode);+ type PollingIntervalMode = 'hourly' | 'daily' | 'weekly' | 'custom';++ const imagePollingOptions: Array<{+ value: PollingIntervalMode;+ label: string;+ description: string;+ minutes?: number;+ }> = [+ { value: 'hourly', minutes: 60, label: m.hourly(), description: m.polling_hourly_description() },+ { value: 'daily', minutes: 1440, label: m.daily(), description: m.polling_daily_description() },+ { value: 'weekly', minutes: 10080, label: m.weekly(), description: m.polling_weekly_description() },+ { value: 'custom', label: m.custom(), description: m.use_custom_polling_value() }+ ];++ const presetToMinutes = Object.fromEntries(+ imagePollingOptions.filter((o) => o.value !== 'custom').map((o) => [o.value, o.minutes!])+ ) as Record<Exclude<PollingIntervalMode, 'custom'>, number>;++ let pollingIntervalMode = $state<PollingIntervalMode>(+ imagePollingOptions.find((o) => o.minutes === currentSettings.pollingInterval)?.value ?? 'custom'+ );+const pruneModeOptions = [{ value: 'all', label: m.docker_prune_all(), description: m.docker_prune_all_description() },{ value: 'dangling', label: m.docker_prune_dangling(), description: m.docker_prune_dangling_description() }@@ -33,7 +55,7 @@const formSchema = z.object({pollingEnabled: z.boolean(),- pollingInterval: z.number().int(),+ pollingInterval: z.number().int().min(5).max(10080),autoUpdate: z.boolean(),autoUpdateInterval: z.number().int(),dockerPruneMode: z.enum(['all', 'dangling'])@@ -41,6 +63,12 @@let { inputs: formInputs, ...form } = $derived(createForm<typeof formSchema>(formSchema, currentSettings));+ $effect(() => {+ if (pollingIntervalMode !== 'custom') {+ $formInputs.pollingInterval.value = presetToMinutes[pollingIntervalMode];+ }+ });+async function handleNext() {const data = form.validate();if (!data) return;@@ -102,15 +130,26 @@{#if $formInputs.pollingEnabled.value}<div class="space-y-4">- <FormInput- bind:input={$formInputs.pollingInterval}- type="number"- id="pollingInterval"+ <!-- New: preset select + optional custom input -->+ <SelectWithLabel+ id="pollingIntervalMode"+ name="pollingIntervalMode"+ bind:value={pollingIntervalMode}label={m.docker_polling_interval_label()}- placeholder={m.docker_polling_interval_placeholder()}- description={m.docker_polling_interval_description()}+ options={imagePollingOptions.map(({ value, label, description }) => ({ value, label, description }))}/>+ {#if pollingIntervalMode === 'custom'}+ <FormInput+ bind:input={$formInputs.pollingInterval}+ type="number"+ id="pollingInterval"+ label={m.custom_polling_interval()}+ placeholder={m.docker_polling_interval_placeholder()}+ description={m.docker_polling_interval_description()}+ />+ {/if}+{#if $formInputs.pollingInterval.value < 30}<Alert.Root variant="warning"><ZapIcon class="size-4" />diff --git a/frontend/src/routes/settings/forms/docker-settings-form.svelte b/frontend/src/routes/settings/forms/docker-settings-form.svelteindex f92e907d5..515352314 100644--- a/frontend/src/routes/settings/forms/docker-settings-form.svelte+++ b/frontend/src/routes/settings/forms/docker-settings-form.svelte@@ -23,6 +23,48 @@let isLoading = $state(false);let pruneMode = $state(settings.dockerPruneMode);+ type PollingIntervalMode = 'hourly' | 'daily' | 'weekly' | 'custom';++ const imagePollingOptions: Array<{+ value: PollingIntervalMode;+ label: string;+ description: string;+ minutes?: number;+ }> = [+ {+ value: 'hourly',+ minutes: 60,+ label: m.hourly(),+ // If these were swapped, fix them:+ description: m.polling_hourly_description()+ },+ {+ value: 'daily',+ minutes: 1440,+ label: m.daily(),+ description: m.polling_daily_description()+ },+ {+ value: 'weekly',+ minutes: 10080,+ label: m.weekly(),+ description: m.polling_weekly_description()+ },+ {+ value: 'custom',+ label: m.custom(),+ description: m.use_custom_polling_value()+ }+ ];++ const presetToMinutes = Object.fromEntries(+ imagePollingOptions.filter((o) => o.value !== 'custom').map((o) => [o.value, o.minutes!])+ ) as Record<Exclude<PollingIntervalMode, 'custom'>, number>;++ let pollingIntervalMode = $state<PollingIntervalMode>(+ imagePollingOptions.find((o) => o.minutes === settings.pollingInterval)?.value ?? 'custom'+ );+const pruneModeOptions = [{value: 'all',@@ -42,7 +84,7 @@const formSchema = z.object({pollingEnabled: z.boolean(),- pollingInterval: z.number().int(),+ pollingInterval: z.number().int().min(5).max(10080),autoUpdate: z.boolean(),autoUpdateInterval: z.number().int(),dockerPruneMode: z.enum(['all', 'dangling'])@@ -50,6 +92,13 @@let { inputs: formInputs, ...form } = $derived(createForm<typeof formSchema>(formSchema, settings));+ // Keep form value in sync with preset selection unless "custom"+ $effect(() => {+ if (pollingIntervalMode !== 'custom') {+ $formInputs.pollingInterval.value = presetToMinutes[pollingIntervalMode];+ }+ });+async function onSubmit() {const data = form.validate();if (!data) return;@@ -73,14 +122,25 @@/>{#if $formInputs.pollingEnabled.value}<div class="space-y-4">- <FormInput- bind:input={$formInputs.pollingInterval}- type="number"- id="pollingInterval"+ <SelectWithLabel+ id="pollingIntervalMode"+ name="pollingIntervalMode"+ bind:value={pollingIntervalMode}label={m.docker_polling_interval_label()}- placeholder={m.docker_polling_interval_placeholder()}- description={m.docker_polling_interval_description()}+ placeholder="Select interval"+ options={imagePollingOptions.map(({ value, label, description }) => ({ value, label, description }))}/>+ {#if pollingIntervalMode === 'custom'}+ <FormInput+ bind:input={$formInputs.pollingInterval}+ type="number"+ id="pollingInterval"+ label={m.custom_polling_interval()}+ placeholder={m.docker_polling_interval_placeholder()}+ description={m.docker_polling_interval_description()}+ />+ {/if}+<div>{#if $formInputs.pollingInterval.value < 30}<Alert.Root variant="warning">@@ -90,6 +150,7 @@</Alert.Root>{/if}</div>+<div><SwitchWithLabelid="autoUpdateSwitch"@@ -120,7 +181,6 @@description={pruneModeDescription}placeholder={m.docker_prune_placeholder()}options={pruneModeOptions}- groupLabel={m.docker_prune_group_label()}onValueChange={(v) => (pruneMode = v as 'all' | 'dangling')}/></div>