Skip to content

Modern Docker Management, Designed for Everyone

fix: use the opened resource's environment in the tab title with all environments enabled (#4450)

DominikZublasinga509628d4287
diff --git a/frontend/src/lib/components/arcane-table/cells/environment-cell.svelte b/frontend/src/lib/components/arcane-table/cells/environment-cell.svelte
index 100c7316c..36ee9670c 100644
--- a/frontend/src/lib/components/arcane-table/cells/environment-cell.svelte
+++ b/frontend/src/lib/components/arcane-table/cells/environment-cell.svelte
@@ -2,7 +2,7 @@
import * as ArcaneTooltip from '#lib/components/arcane-tooltip/index.js';
import { EnvironmentsIcon, RemoteEnvironmentIcon } from '#lib/icons/index.js';
import { environmentColor } from '#lib/stores/environment-colors.store.svelte.js';
- import { allEnvironmentsPreview, LOCAL_DOCKER_ENVIRONMENT_ID } from '#lib/stores/environment.store.svelte.js';
+ import { allEnvironmentsPreview, environmentStore, LOCAL_DOCKER_ENVIRONMENT_ID } from '#lib/stores/environment.store.svelte.js';
import userStore from '#lib/stores/user-store.svelte.js';
import { environmentName } from '#lib/utils/environments.js';
@@ -14,27 +14,30 @@
const Icon = $derived(environmentId === LOCAL_DOCKER_ENVIRONMENT_ID ? EnvironmentsIcon : RemoteEnvironmentIcon);
</script>
-{#if showDot}
- <ArcaneTooltip.Root>
- <!-- A plain span: the default trigger wrapper is interactive and would swallow the row click. -->
- <ArcaneTooltip.Trigger>
- {#snippet child({ props })}
- <span {...props} class="inline-flex size-4 items-center justify-center" aria-label={environmentName(environmentId)}>
- <span class="size-2.5 rounded-full bg-(--environment-color)" style:--environment-color={color}></span>
- </span>
- {/snippet}
- </ArcaneTooltip.Trigger>
- <ArcaneTooltip.Content>{environmentName(environmentId)}</ArcaneTooltip.Content>
- </ArcaneTooltip.Root>
-{:else}
- <!-- Mixing toward the foreground keeps any picked color readable in light and dark themes. -->
- <span
- class={['inline-flex min-w-0 items-center gap-1.5 text-sm', color ? 'environment-colored' : 'text-muted-foreground']}
- style:--environment-color={color}
- >
- <Icon class="size-3.5 shrink-0" />
- <span class="truncate">{environmentName(environmentId)}</span>
- </span>
+<!-- With a single environment shown, the switcher already names it. -->
+{#if environmentStore.shown.length > 1}
+ {#if showDot}
+ <ArcaneTooltip.Root>
+ <!-- A plain span: the default trigger wrapper is interactive and would swallow the row click. -->
+ <ArcaneTooltip.Trigger>
+ {#snippet child({ props })}
+ <span {...props} class="inline-flex size-4 items-center justify-center" aria-label={environmentName(environmentId)}>
+ <span class="size-2.5 rounded-full bg-(--environment-color)" style:--environment-color={color}></span>
+ </span>
+ {/snippet}
+ </ArcaneTooltip.Trigger>
+ <ArcaneTooltip.Content>{environmentName(environmentId)}</ArcaneTooltip.Content>
+ </ArcaneTooltip.Root>
+ {:else}
+ <!-- Mixing toward the foreground keeps any picked color readable in light and dark themes. -->
+ <span
+ class={['inline-flex min-w-0 items-center gap-1.5 text-sm', color ? 'environment-colored' : 'text-muted-foreground']}
+ style:--environment-color={color}
+ >
+ <Icon class="size-3.5 shrink-0" />
+ <span class="truncate">{environmentName(environmentId)}</span>
+ </span>
+ {/if}
{/if}
<style>
diff --git a/frontend/src/routes/(app)/containers/[containerId]/+page.svelte b/frontend/src/routes/(app)/containers/[containerId]/+page.svelte
index e7a1f416e..a56be3a00 100644
--- a/frontend/src/routes/(app)/containers/[containerId]/+page.svelte
+++ b/frontend/src/routes/(app)/containers/[containerId]/+page.svelte
@@ -9,6 +9,7 @@
import type { ActionButton } from '#lib/components/action-button-group/types.js';
import ActionButtons from '#lib/components/action-buttons.svelte';
+ import EnvironmentCell from '#lib/components/arcane-table/cells/environment-cell.svelte';
import IconImage from '#lib/components/icon-image.svelte';
import ResourceNotFound from '#lib/components/resource-not-found.svelte';
import { Badge } from '#lib/components/ui/badge/index.js';
@@ -467,6 +468,7 @@
minWidth="20">{getContainerStatusLabel(container.state.status)}</Badge
>
{/if}
+ <EnvironmentCell value={currentEnvId} />
{#if updateInfo?.hasUpdate}
<Badge variant="amber" minWidth="20">{m.sidebar_update_available()}</Badge>
{/if}
diff --git a/frontend/src/routes/(app)/containers/[containerId]/edit/+page.svelte b/frontend/src/routes/(app)/containers/[containerId]/edit/+page.svelte
index 649831ba8..8fddf0134 100644
--- a/frontend/src/routes/(app)/containers/[containerId]/edit/+page.svelte
+++ b/frontend/src/routes/(app)/containers/[containerId]/edit/+page.svelte
@@ -5,6 +5,7 @@
import { toast } from 'svelte-sonner';
import { ArcaneButton } from '#lib/components/arcane-button/index.js';
+ import EnvironmentCell from '#lib/components/arcane-table/cells/environment-cell.svelte';
import { openConfirmDialog } from '#lib/components/confirm-dialog/index.js';
import {
containerFormSchema,
@@ -81,6 +82,7 @@
/>
<div class="hidden h-4 w-px bg-border sm:block"></div>
<h1 class="truncate text-base font-semibold">{m.common_edit()} · {data.editConfig.name}</h1>
+ <EnvironmentCell value={data.envId} />
</div>
</div>
diff --git a/frontend/src/routes/(app)/images/[imageId]/+page.svelte b/frontend/src/routes/(app)/images/[imageId]/+page.svelte
index 8c74fdc29..dc9ee69e0 100644
--- a/frontend/src/routes/(app)/images/[imageId]/+page.svelte
+++ b/frontend/src/routes/(app)/images/[imageId]/+page.svelte
@@ -6,6 +6,7 @@
import type { ActionButton } from '#lib/components/action-button-group/types.js';
import { ArcaneButton } from '#lib/components/arcane-button/index.js';
+ import EnvironmentCell from '#lib/components/arcane-table/cells/environment-cell.svelte';
import { openConfirmDialog } from '#lib/components/confirm-dialog/index.js';
import { DetailMetaStrip, DetailSection, KeyValueCard } from '#lib/components/resource-detail/index.js';
import { TabBar } from '#lib/components/tab-bar/index.js';
@@ -418,6 +419,10 @@
</script>
<ResourceDetailLayout backUrl="/images" backLabel={m.images()} title={detailTitle} {actions}>
+ {#snippet badges()}
+ <EnvironmentCell value={currentEnvId} />
+ {/snippet}
+
{#if image}
{#snippet kvTile(label: string, value: string, wide = false)}
<KeyValueCard {label} class={wide ? 'sm:col-span-2 lg:col-span-3' : undefined} valueTitle={value}>
diff --git a/frontend/src/routes/(app)/networks/[networkId]/+page.svelte b/frontend/src/routes/(app)/networks/[networkId]/+page.svelte
index 663d0d7eb..24bd26821 100644
--- a/frontend/src/routes/(app)/networks/[networkId]/+page.svelte
+++ b/frontend/src/routes/(app)/networks/[networkId]/+page.svelte
@@ -4,6 +4,7 @@
import type { ActionButton } from '#lib/components/action-button-group/types.js';
import { ArcaneButton } from '#lib/components/arcane-button/index.js';
+ import EnvironmentCell from '#lib/components/arcane-table/cells/environment-cell.svelte';
import { openConfirmDialog } from '#lib/components/confirm-dialog/index.js';
import { DetailMetaStrip, DetailSection, KeyValueCard, KeyValueGrid } from '#lib/components/resource-detail/index.js';
import * as Alert from '#lib/components/ui/alert/index.js';
@@ -338,6 +339,7 @@
<Badge variant="blue" minWidth="20">{m.networks_predefined()}</Badge>
{/if}
<Badge variant="purple" minWidth="20">{network?.driver ?? m.common_unknown()}</Badge>
+ <EnvironmentCell value={data.envId} />
{/snippet}
{#if errorMessage}
diff --git a/frontend/src/routes/(app)/projects/[projectId]/+page.svelte b/frontend/src/routes/(app)/projects/[projectId]/+page.svelte
index 7b3c63ab9..41a615a74 100644
--- a/frontend/src/routes/(app)/projects/[projectId]/+page.svelte
+++ b/frontend/src/routes/(app)/projects/[projectId]/+page.svelte
@@ -11,6 +11,7 @@
import type { ActionButton } from '#lib/components/action-button-group/types.js';
import ActionButtons from '#lib/components/action-buttons.svelte';
import { ArcaneButton } from '#lib/components/arcane-button/index.js';
+ import EnvironmentCell from '#lib/components/arcane-table/cells/environment-cell.svelte';
import * as ArcaneTooltip from '#lib/components/arcane-tooltip/index.js';
import CodePanel from '#lib/components/code-panel.svelte';
import ComposeFileEditorPanel from '#lib/components/compose-file-editor-panel.svelte';
@@ -2168,6 +2169,7 @@
class="max-w-40 min-w-0 sm:max-w-56 md:max-w-72 lg:max-w-88"
/>
{@render projectStatus(project)}
+ <EnvironmentCell value={envId} />
{#if project.isArchived}
<Badge variant="gray" minWidth="20">{m.projects_archived_badge()}</Badge>
{/if}
diff --git a/frontend/src/routes/(app)/volumes/[volumeName]/+page.svelte b/frontend/src/routes/(app)/volumes/[volumeName]/+page.svelte
index 79f56f444..fd1d77c02 100644
--- a/frontend/src/routes/(app)/volumes/[volumeName]/+page.svelte
+++ b/frontend/src/routes/(app)/volumes/[volumeName]/+page.svelte
@@ -8,6 +8,7 @@
import { ActionButtonGroup } from '#lib/components/action-button-group/index.js';
import type { ActionButton } from '#lib/components/action-button-group/types.js';
import { ArcaneButton } from '#lib/components/arcane-button/index.js';
+ import EnvironmentCell from '#lib/components/arcane-table/cells/environment-cell.svelte';
import InUseStatus from '#lib/components/arcane-table/cells/in-use-status.svelte';
import CodePanel from '#lib/components/code-panel.svelte';
import { openConfirmDialog } from '#lib/components/confirm-dialog//index.js';
@@ -1106,6 +1107,7 @@
{#if volume.scope}
<Badge variant="purple" minWidth="20">{volume.scope}</Badge>
{/if}
+ <EnvironmentCell value={currentEnvId} />
</div>
</div>
{/snippet}
diff --git a/frontend/src/routes/+layout.svelte b/frontend/src/routes/+layout.svelte
index b206cb592..7562c8d37 100644
--- a/frontend/src/routes/+layout.svelte
+++ b/frontend/src/routes/+layout.svelte
@@ -20,6 +20,7 @@
import { isAuthPagePath } from '#lib/services/api-service.js';
import settingsStore from '#lib/stores/config-store.svelte.js';
import { environmentStore } from '#lib/stores/environment.store.svelte.js';
+ import { environmentName } from '#lib/utils/environments.js';
import { finishNavigation, startPageView } from '#lib/utils/telemetry.js';
import type { LayoutProps } from './$types';
@@ -71,9 +72,14 @@
}
});
+ // Detail pages opened with `?env=` return their own envId, which can differ from the selected environment.
+ const titleEnvironmentName = $derived(
+ typeof page.data['envId'] === 'string' ? environmentName(page.data['envId']) : environmentStore.selected?.name
+ );
+
// Root layout owns the document title; nested <title> tags are never restored on unmount.
const pageTitle = $derived(
- [m.layout_title(), getNavigationTitleForPath(page.url.pathname), resourceName, environmentStore.selected?.name]
+ [m.layout_title(), getNavigationTitleForPath(page.url.pathname), resourceName, titleEnvironmentName]
.filter(Boolean)
.join(' | ')
);