Skip to content

Modern Docker Management, Designed for Everyone

feat: configure settings on environments via the web ui (#613)

Kyle Mendell7ad32899fc37
diff --git a/backend/internal/api/settings_handler.go b/backend/internal/api/settings_handler.go
index fde3e341d..a840210c2 100644
--- a/backend/internal/api/settings_handler.go
+++ b/backend/internal/api/settings_handler.go
@@ -18,7 +18,7 @@ type SettingsHandler struct {
func NewSettingsHandler(group *gin.RouterGroup, settingsService *services.SettingsService, authMiddleware *middleware.AuthMiddleware) {
handler := &SettingsHandler{settingsService: settingsService}
- apiGroup := group.Group("/settings")
+ apiGroup := group.Group("/environments/:id/settings")
apiGroup.GET("/public", handler.GetPublicSettings)
apiGroup.GET("", authMiddleware.WithAdminNotRequired().Add(), handler.GetSettings)
diff --git a/backend/internal/bootstrap/router_bootstrap.go b/backend/internal/bootstrap/router_bootstrap.go
index 8adb921cb..b2a9d24a4 100644
--- a/backend/internal/bootstrap/router_bootstrap.go
+++ b/backend/internal/bootstrap/router_bootstrap.go
@@ -71,7 +71,6 @@ func setupRouter(cfg *config.Config, appServices *Services) *gin.Engine {
api.NewAuthHandler(apiGroup, appServices.User, appServices.Auth, appServices.Oidc, authMiddleware)
api.NewEventHandler(apiGroup, appServices.Event, authMiddleware)
api.NewOidcHandler(apiGroup, appServices.Auth, appServices.Oidc, cfg)
- api.NewSettingsHandler(apiGroup, appServices.Settings, authMiddleware)
api.NewEnvironmentHandler(apiGroup, appServices.Environment, appServices.Settings, authMiddleware, cfg)
api.NewContainerRegistryHandler(apiGroup, appServices.ContainerRegistry, authMiddleware)
api.NewTemplateHandler(apiGroup, appServices.Template, authMiddleware)
@@ -99,6 +98,7 @@ func setupRouter(cfg *config.Config, appServices *Services) *gin.Engine {
api.NewSystemHandler(apiGroup, appServices.Docker, appServices.System, authMiddleware, cfg)
api.NewUpdaterHandler(apiGroup, appServices.Updater, authMiddleware)
api.NewVolumeHandler(apiGroup, appServices.Docker, appServices.Volume, authMiddleware)
+ api.NewSettingsHandler(apiGroup, appServices.Settings, authMiddleware)
if cfg.Environment != "production" {
for _, registerFunc := range registerPlaywrightRoutes {
diff --git a/frontend/messages/en.json b/frontend/messages/en.json
index 786c7b39a..caa367a62 100644
--- a/frontend/messages/en.json
+++ b/frontend/messages/en.json
@@ -116,6 +116,9 @@
"security_save_instructions": "Save your updated settings.",
"common_save": "Save",
"common_saving": "Saving…",
+ "environments_switch_to_edit_title": "Switch Environment",
+ "environments_switch_to_edit_message": "In order to change these settings, you must first switch to this environment. Would you like to switch now?",
+ "environments_switch_and_edit": "Switch & Edit Settings",
"general_projects_heading": "Project Paths",
"general_projects_description": "Configure where Arcane looks for your Compose files.",
"general_projects_directory_label": "Projects Directory",
diff --git a/frontend/src/lib/components/ui/alert-dialog/alert-dialog-action.svelte b/frontend/src/lib/components/ui/alert-dialog/alert-dialog-action.svelte
new file mode 100644
index 000000000..a00569120
--- /dev/null
+++ b/frontend/src/lib/components/ui/alert-dialog/alert-dialog-action.svelte
@@ -0,0 +1,18 @@
+<script lang="ts">
+ import { AlertDialog as AlertDialogPrimitive } from "bits-ui";
+ import { buttonVariants } from "$lib/components/ui/button/index.js";
+ import { cn } from "$lib/utils.js";
+
+ let {
+ ref = $bindable(null),
+ class: className,
+ ...restProps
+ }: AlertDialogPrimitive.ActionProps = $props();
+</script>
+
+<AlertDialogPrimitive.Action
+ bind:ref
+ data-slot="alert-dialog-action"
+ class={cn(buttonVariants(), className)}
+ {...restProps}
+/>
diff --git a/frontend/src/lib/components/ui/alert-dialog/alert-dialog-cancel.svelte b/frontend/src/lib/components/ui/alert-dialog/alert-dialog-cancel.svelte
new file mode 100644
index 000000000..a7b0cf795
--- /dev/null
+++ b/frontend/src/lib/components/ui/alert-dialog/alert-dialog-cancel.svelte
@@ -0,0 +1,18 @@
+<script lang="ts">
+ import { AlertDialog as AlertDialogPrimitive } from "bits-ui";
+ import { buttonVariants } from "$lib/components/ui/button/index.js";
+ import { cn } from "$lib/utils.js";
+
+ let {
+ ref = $bindable(null),
+ class: className,
+ ...restProps
+ }: AlertDialogPrimitive.CancelProps = $props();
+</script>
+
+<AlertDialogPrimitive.Cancel
+ bind:ref
+ data-slot="alert-dialog-cancel"
+ class={cn(buttonVariants({ variant: "outline" }), className)}
+ {...restProps}
+/>
diff --git a/frontend/src/lib/components/ui/alert-dialog/alert-dialog-content.svelte b/frontend/src/lib/components/ui/alert-dialog/alert-dialog-content.svelte
new file mode 100644
index 000000000..6c3c60460
--- /dev/null
+++ b/frontend/src/lib/components/ui/alert-dialog/alert-dialog-content.svelte
@@ -0,0 +1,27 @@
+<script lang="ts">
+ import { AlertDialog as AlertDialogPrimitive } from "bits-ui";
+ import AlertDialogOverlay from "./alert-dialog-overlay.svelte";
+ import { cn, type WithoutChild, type WithoutChildrenOrChild } from "$lib/utils.js";
+
+ let {
+ ref = $bindable(null),
+ class: className,
+ portalProps,
+ ...restProps
+ }: WithoutChild<AlertDialogPrimitive.ContentProps> & {
+ portalProps?: WithoutChildrenOrChild<AlertDialogPrimitive.PortalProps>;
+ } = $props();
+</script>
+
+<AlertDialogPrimitive.Portal {...portalProps}>
+ <AlertDialogOverlay />
+ <AlertDialogPrimitive.Content
+ bind:ref
+ data-slot="alert-dialog-content"
+ class={cn(
+ "bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed left-[50%] top-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",
+ className
+ )}
+ {...restProps}
+ />
+</AlertDialogPrimitive.Portal>
diff --git a/frontend/src/lib/components/ui/alert-dialog/alert-dialog-description.svelte b/frontend/src/lib/components/ui/alert-dialog/alert-dialog-description.svelte
new file mode 100644
index 000000000..2ec67dc2e
--- /dev/null
+++ b/frontend/src/lib/components/ui/alert-dialog/alert-dialog-description.svelte
@@ -0,0 +1,17 @@
+<script lang="ts">
+ import { AlertDialog as AlertDialogPrimitive } from "bits-ui";
+ import { cn } from "$lib/utils.js";
+
+ let {
+ ref = $bindable(null),
+ class: className,
+ ...restProps
+ }: AlertDialogPrimitive.DescriptionProps = $props();
+</script>
+
+<AlertDialogPrimitive.Description
+ bind:ref
+ data-slot="alert-dialog-description"
+ class={cn("text-muted-foreground text-sm", className)}
+ {...restProps}
+/>
diff --git a/frontend/src/lib/components/ui/alert-dialog/alert-dialog-footer.svelte b/frontend/src/lib/components/ui/alert-dialog/alert-dialog-footer.svelte
new file mode 100644
index 000000000..f78b97aba
--- /dev/null
+++ b/frontend/src/lib/components/ui/alert-dialog/alert-dialog-footer.svelte
@@ -0,0 +1,20 @@
+<script lang="ts">
+ import { cn, type WithElementRef } from "$lib/utils.js";
+ import type { HTMLAttributes } from "svelte/elements";
+
+ let {
+ ref = $bindable(null),
+ class: className,
+ children,
+ ...restProps
+ }: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
+</script>
+
+<div
+ bind:this={ref}
+ data-slot="alert-dialog-footer"
+ class={cn("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end", className)}
+ {...restProps}
+>
+ {@render children?.()}
+</div>
diff --git a/frontend/src/lib/components/ui/alert-dialog/alert-dialog-header.svelte b/frontend/src/lib/components/ui/alert-dialog/alert-dialog-header.svelte
new file mode 100644
index 000000000..c8fa7625f
--- /dev/null
+++ b/frontend/src/lib/components/ui/alert-dialog/alert-dialog-header.svelte
@@ -0,0 +1,20 @@
+<script lang="ts">
+ import type { HTMLAttributes } from "svelte/elements";
+ import { cn, type WithElementRef } from "$lib/utils.js";
+
+ let {
+ ref = $bindable(null),
+ class: className,
+ children,
+ ...restProps
+ }: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
+</script>
+
+<div
+ bind:this={ref}
+ data-slot="alert-dialog-header"
+ class={cn("flex flex-col gap-2 text-center sm:text-left", className)}
+ {...restProps}
+>
+ {@render children?.()}
+</div>
diff --git a/frontend/src/lib/components/ui/alert-dialog/alert-dialog-overlay.svelte b/frontend/src/lib/components/ui/alert-dialog/alert-dialog-overlay.svelte
new file mode 100644
index 000000000..a64ee7685
--- /dev/null
+++ b/frontend/src/lib/components/ui/alert-dialog/alert-dialog-overlay.svelte
@@ -0,0 +1,20 @@
+<script lang="ts">
+ import { AlertDialog as AlertDialogPrimitive } from "bits-ui";
+ import { cn } from "$lib/utils.js";
+
+ let {
+ ref = $bindable(null),
+ class: className,
+ ...restProps
+ }: AlertDialogPrimitive.OverlayProps = $props();
+</script>
+
+<AlertDialogPrimitive.Overlay
+ bind:ref
+ data-slot="alert-dialog-overlay"
+ class={cn(
+ "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
+ className
+ )}
+ {...restProps}
+/>
diff --git a/frontend/src/lib/components/ui/alert-dialog/alert-dialog-title.svelte b/frontend/src/lib/components/ui/alert-dialog/alert-dialog-title.svelte
new file mode 100644
index 000000000..7ef2b5fbe
--- /dev/null
+++ b/frontend/src/lib/components/ui/alert-dialog/alert-dialog-title.svelte
@@ -0,0 +1,17 @@
+<script lang="ts">
+ import { AlertDialog as AlertDialogPrimitive } from "bits-ui";
+ import { cn } from "$lib/utils.js";
+
+ let {
+ ref = $bindable(null),
+ class: className,
+ ...restProps
+ }: AlertDialogPrimitive.TitleProps = $props();
+</script>
+
+<AlertDialogPrimitive.Title
+ bind:ref
+ data-slot="alert-dialog-title"
+ class={cn("text-lg font-semibold", className)}
+ {...restProps}
+/>
diff --git a/frontend/src/lib/components/ui/alert-dialog/alert-dialog-trigger.svelte b/frontend/src/lib/components/ui/alert-dialog/alert-dialog-trigger.svelte
new file mode 100644
index 000000000..b22d1d50b
--- /dev/null
+++ b/frontend/src/lib/components/ui/alert-dialog/alert-dialog-trigger.svelte
@@ -0,0 +1,7 @@
+<script lang="ts">
+ import { AlertDialog as AlertDialogPrimitive } from "bits-ui";
+
+ let { ref = $bindable(null), ...restProps }: AlertDialogPrimitive.TriggerProps = $props();
+</script>
+
+<AlertDialogPrimitive.Trigger bind:ref data-slot="alert-dialog-trigger" {...restProps} />
diff --git a/frontend/src/lib/components/ui/alert-dialog/index.ts b/frontend/src/lib/components/ui/alert-dialog/index.ts
new file mode 100644
index 000000000..cc281c589
--- /dev/null
+++ b/frontend/src/lib/components/ui/alert-dialog/index.ts
@@ -0,0 +1,39 @@
+import { AlertDialog as AlertDialogPrimitive } from "bits-ui";
+import Trigger from "./alert-dialog-trigger.svelte";
+import Title from "./alert-dialog-title.svelte";
+import Action from "./alert-dialog-action.svelte";
+import Cancel from "./alert-dialog-cancel.svelte";
+import Footer from "./alert-dialog-footer.svelte";
+import Header from "./alert-dialog-header.svelte";
+import Overlay from "./alert-dialog-overlay.svelte";
+import Content from "./alert-dialog-content.svelte";
+import Description from "./alert-dialog-description.svelte";
+
+const Root = AlertDialogPrimitive.Root;
+const Portal = AlertDialogPrimitive.Portal;
+
+export {
+ Root,
+ Title,
+ Action,
+ Cancel,
+ Portal,
+ Footer,
+ Header,
+ Trigger,
+ Overlay,
+ Content,
+ Description,
+ //
+ Root as AlertDialog,
+ Title as AlertDialogTitle,
+ Action as AlertDialogAction,
+ Cancel as AlertDialogCancel,
+ Portal as AlertDialogPortal,
+ Footer as AlertDialogFooter,
+ Header as AlertDialogHeader,
+ Trigger as AlertDialogTrigger,
+ Overlay as AlertDialogOverlay,
+ Content as AlertDialogContent,
+ Description as AlertDialogDescription,
+};
diff --git a/frontend/src/lib/services/settings-service.ts b/frontend/src/lib/services/settings-service.ts
index 633f7d510..963e0a53c 100644
--- a/frontend/src/lib/services/settings-service.ts
+++ b/frontend/src/lib/services/settings-service.ts
@@ -1,26 +1,34 @@
import BaseAPIService from './api-service';
import type { Settings, OidcStatusInfo } from '$lib/types/settings.type';
+import { environmentStore } from '$lib/stores/environment.store';
type KeyValuePair = { key: string; value: string };
export default class SettingsService extends BaseAPIService {
async getSettings(): Promise<Settings> {
- const res = await this.api.get('/settings');
+ const envId = await environmentStore.getCurrentEnvironmentId();
+ const res = await this.api.get(`/environments/${envId}/settings`);
+ return this.normalize(res.data);
+ }
+
+ async getSettingsForEnvironment(environmentId: string): Promise<Settings> {
+ const res = await this.api.get(`/environments/${environmentId}/settings`);
return this.normalize(res.data);
}
async getPublicSettings(): Promise<Settings> {
- const res = await this.api.get('/settings/public');
+ const res = await this.api.get(`/environments/0/settings/public`);
return this.normalize(res.data);
}
async updateSettings(settings: Settings) {
+ const envId = await environmentStore.getCurrentEnvironmentId();
const payload: Record<string, string> = {};
for (const key in settings) {
const v = (settings as any)[key];
payload[key] = typeof v === 'object' && v !== null ? JSON.stringify(v) : String(v);
}
- const res = await this.api.put('/settings', payload);
+ const res = await this.api.put(`/environments/${envId}/settings`, payload);
return this.normalize(res.data);
}
diff --git a/frontend/src/routes/+layout.ts b/frontend/src/routes/+layout.ts
index d27c46328..74fbc676f 100644
--- a/frontend/src/routes/+layout.ts
+++ b/frontend/src/routes/+layout.ts
@@ -12,6 +12,10 @@ import { environmentManagementService } from '$lib/services/env-mgmt-service';
export const ssr = false;
export const load = async () => {
+ if (!environmentStore.isInitialized()) {
+ await environmentStore.initialize([], true);
+ }
+
const userPromise = userService.getCurrentUser().catch(() => null);
const settingsPromise = settingsService.getSettings().catch((e) => {
console.error('Error fetching settings:', e);
@@ -26,7 +30,7 @@ export const load = async () => {
};
const environmentsPromise = userPromise.then(async (user) => {
- if (!environmentStore.isInitialized() && user) {
+ if (user) {
const environments = await tryCatch(environmentManagementService.getEnvironments(environmentRequestOptions));
if (!environments.error) {
await environmentStore.initialize(environments.data.data, true);
diff --git a/frontend/src/routes/environments/[id]/+page.svelte b/frontend/src/routes/environments/[id]/+page.svelte
index 3322f86c7..8fd8e59ca 100644
--- a/frontend/src/routes/environments/[id]/+page.svelte
+++ b/frontend/src/routes/environments/[id]/+page.svelte
@@ -1,6 +1,7 @@
<script lang="ts">
import * as Card from '$lib/components/ui/card/index.js';
import { Button } from '$lib/components/ui/button/index.js';
+ import * as AlertDialog from '$lib/components/ui/alert-dialog';
import ArrowLeftIcon from '@lucide/svelte/icons/arrow-left';
import RefreshCwIcon from '@lucide/svelte/icons/refresh-cw';
import MonitorIcon from '@lucide/svelte/icons/monitor';
@@ -13,9 +14,21 @@
import Label from '$lib/components/ui/label/label.svelte';
import { m } from '$lib/paraglide/messages';
import { environmentManagementService } from '$lib/services/env-mgmt-service.js';
+ import { environmentStore } from '$lib/stores/environment.store';
+ import type { Environment } from '$lib/types/environment.type';
let { data } = $props();
- let { environment } = $derived(data);
+ let { environment, settings } = $derived(data);
+
+ let showSwitchDialog = $state(false);
+ let currentEnvironment = $state<Environment | null>(null);
+
+ $effect(() => {
+ const unsubscribe = environmentStore.selected.subscribe((env) => {
+ currentEnvironment = env;
+ });
+ return unsubscribe;
+ });
let isRefreshing = $state(false);
let isTestingConnection = $state(false);
@@ -82,6 +95,29 @@
}
const environmentDisplayName = $derived(() => environment?.name ?? m.common_unknown());
+
+ const needsEnvironmentSwitch = $derived(() => {
+ return currentEnvironment?.id !== environment?.id;
+ });
+
+ async function handleEditSettings() {
+ if (needsEnvironmentSwitch()) {
+ showSwitchDialog = true;
+ } else {
+ goto('/settings');
+ }
+ }
+
+ async function confirmSwitchAndEdit() {
+ try {
+ await environmentStore.setEnvironment(environment);
+ showSwitchDialog = false;
+ goto('/settings');
+ } catch (error) {
+ console.error('Failed to switch environment:', error);
+ toast.error('Failed to switch environment');
+ }
+ }
</script>
<div class="space-y-6 pb-16">
@@ -185,6 +221,170 @@
</div>
</div>
</div>
+
+ {#if settings}
+ <div class="border-t pt-6">
+ <div class="mb-4 flex items-center justify-between">
+ <h3 class="text-lg font-semibold">{m.sidebar_settings()}</h3>
+ <Button variant="outline" size="sm" onclick={handleEditSettings}>
+ <SettingsIcon class="mr-2 size-4" />
+ {m.common_edit()}
+ </Button>
+ </div>
+
+ <!-- Docker Settings -->
+ <div class="mb-6">
+ <h4 class="text-muted-foreground mb-3 text-sm font-semibold uppercase tracking-wide">{m.docker_title()}</h4>
+ <div class="grid grid-cols-1 gap-4 md:grid-cols-2">
+ <div>
+ <Label class="text-muted-foreground text-sm font-medium">{m.docker_enable_polling_label()}</Label>
+ <div class="mt-1">
+ <StatusBadge
+ text={settings.pollingEnabled ? m.common_enabled() : m.common_disabled()}
+ variant={settings.pollingEnabled ? 'green' : 'gray'}
+ />
+ </div>
+ </div>
+ {#if settings.pollingEnabled}
+ <div>
+ <Label class="text-muted-foreground text-sm font-medium">{m.docker_polling_interval_label()}</Label>
+ <div class="mt-1 text-sm">{settings.pollingInterval} min</div>
+ </div>
+ {/if}
+ <div>
+ <Label class="text-muted-foreground text-sm font-medium">{m.docker_auto_update_label()}</Label>
+ <div class="mt-1">
+ <StatusBadge
+ text={settings.autoUpdate ? m.common_enabled() : m.common_disabled()}
+ variant={settings.autoUpdate ? 'green' : 'gray'}
+ />
+ </div>
+ </div>
+ {#if settings.autoUpdate}
+ <div>
+ <Label class="text-muted-foreground text-sm font-medium">{m.docker_auto_update_interval_label()}</Label>
+ <div class="mt-1 text-sm">{settings.autoUpdateInterval} min</div>
+ </div>
+ {/if}
+ <div>
+ <Label class="text-muted-foreground text-sm font-medium">{m.docker_prune_action_label()}</Label>
+ <div class="mt-1 text-sm capitalize">{settings.dockerPruneMode || 'dangling'}</div>
+ </div>
+ <div>
+ <Label class="text-muted-foreground text-sm font-medium">{m.docker_default_shell_label()}</Label>
+ <div class="bg-muted mt-1 rounded px-2 py-1 font-mono text-sm">{settings.defaultShell || '/bin/sh'}</div>
+ </div>
+ </div>
+ </div>
+
+ <!-- General Settings -->
+ <div class="mb-6">
+ <h4 class="text-muted-foreground mb-3 text-sm font-semibold uppercase tracking-wide">{m.general_title()}</h4>
+ <div class="grid grid-cols-1 gap-4 md:grid-cols-2">
+ <div>
+ <Label class="text-muted-foreground text-sm font-medium">{m.general_projects_directory_label()}</Label>
+ <div class="bg-muted mt-1 rounded px-2 py-1 font-mono text-sm">
+ {settings.projectsDirectory || 'data/projects'}
+ </div>
+ </div>
+ <div>
+ <Label class="text-muted-foreground text-sm font-medium">{m.general_base_url_label()}</Label>
+ <div class="bg-muted mt-1 rounded px-2 py-1 font-mono text-sm">
+ {settings.baseServerUrl || 'http://localhost'}
+ </div>
+ </div>
+ <div>
+ <Label class="text-muted-foreground text-sm font-medium">{m.general_enable_gravatar_label()}</Label>
+ <div class="mt-1">
+ <StatusBadge
+ text={settings.enableGravatar ? m.common_enabled() : m.common_disabled()}
+ variant={settings.enableGravatar ? 'green' : 'gray'}
+ />
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <!-- Security Settings -->
+ {#if settings.authLocalEnabled !== undefined}
+ <div class="mb-6">
+ <h4 class="text-muted-foreground mb-3 text-sm font-semibold uppercase tracking-wide">
+ {m.security_title()}
+ </h4>
+ <div class="grid grid-cols-1 gap-4 md:grid-cols-2">
+ <div>
+ <Label class="text-muted-foreground text-sm font-medium">{m.security_local_auth_label()}</Label>
+ <div class="mt-1">
+ <StatusBadge
+ text={settings.authLocalEnabled ? m.common_enabled() : m.common_disabled()}
+ variant={settings.authLocalEnabled ? 'green' : 'gray'}
+ />
+ </div>
+ </div>
+ <div>
+ <Label class="text-muted-foreground text-sm font-medium">{m.security_oidc_auth_label()}</Label>
+ <div class="mt-1">
+ <StatusBadge
+ text={settings.authOidcEnabled ? m.common_enabled() : m.common_disabled()}
+ variant={settings.authOidcEnabled ? 'green' : 'gray'}
+ />
+ </div>
+ </div>
+ <div>
+ <Label class="text-muted-foreground text-sm font-medium">{m.security_session_timeout_label()}</Label>
+ <div class="mt-1 text-sm">{settings.authSessionTimeout || 1440} min</div>
+ </div>
+ <div>
+ <Label class="text-muted-foreground text-sm font-medium">{m.security_password_policy_label()}</Label>
+ <div class="mt-1 text-sm capitalize">{settings.authPasswordPolicy || 'strong'}</div>
+ </div>
+ </div>
+ </div>
+ {/if}
+
+ <!-- Navigation Settings -->
+ {#if settings.mobileNavigationMode !== undefined}
+ <div>
+ <h4 class="text-muted-foreground mb-3 text-sm font-semibold uppercase tracking-wide">
+ {m.navigation_title()}
+ </h4>
+ <div class="grid grid-cols-1 gap-4 md:grid-cols-2">
+ <div>
+ <Label class="text-muted-foreground text-sm font-medium">{m.navigation_mode_label()}</Label>
+ <div class="mt-1 text-sm capitalize">{settings.mobileNavigationMode || 'floating'}</div>
+ </div>
+ <div>
+ <Label class="text-muted-foreground text-sm font-medium">{m.navigation_show_labels_label()}</Label>
+ <div class="mt-1">
+ <StatusBadge
+ text={settings.mobileNavigationShowLabels ? m.common_enabled() : m.common_disabled()}
+ variant={settings.mobileNavigationShowLabels ? 'green' : 'gray'}
+ />
+ </div>
+ </div>
+ <div>
+ <Label class="text-muted-foreground text-sm font-medium">{m.navigation_scroll_to_hide_label()}</Label>
+ <div class="mt-1">
+ <StatusBadge
+ text={settings.mobileNavigationScrollToHide ? m.common_enabled() : m.common_disabled()}
+ variant={settings.mobileNavigationScrollToHide ? 'green' : 'gray'}
+ />
+ </div>
+ </div>
+ <div>
+ <Label class="text-muted-foreground text-sm font-medium">{m.navigation_tap_to_hide_label()}</Label>
+ <div class="mt-1">
+ <StatusBadge
+ text={settings.mobileNavigationTapToHide ? m.common_enabled() : m.common_disabled()}
+ variant={settings.mobileNavigationTapToHide ? 'green' : 'gray'}
+ />
+ </div>
+ </div>
+ </div>
+ </div>
+ {/if}
+ </div>
+ {/if}
</Card.Content>
</Card.Root>
</div>
@@ -266,4 +466,21 @@
<span class="text-sm">{m.environments_refreshing()}</span>
</div>
{/if}
+
+ <AlertDialog.Root bind:open={showSwitchDialog}>
+ <AlertDialog.Content>
+ <AlertDialog.Header>
+ <AlertDialog.Title>{m.environments_switch_to_edit_title()}</AlertDialog.Title>
+ <AlertDialog.Description>
+ {m.environments_switch_to_edit_message()}
+ </AlertDialog.Description>
+ </AlertDialog.Header>
+ <AlertDialog.Footer>
+ <AlertDialog.Cancel>{m.common_cancel()}</AlertDialog.Cancel>
+ <AlertDialog.Action onclick={confirmSwitchAndEdit}>
+ {m.environments_switch_and_edit()}
+ </AlertDialog.Action>
+ </AlertDialog.Footer>
+ </AlertDialog.Content>
+ </AlertDialog.Root>
</div>
diff --git a/frontend/src/routes/environments/[id]/+page.ts b/frontend/src/routes/environments/[id]/+page.ts
index 2585e07e9..fe3a87df4 100644
--- a/frontend/src/routes/environments/[id]/+page.ts
+++ b/frontend/src/routes/environments/[id]/+page.ts
@@ -1,10 +1,20 @@
import { environmentManagementService } from '$lib/services/env-mgmt-service';
+import { settingsService } from '$lib/services/settings-service';
+import { environmentStore } from '$lib/stores/environment.store';
import type { PageLoad } from './$types';
export const load: PageLoad = async ({ params }) => {
- const environment = await environmentManagementService.get(params.id);
+ try {
+ const environment = await environmentManagementService.get(params.id);
- return {
- environment
- };
+ const settings = await settingsService.getSettingsForEnvironment(params.id);
+
+ return {
+ environment,
+ settings
+ };
+ } catch (error) {
+ console.error('Failed to load environment:', error);
+ throw error;
+ }
};