Skip to content

Modern Docker Management, Designed for Everyone

fix: add environment selector on error page to avoid a 'stuck state' (#1298)

Kyle Mendelle854b4f5264c
diff --git a/frontend/messages/en.json b/frontend/messages/en.json
index 21cf616c9..984b0d08e 100644
--- a/frontend/messages/en.json
+++ b/frontend/messages/en.json
@@ -12,6 +12,10 @@
"error_not_found": "Not Found",
"error_generic": "Something went wrong",
"error_go_to_dashboard": "Go to Dashboard",
+ "error_connection_local_docker": "Unable to connect to local Docker daemon",
+ "error_connection_local_docker_desc": "Unable to connect to local Docker daemon at {host}. Please ensure Docker is running and accessible.",
+ "error_connection_remote_environment": "Unable to connect to remote environment \"{name}\"",
+ "error_connection_remote_environment_desc": "Unable to connect to remote environment \"{name}\" at {url}. Please check that the Arcane agent is running and the URL is correct.",
"_comment_common_generic": "=== COMMON - GENERIC ===",
"common_refresh": "Refresh",
"common_unknown": "Unknown",
diff --git a/frontend/src/lib/components/dialogs/environment-switcher-dialog.svelte b/frontend/src/lib/components/dialogs/environment-switcher-dialog.svelte
index d647cd424..015bb4734 100644
--- a/frontend/src/lib/components/dialogs/environment-switcher-dialog.svelte
+++ b/frontend/src/lib/components/dialogs/environment-switcher-dialog.svelte
@@ -220,7 +220,8 @@
function getConnectionString(env: Environment): string {
if (env.id === '0') {
- return $settingsStore.dockerHost || 'unix:///var/run/docker.sock';
+ const host = $settingsStore ? $settingsStore.dockerHost : 'unix:///var/run/docker.sock';
+ return host || 'unix:///var/run/docker.sock';
} else {
return env.apiUrl;
}
diff --git a/frontend/src/lib/components/error.svelte b/frontend/src/lib/components/error.svelte
index b6c8b1770..a235f6f71 100644
--- a/frontend/src/lib/components/error.svelte
+++ b/frontend/src/lib/components/error.svelte
@@ -4,6 +4,9 @@
import { ErrorNotFoundIcon } from '$lib/icons';
import { ArcaneButton } from '$lib/components/arcane-button/index.js';
import { goto } from '$app/navigation';
+ import EnvironmentSwitcherDialog from '$lib/components/dialogs/environment-switcher-dialog.svelte';
+ import { environmentStore } from '$lib/stores/environment.store.svelte';
+ import settingsStore from '$lib/stores/config-store';
let {
message,
@@ -20,6 +23,53 @@
actionHref?: string;
actionLabel?: string;
} = $props();
+
+ let envSwitcherOpen = $state(false);
+
+ // Check if this is a connection error
+ const isConnectionError = $derived.by(() => {
+ const lowerMessage = message.toLowerCase();
+ return (
+ lowerMessage.includes('connection') ||
+ lowerMessage.includes('proxy') ||
+ lowerMessage.includes('reset') ||
+ lowerMessage.includes('timeout') ||
+ lowerMessage.includes('network') ||
+ lowerMessage.includes('tcp') ||
+ lowerMessage.includes('dial') ||
+ lowerMessage.includes('lookup') ||
+ lowerMessage.includes('host') ||
+ lowerMessage.includes('refused') ||
+ lowerMessage.includes('internal error') ||
+ !status ||
+ status === 500 ||
+ status === 502 ||
+ status === 503 ||
+ status === 504
+ );
+ });
+
+ const connectionErrorTitle = $derived.by(() => {
+ if (environmentStore.selected?.id === '0') {
+ return m.error_connection_local_docker();
+ } else {
+ return m.error_connection_remote_environment({ name: environmentStore.selected?.name || 'Unknown' });
+ }
+ });
+
+ const connectionErrorMessage = $derived.by(() => {
+ if (environmentStore.selected?.id === '0') {
+ const host = $settingsStore ? $settingsStore.dockerHost : 'unix:///var/run/docker.sock';
+ return m.error_connection_local_docker_desc({
+ host: host || 'unix:///var/run/docker.sock'
+ });
+ } else {
+ return m.error_connection_remote_environment_desc({
+ name: environmentStore.selected?.name || 'Unknown',
+ url: environmentStore.selected?.apiUrl || 'Unknown URL'
+ });
+ }
+ });
</script>
<div class="grid h-full min-h-screen place-items-center px-6">
@@ -28,15 +78,25 @@
<Empty.Media variant="icon">
<ErrorNotFoundIcon class="text-destructive size-20" aria-hidden="true" />
</Empty.Media>
- <Empty.Title>{title}</Empty.Title>
- <Empty.Description>{message} - {status}</Empty.Description>
+ <Empty.Title>{isConnectionError ? connectionErrorTitle : title}</Empty.Title>
+ <Empty.Description>{isConnectionError ? connectionErrorMessage : message} - {status}</Empty.Description>
</Empty.Header>
<Empty.Content>
- {#if showButton}
- <Empty.Content>
+ <div class="flex flex-col gap-3">
+ {#if status !== 404}
+ <ArcaneButton
+ action="base"
+ tone="outline"
+ customLabel={m.sidebar_select_environment()}
+ onclick={() => (envSwitcherOpen = true)}
+ />
+ {/if}
+ {#if showButton}
<ArcaneButton action="base" customLabel={actionLabel} onclick={() => goto(actionHref)} />
- </Empty.Content>
- {/if}
+ {/if}
+ </div>
</Empty.Content>
</Empty.Root>
</div>
+
+<EnvironmentSwitcherDialog bind:open={envSwitcherOpen} />