Skip to content

Modern Docker Management, Designed for Everyone

refactor: cleanup duplicate frontend code (#3138)

Kyle Mendell0c2b9f70e661
diff --git a/frontend/src/app.css b/frontend/src/app.css
index 388c9863a..e7c7213d4 100644
--- a/frontend/src/app.css
+++ b/frontend/src/app.css
@@ -83,11 +83,7 @@
--border: oklch(1 0 0 / 10%);
--input: oklch(1 0 0 / 15%);
--ring: oklch(0.541 0.281 293.009);
- --chart-1: oklch(0.811 0.111 293.571);
- --chart-2: oklch(0.606 0.25 292.717);
- --chart-3: oklch(0.541 0.281 293.009);
- --chart-4: oklch(0.491 0.27 292.581);
- --chart-5: oklch(0.432 0.232 292.759);
+ /* --chart-1..5 inherit from :root (identical in both themes) */
--sidebar: oklch(0.205 0 0);
--sidebar-foreground: oklch(0.985 0 0);
--sidebar-primary: oklch(0.541 0.281 293.009);
diff --git a/frontend/src/lib/components/ComposeTemplateEditor.svelte b/frontend/src/lib/components/ComposeTemplateEditor.svelte
new file mode 100644
index 000000000..8d090220b
--- /dev/null
+++ b/frontend/src/lib/components/ComposeTemplateEditor.svelte
@@ -0,0 +1,130 @@
+<script lang="ts">
+ import * as Card from '$lib/components/ui/card';
+ import CodeEditor from '$lib/components/code-editor/editor.svelte';
+ import { ComposeEditorSplit } from '$lib/components/compose';
+ import { CodeIcon, VariableIcon } from '$lib/icons';
+ import { m } from '$lib/paraglide/messages';
+
+ interface ValidationState {
+ composeHasErrors: boolean;
+ envHasErrors: boolean;
+ composeValidationReady: boolean;
+ envValidationReady: boolean;
+ }
+
+ interface Props {
+ composeValue: string;
+ envValue: string;
+ originalCompose: string;
+ originalEnv: string;
+ validation: ValidationState;
+ globalVariableMap: Record<string, string>;
+ fileIdPrefix: string;
+ readOnly?: boolean;
+ composeError?: string | null;
+ envError?: string | null;
+ composeLabel?: string;
+ composeDescription?: string;
+ envLabel?: string;
+ envDescription?: string;
+ }
+
+ let {
+ composeValue = $bindable(),
+ envValue = $bindable(),
+ originalCompose,
+ originalEnv,
+ validation = $bindable(),
+ globalVariableMap,
+ fileIdPrefix,
+ readOnly = false,
+ composeError,
+ envError,
+ composeLabel = m.templates_compose_template_label(),
+ composeDescription = m.templates_service_definitions(),
+ envLabel = m.templates_env_template_label(),
+ envDescription = m.templates_default_config_values()
+ }: Props = $props();
+</script>
+
+<ComposeEditorSplit
+ class="flex min-h-0 flex-1 flex-col gap-6 lg:grid lg:grid-cols-5 lg:grid-rows-1 lg:items-stretch"
+ composeClass="contents"
+ envClass="contents"
+>
+ {#snippet compose()}
+ <Card.Root class="flex min-h-0 min-w-0 flex-1 flex-col lg:col-span-3">
+ <Card.Header icon={CodeIcon} class="shrink-0">
+ <div class="flex flex-col space-y-1.5">
+ <Card.Title>
+ <h2>{composeLabel}</h2>
+ </Card.Title>
+ <Card.Description>{composeDescription}</Card.Description>
+ </div>
+ </Card.Header>
+ <Card.Content class="flex min-h-0 min-w-0 flex-1 flex-col p-0">
+ <div class="min-h-0 min-w-0 flex-1 rounded-b-xl">
+ <CodeEditor
+ bind:value={composeValue}
+ language="yaml"
+ {readOnly}
+ fontSize="13px"
+ bind:hasErrors={validation.composeHasErrors}
+ bind:validationReady={validation.composeValidationReady}
+ fileId="{fileIdPrefix}:compose"
+ originalValue={originalCompose}
+ enableDiff={true}
+ editorContext={{
+ envContent: envValue,
+ composeContents: [composeValue],
+ globalVariables: globalVariableMap
+ }}
+ />
+ </div>
+ </Card.Content>
+ {#if composeError}
+ <Card.Footer class="pt-0">
+ <p class="text-destructive text-xs font-medium">{composeError}</p>
+ </Card.Footer>
+ {/if}
+ </Card.Root>
+ {/snippet}
+
+ {#snippet env()}
+ <Card.Root class="flex min-h-0 min-w-0 flex-1 flex-col lg:col-span-2">
+ <Card.Header icon={VariableIcon} class="shrink-0">
+ <div class="flex flex-col space-y-1.5">
+ <Card.Title>
+ <h2>{envLabel}</h2>
+ </Card.Title>
+ <Card.Description>{envDescription}</Card.Description>
+ </div>
+ </Card.Header>
+ <Card.Content class="flex min-h-0 min-w-0 flex-1 flex-col p-0">
+ <div class="min-h-0 min-w-0 flex-1 rounded-b-xl">
+ <CodeEditor
+ bind:value={envValue}
+ language="env"
+ {readOnly}
+ fontSize="13px"
+ bind:hasErrors={validation.envHasErrors}
+ bind:validationReady={validation.envValidationReady}
+ fileId="{fileIdPrefix}:env"
+ originalValue={originalEnv}
+ enableDiff={true}
+ editorContext={{
+ envContent: envValue,
+ composeContents: [composeValue],
+ globalVariables: globalVariableMap
+ }}
+ />
+ </div>
+ </Card.Content>
+ {#if envError}
+ <Card.Footer class="pt-0">
+ <p class="text-destructive text-xs font-medium">{envError}</p>
+ </Card.Footer>
+ {/if}
+ </Card.Root>
+ {/snippet}
+</ComposeEditorSplit>
diff --git a/frontend/src/lib/components/action-button-group/action-button-group.svelte b/frontend/src/lib/components/action-button-group/action-button-group.svelte
index 1faae5405..5f0c6fa81 100644
--- a/frontend/src/lib/components/action-button-group/action-button-group.svelte
+++ b/frontend/src/lib/components/action-button-group/action-button-group.svelte
@@ -115,6 +115,65 @@
}
</script>
+{#snippet menuItemsList(items: ActionButtonMenuItem[])}
+ {#each items as item (item.id)}
+ <DropdownMenu.Item onclick={() => handleMenuItemAction(item)} disabled={item.disabled}>
+ {item.label}
+ </DropdownMenu.Item>
+ {/each}
+{/snippet}
+
+{#snippet ellipsisTrigger(srLabel: string)}
+ <DropdownMenu.Trigger>
+ {#snippet child({ props })}
+ <ArcaneButton
+ {...props}
+ action="base"
+ tone="outline"
+ size="icon"
+ class={cn('shrink-0', size === 'sm' ? 'size-8' : 'size-9')}
+ >
+ <span class="sr-only">{srLabel}</span>
+ <EllipsisIcon class="size-4" />
+ </ArcaneButton>
+ {/snippet}
+ </DropdownMenu.Trigger>
+{/snippet}
+
+{#snippet menuButtonLabel(button: ActionButton)}
+ <div class="flex w-full items-center justify-between gap-2">
+ <span>{button.loading ? button.loadingLabel || button.label : button.label}</span>
+ {#if button.badge !== undefined}
+ <span class="text-muted-foreground text-[10px]">({button.badge})</span>
+ {/if}
+ </div>
+{/snippet}
+
+{#snippet menuButtons(list: ActionButton[])}
+ <DropdownMenu.Group>
+ {#each list as button (button.id)}
+ {#if button.menuItems && button.menuItems.length > 0}
+ <DropdownMenu.Sub>
+ <DropdownMenu.SubTrigger disabled={button.disabled || button.loading}>
+ {@render menuButtonLabel(button)}
+ </DropdownMenu.SubTrigger>
+ <DropdownMenu.SubContent class="min-w-[180px]">
+ <DropdownMenu.Item onclick={() => handleOverflowAction(button)} disabled={button.disabled || button.loading}>
+ {button.label}
+ </DropdownMenu.Item>
+ <DropdownMenu.Separator />
+ {@render menuItemsList(button.menuItems)}
+ </DropdownMenu.SubContent>
+ </DropdownMenu.Sub>
+ {:else}
+ <DropdownMenu.Item onclick={() => handleOverflowAction(button)} disabled={button.disabled || button.loading}>
+ {@render menuButtonLabel(button)}
+ </DropdownMenu.Item>
+ {/if}
+ {/each}
+ </DropdownMenu.Group>
+{/snippet}
+
{#snippet buttonContent(button: ActionButton)}
{#if button.badge !== undefined}
<span class="text-muted-foreground rounded-full border px-1 py-0.5 text-[10px]">
@@ -157,11 +216,7 @@
</DropdownMenu.Trigger>
<DropdownMenu.Content align="end" class="min-w-[180px]">
- {#each button.menuItems ?? [] as item (item.id)}
- <DropdownMenu.Item onclick={() => handleMenuItemAction(item)} disabled={item.disabled}>
- {item.label}
- </DropdownMenu.Item>
- {/each}
+ {@render menuItemsList(button.menuItems ?? [])}
</DropdownMenu.Content>
</DropdownMenu.Root>
{/if}
@@ -222,61 +277,10 @@
{#if overflowButtons.length > 0}
<DropdownMenu.Root>
- <DropdownMenu.Trigger>
- {#snippet child({ props })}
- <ArcaneButton
- {...props}
- action="base"
- tone="outline"
- size="icon"
- class={cn('shrink-0', size === 'sm' ? 'size-8' : 'size-9')}
- >
- <span class="sr-only">{m.common_more_actions()}</span>
- <EllipsisIcon class="size-4" />
- </ArcaneButton>
- {/snippet}
- </DropdownMenu.Trigger>
+ {@render ellipsisTrigger(m.common_more_actions())}
<DropdownMenu.Content align="end" class="min-w-[160px]">
- <DropdownMenu.Group>
- {#each overflowButtons as button (button.id)}
- {#if button.menuItems && button.menuItems.length > 0}
- <DropdownMenu.Sub>
- <DropdownMenu.SubTrigger disabled={button.disabled || button.loading}>
- <div class="flex w-full items-center justify-between gap-2">
- <span>{button.loading ? button.loadingLabel || button.label : button.label}</span>
- {#if button.badge !== undefined}
- <span class="text-muted-foreground text-[10px]">({button.badge})</span>
- {/if}
- </div>
- </DropdownMenu.SubTrigger>
- <DropdownMenu.SubContent class="min-w-[180px]">
- <DropdownMenu.Item
- onclick={() => handleOverflowAction(button)}
- disabled={button.disabled || button.loading}
- >
- {button.label}
- </DropdownMenu.Item>
- <DropdownMenu.Separator />
- {#each button.menuItems as item (item.id)}
- <DropdownMenu.Item onclick={() => handleMenuItemAction(item)} disabled={item.disabled}>
- {item.label}
- </DropdownMenu.Item>
- {/each}
- </DropdownMenu.SubContent>
- </DropdownMenu.Sub>
- {:else}
- <DropdownMenu.Item onclick={() => handleOverflowAction(button)} disabled={button.disabled || button.loading}>
- <div class="flex w-full items-center justify-between gap-2">
- <span>{button.loading ? button.loadingLabel || button.label : button.label}</span>
- {#if button.badge !== undefined}
- <span class="text-muted-foreground text-[10px]">({button.badge})</span>
- {/if}
- </div>
- </DropdownMenu.Item>
- {/if}
- {/each}
- </DropdownMenu.Group>
+ {@render menuButtons(overflowButtons)}
</DropdownMenu.Content>
</DropdownMenu.Root>
{/if}
@@ -284,58 +288,10 @@
<div class={cn('flex items-center gap-2 lg:hidden', menuClass)}>
<DropdownMenu.Root>
- <DropdownMenu.Trigger>
- {#snippet child({ props })}
- <ArcaneButton
- {...props}
- action="base"
- tone="outline"
- size="icon"
- class={cn('shrink-0', size === 'sm' ? 'size-8' : 'size-9')}
- >
- <span class="sr-only">More actions</span>
- <EllipsisIcon class="size-4" />
- </ArcaneButton>
- {/snippet}
- </DropdownMenu.Trigger>
+ {@render ellipsisTrigger('More actions')}
<DropdownMenu.Content align="end" class="min-w-[160px]">
- <DropdownMenu.Group>
- {#each buttons as button (button.id)}
- {#if button.menuItems && button.menuItems.length > 0}
- <DropdownMenu.Sub>
- <DropdownMenu.SubTrigger disabled={button.disabled || button.loading}>
- <div class="flex w-full items-center justify-between gap-2">
- <span>{button.loading ? button.loadingLabel || button.label : button.label}</span>
- {#if button.badge !== undefined}
- <span class="text-muted-foreground text-[10px]">({button.badge})</span>
- {/if}
- </div>
- </DropdownMenu.SubTrigger>
- <DropdownMenu.SubContent class="min-w-[180px]">
- <DropdownMenu.Item onclick={() => handleOverflowAction(button)} disabled={button.disabled || button.loading}>
- {button.label}
- </DropdownMenu.Item>
- <DropdownMenu.Separator />
- {#each button.menuItems as item (item.id)}
- <DropdownMenu.Item onclick={() => handleMenuItemAction(item)} disabled={item.disabled}>
- {item.label}
- </DropdownMenu.Item>
- {/each}
- </DropdownMenu.SubContent>
- </DropdownMenu.Sub>
- {:else}
- <DropdownMenu.Item onclick={() => handleOverflowAction(button)} disabled={button.disabled || button.loading}>
- <div class="flex w-full items-center justify-between gap-2">
- <span>{button.loading ? button.loadingLabel || button.label : button.label}</span>
- {#if button.badge !== undefined}
- <span class="text-muted-foreground text-[10px]">({button.badge})</span>
- {/if}
- </div>
- </DropdownMenu.Item>
- {/if}
- {/each}
- </DropdownMenu.Group>
+ {@render menuButtons(buttons)}
</DropdownMenu.Content>
</DropdownMenu.Root>
</div>
diff --git a/frontend/src/lib/components/action-buttons.svelte b/frontend/src/lib/components/action-buttons.svelte
index e8000b789..aa39f85cb 100644
--- a/frontend/src/lib/components/action-buttons.svelte
+++ b/frontend/src/lib/components/action-buttons.svelte
@@ -430,363 +430,190 @@
{/if}
{/snippet}
-{#if desktopVariant === 'adaptive'}
- <div>
- <!-- On xl+ show labels; below xl use icon-only to avoid overflow in constrained headers (sidebar layouts) -->
- {#if isLgUp}
- <div class="flex items-center gap-2">
+{#snippet DesktopActions(size: 'default' | 'icon', showLabel: boolean)}
+ {#if !isRunning && canStart}
+ {#if type === 'container'}
+ <ArcaneButton action="start" {size} {showLabel} onclick={() => handleStart()} loading={uiLoading.start} />
+ {:else}
+ <DeploySplitButton
+ {size}
+ {showLabel}
+ customLabel={deployButtonLabel}
+ onDeploy={() => handleDeploy()}
+ loading={uiLoading.start}
+ />
+ {/if}
+ {/if}
+
+ {#if isRunning}
+ {#if canStop}
+ <ArcaneButton
+ action="stop"
+ {size}
+ {showLabel}
+ customLabel={type === 'project' ? m.common_down() : undefined}
+ onclick={() => handleStop()}
+ loading={uiLoading.stop}
+ />
+ {/if}
+ {#if canRestart}
+ <ArcaneButton action="restart" {size} {showLabel} onclick={() => handleRestart()} loading={uiLoading.restart} />
+ {/if}
+ {/if}
+
+ {#if type === 'container'}
+ {@render RedeployActionButton(size, showLabel)}
+ {@render beforeRemoveActions?.(size, showLabel, isLifecycleActionPending)}
+ {#if canRemove}
+ <ArcaneButton action="remove" {size} {showLabel} onclick={() => confirmAction('remove')} loading={uiLoading.remove} />
+ {/if}
+ {:else}
+ {@render RedeployActionButton(size, showLabel)}
+
+ {#if type === 'project'}
+ {#if projectHasBuildDirective && canBuild}
+ <ArcaneButton action="build" {size} {showLabel} onclick={() => handleProjectBuild()} loading={uiLoading.build} />
+ {/if}
+
+ {#if canPull}
+ <ArcaneButton action="pull" {size} {showLabel} onclick={() => handleProjectPull()} loading={uiLoading.pull} />
+ {/if}
+ {/if}
+
+ {#if onRefresh}
+ <ArcaneButton action="refresh" {size} {showLabel} onclick={() => handleRefresh()} loading={uiLoading.refresh} />
+ {/if}
+
+ {#if canRemove}
+ <ArcaneButton
+ customLabel={type === 'project' ? m.compose_destroy() : m.common_remove()}
+ action="remove"
+ {size}
+ {showLabel}
+ onclick={() => confirmAction('remove')}
+ loading={uiLoading.remove}
+ />
+ {/if}
+ {/if}
+{/snippet}
+
+{#snippet ActionsMenu()}
+ <DropdownMenu.Root>
+ <DropdownMenu.Trigger class="bg-background/70 inline-flex size-9 items-center justify-center rounded-lg border">
+ <span class="sr-only">{m.common_open_menu()}</span>
+ <EllipsisIcon />
+ </DropdownMenu.Trigger>
+
+ <DropdownMenu.Content
+ align="end"
+ class="bg-popover/20 z-[var(--arcane-z-surface)] min-w-[180px] rounded-xl border p-1 shadow-lg backdrop-blur-md"
+ >
+ <DropdownMenu.Group>
{#if !isRunning && canStart}
{#if type === 'container'}
- <ArcaneButton
- action="start"
- size={adaptiveIconOnly ? 'icon' : 'default'}
- showLabel={!adaptiveIconOnly}
- onclick={() => handleStart()}
- loading={uiLoading.start}
- />
+ <DropdownMenu.Item onclick={handleStart} disabled={uiLoading.start}>
+ {m.common_start()}
+ </DropdownMenu.Item>
{:else}
- <DeploySplitButton
- size={adaptiveIconOnly ? 'icon' : 'default'}
- showLabel={!adaptiveIconOnly}
- customLabel={deployButtonLabel}
- onDeploy={() => handleDeploy()}
- loading={uiLoading.start}
- />
+ <DropdownMenu.Item onclick={() => handleDeploy()} disabled={uiLoading.start}>
+ {deployButtonLabel}
+ </DropdownMenu.Item>
+ {#if type === 'project'}
+ <DropdownMenu.Separator />
+ <DropdownMenu.Label>{m.settings_default_deploy_pull_policy()}</DropdownMenu.Label>
+ <DropdownMenu.RadioGroup value={deployOptionsStore.pullPolicy} onValueChange={handleDeployPullPolicyChange}>
+ <DropdownMenu.RadioItem value="missing">Missing</DropdownMenu.RadioItem>
+ <DropdownMenu.RadioItem value="always">
+ {m.common_always()}
+ </DropdownMenu.RadioItem>
+ <DropdownMenu.RadioItem value="never">
+ {m.common_never()}
+ </DropdownMenu.RadioItem>
+ </DropdownMenu.RadioGroup>
+ <DropdownMenu.Separator />
+ <DropdownMenu.CheckboxItem
+ checked={deployOptionsStore.forceRecreate}
+ onCheckedChange={(checked) => deployOptionsStore.setForceRecreate(checked === true)}
+ >
+ {m.deploy_force_recreate()}
+ </DropdownMenu.CheckboxItem>
+ {/if}
{/if}
- {/if}
-
- {#if isRunning}
+ {:else if isRunning}
{#if canStop}
- <ArcaneButton
- action="stop"
- size={adaptiveIconOnly ? 'icon' : 'default'}
- showLabel={!adaptiveIconOnly}
- customLabel={type === 'project' ? m.common_down() : undefined}
- onclick={() => handleStop()}
- loading={uiLoading.stop}
- />
+ <DropdownMenu.Item onclick={handleStop} disabled={uiLoading.stop}>
+ {type === 'project' ? m.common_down() : m.common_stop()}
+ </DropdownMenu.Item>
{/if}
{#if canRestart}
- <ArcaneButton
- action="restart"
- size={adaptiveIconOnly ? 'icon' : 'default'}
- showLabel={!adaptiveIconOnly}
- onclick={() => handleRestart()}
- loading={uiLoading.restart}
- />
+ <DropdownMenu.Item onclick={handleRestart} disabled={uiLoading.restart}>
+ {m.common_restart()}
+ </DropdownMenu.Item>
{/if}
{/if}
{#if type === 'container'}
- {@render RedeployActionButton(adaptiveIconOnly ? 'icon' : 'default', !adaptiveIconOnly)}
- {@render beforeRemoveActions?.(adaptiveIconOnly ? 'icon' : 'default', !adaptiveIconOnly, isLifecycleActionPending)}
+ {@render RedeployMenuItem()}
+ {@render beforeRemoveMenuItems?.(isLifecycleActionPending)}
{#if canRemove}
- <ArcaneButton
- action="remove"
- size={adaptiveIconOnly ? 'icon' : 'default'}
- showLabel={!adaptiveIconOnly}
- onclick={() => confirmAction('remove')}
- loading={uiLoading.remove}
- />
+ <DropdownMenu.Item onclick={() => confirmAction('remove')} disabled={uiLoading.remove}>
+ {m.common_remove()}
+ </DropdownMenu.Item>
{/if}
{:else}
- {@render RedeployActionButton(adaptiveIconOnly ? 'icon' : 'default', !adaptiveIconOnly)}
+ {@render RedeployMenuItem()}
{#if type === 'project'}
{#if projectHasBuildDirective && canBuild}
- <ArcaneButton
- action="build"
- size={adaptiveIconOnly ? 'icon' : 'default'}
- showLabel={!adaptiveIconOnly}
- onclick={() => handleProjectBuild()}
- loading={uiLoading.build}
- />
+ <DropdownMenu.Item onclick={handleProjectBuild} disabled={uiLoading.build}>
+ {m.build()}
+ </DropdownMenu.Item>
{/if}
-
{#if canPull}
- <ArcaneButton
- action="pull"
- size={adaptiveIconOnly ? 'icon' : 'default'}
- showLabel={!adaptiveIconOnly}
- onclick={() => handleProjectPull()}
- loading={uiLoading.pull}
- />
+ <DropdownMenu.Item onclick={handleProjectPull} disabled={uiLoading.pull}>
+ {m.images_pull()}
+ </DropdownMenu.Item>
{/if}
{/if}
{#if onRefresh}
- <ArcaneButton
- action="refresh"
- size={adaptiveIconOnly ? 'icon' : 'default'}
- showLabel={!adaptiveIconOnly}
- onclick={() => handleRefresh()}
- loading={uiLoading.refresh}
- />
+ <DropdownMenu.Item onclick={handleRefresh} disabled={uiLoading.refresh}>
+ {m.common_refresh()}
+ </DropdownMenu.Item>
{/if}
{#if canRemove}
- <ArcaneButton
- customLabel={type === 'project' ? m.compose_destroy() : m.common_remove()}
- action="remove"
- size={adaptiveIconOnly ? 'icon' : 'default'}
- showLabel={!adaptiveIconOnly}
- onclick={() => confirmAction('remove')}
- loading={uiLoading.remove}
- />
+ <DropdownMenu.Item onclick={() => confirmAction('remove')} disabled={uiLoading.remove}>
+ {type === 'project' ? m.compose_destroy() : m.common_remove()}
+ </DropdownMenu.Item>
{/if}
{/if}
+ </DropdownMenu.Group>
+ </DropdownMenu.Content>
+ </DropdownMenu.Root>
+{/snippet}
+
+{#if desktopVariant === 'adaptive'}
+ <div>
+ <!-- On xl+ show labels; below xl use icon-only to avoid overflow in constrained headers (sidebar layouts) -->
+ {#if isLgUp}
+ <div class="flex items-center gap-2">
+ {@render DesktopActions(adaptiveIconOnly ? 'icon' : 'default', !adaptiveIconOnly)}
</div>
{:else}
<div class="flex items-center">
- <DropdownMenu.Root>
- <DropdownMenu.Trigger class="bg-background/70 inline-flex size-9 items-center justify-center rounded-lg border">
- <span class="sr-only">{m.common_open_menu()}</span>
- <EllipsisIcon />
- </DropdownMenu.Trigger>
-
- <DropdownMenu.Content
- align="end"
- class="bg-popover/20 z-[var(--arcane-z-surface)] min-w-[180px] rounded-xl border p-1 shadow-lg backdrop-blur-md"
- >
- <DropdownMenu.Group>
- {#if !isRunning && canStart}
- {#if type === 'container'}
- <DropdownMenu.Item onclick={handleStart} disabled={uiLoading.start}>
- {m.common_start()}
- </DropdownMenu.Item>
- {:else}
- <DropdownMenu.Item onclick={() => handleDeploy()} disabled={uiLoading.start}>
- {deployButtonLabel}
- </DropdownMenu.Item>
- {#if type === 'project'}
- <DropdownMenu.Separator />
- <DropdownMenu.Label>{m.settings_default_deploy_pull_policy()}</DropdownMenu.Label>
- <DropdownMenu.RadioGroup value={deployOptionsStore.pullPolicy} onValueChange={handleDeployPullPolicyChange}>
- <DropdownMenu.RadioItem value="missing">Missing</DropdownMenu.RadioItem>
- <DropdownMenu.RadioItem value="always">
- {m.common_always()}
- </DropdownMenu.RadioItem>
- <DropdownMenu.RadioItem value="never">
- {m.common_never()}
- </DropdownMenu.RadioItem>
- </DropdownMenu.RadioGroup>
- <DropdownMenu.Separator />
- <DropdownMenu.CheckboxItem
- checked={deployOptionsStore.forceRecreate}
- onCheckedChange={(checked) => deployOptionsStore.setForceRecreate(checked === true)}
- >
- {m.deploy_force_recreate()}
- </DropdownMenu.CheckboxItem>
- {/if}
- {/if}
- {:else if isRunning}
- {#if canStop}
- <DropdownMenu.Item onclick={handleStop} disabled={uiLoading.stop}>
- {type === 'project' ? m.common_down() : m.common_stop()}
- </DropdownMenu.Item>
- {/if}
- {#if canRestart}
- <DropdownMenu.Item onclick={handleRestart} disabled={uiLoading.restart}>
- {m.common_restart()}
- </DropdownMenu.Item>
- {/if}
- {/if}
-
- {#if type === 'container'}
- {@render RedeployMenuItem()}
- {@render beforeRemoveMenuItems?.(isLifecycleActionPending)}
- {#if canRemove}
- <DropdownMenu.Item onclick={() => confirmAction('remove')} disabled={uiLoading.remove}>
- {m.common_remove()}
- </DropdownMenu.Item>
- {/if}
- {:else}
- {@render RedeployMenuItem()}
-
- {#if type === 'project'}
- {#if projectHasBuildDirective && canBuild}
- <DropdownMenu.Item onclick={handleProjectBuild} disabled={uiLoading.build}>
- {m.build()}
- </DropdownMenu.Item>
- {/if}
- {#if canPull}
- <DropdownMenu.Item onclick={handleProjectPull} disabled={uiLoading.pull}>
- {m.images_pull()}
- </DropdownMenu.Item>
- {/if}
- {/if}
-
- {#if onRefresh}
- <DropdownMenu.Item onclick={handleRefresh} disabled={uiLoading.refresh}>
- {m.common_refresh()}
- </DropdownMenu.Item>
- {/if}
-
- {#if canRemove}
- <DropdownMenu.Item onclick={() => confirmAction('remove')} disabled={uiLoading.remove}>
- {type === 'project' ? m.compose_destroy() : m.common_remove()}
- </DropdownMenu.Item>
- {/if}
- {/if}
- </DropdownMenu.Group>
- </DropdownMenu.Content>
- </DropdownMenu.Root>
+ {@render ActionsMenu()}
</div>
{/if}
</div>
{:else}
<div>
<div class="hidden items-center gap-2 lg:flex">
- {#if !isRunning && canStart}
- {#if type === 'container'}
- <ArcaneButton action="start" onclick={() => handleStart()} loading={uiLoading.start} />
- {:else}
- <DeploySplitButton customLabel={deployButtonLabel} onDeploy={() => handleDeploy()} loading={uiLoading.start} />
- {/if}
- {/if}
-
- {#if isRunning}
- {#if canStop}
- <ArcaneButton
- action="stop"
- customLabel={type === 'project' ? m.common_down() : undefined}
- onclick={() => handleStop()}
- loading={uiLoading.stop}
- />
- {/if}
- {#if canRestart}
- <ArcaneButton action="restart" onclick={() => handleRestart()} loading={uiLoading.restart} />
- {/if}
- {/if}
-
- {#if type === 'container'}
- {@render RedeployActionButton()}
- {@render beforeRemoveActions?.('default', true, isLifecycleActionPending)}
- {#if canRemove}
- <ArcaneButton action="remove" onclick={() => confirmAction('remove')} loading={uiLoading.remove} />
- {/if}
- {:else}
- {@render RedeployActionButton()}
-
- {#if type === 'project'}
- {#if projectHasBuildDirective && canBuild}
- <ArcaneButton action="build" onclick={() => handleProjectBuild()} loading={uiLoading.build} />
- {/if}
-
- {#if canPull}
- <ArcaneButton action="pull" onclick={() => handleProjectPull()} loading={uiLoading.pull} />
- {/if}
- {/if}
-
- {#if onRefresh}
- <ArcaneButton action="refresh" onclick={() => handleRefresh()} loading={uiLoading.refresh} />
- {/if}
-
- {#if canRemove}
- <ArcaneButton
- customLabel={type === 'project' ? m.compose_destroy() : m.common_remove()}
- action="remove"
- onclick={() => confirmAction('remove')}
- loading={uiLoading.remove}
- />
- {/if}
- {/if}
+ {@render DesktopActions('default', true)}
</div>
<div class="flex items-center lg:hidden">
- <DropdownMenu.Root>
- <DropdownMenu.Trigger class="bg-background/70 inline-flex size-9 items-center justify-center rounded-lg border">
- <span class="sr-only">{m.common_open_menu()}</span>
- <EllipsisIcon />
- </DropdownMenu.Trigger>
-
- <DropdownMenu.Content
- align="end"
- class="bg-popover/20 z-[var(--arcane-z-surface)] min-w-[180px] rounded-xl border p-1 shadow-lg backdrop-blur-md"
- >
- <DropdownMenu.Group>
- {#if !isRunning && canStart}
- {#if type === 'container'}
- <DropdownMenu.Item onclick={handleStart} disabled={uiLoading.start}>
- {m.common_start()}
- </DropdownMenu.Item>
- {:else}
- <DropdownMenu.Item onclick={() => handleDeploy()} disabled={uiLoading.start}>
- {deployButtonLabel}
- </DropdownMenu.Item>
- {#if type === 'project'}
- <DropdownMenu.Separator />
- <DropdownMenu.Label>{m.settings_default_deploy_pull_policy()}</DropdownMenu.Label>
- <DropdownMenu.RadioGroup value={deployOptionsStore.pullPolicy} onValueChange={handleDeployPullPolicyChange}>
- <DropdownMenu.RadioItem value="missing">Missing</DropdownMenu.RadioItem>
- <DropdownMenu.RadioItem value="always">
- {m.common_always()}
- </DropdownMenu.RadioItem>
- <DropdownMenu.RadioItem value="never">
- {m.common_never()}
- </DropdownMenu.RadioItem>
- </DropdownMenu.RadioGroup>
- <DropdownMenu.Separator />
- <DropdownMenu.CheckboxItem
- checked={deployOptionsStore.forceRecreate}
- onCheckedChange={(checked) => deployOptionsStore.setForceRecreate(checked === true)}
- >
- {m.deploy_force_recreate()}
- </DropdownMenu.CheckboxItem>
- {/if}
- {/if}
- {:else if isRunning}
- {#if canStop}
- <DropdownMenu.Item onclick={handleStop} disabled={uiLoading.stop}>
- {type === 'project' ? m.common_down() : m.common_stop()}
- </DropdownMenu.Item>
- {/if}
- {#if canRestart}
- <DropdownMenu.Item onclick={handleRestart} disabled={uiLoading.restart}>
- {m.common_restart()}
- </DropdownMenu.Item>
- {/if}
- {/if}
-
- {#if type === 'container'}
- {@render RedeployMenuItem()}
- {@render beforeRemoveMenuItems?.(isLifecycleActionPending)}
- {#if canRemove}
- <DropdownMenu.Item onclick={() => confirmAction('remove')} disabled={uiLoading.remove}>
- {m.common_remove()}
- </DropdownMenu.Item>
- {/if}
- {:else}
- {@render RedeployMenuItem()}
-
- {#if type === 'project'}
- {#if projectHasBuildDirective && canBuild}
- <DropdownMenu.Item onclick={handleProjectBuild} disabled={uiLoading.build}>
- {m.build()}
- </DropdownMenu.Item>
- {/if}
- {#if canPull}
- <DropdownMenu.Item onclick={handleProjectPull} disabled={uiLoading.pull}>
- {m.images_pull()}
- </DropdownMenu.Item>
- {/if}
- {/if}
-
- {#if onRefresh}
- <DropdownMenu.Item onclick={handleRefresh} disabled={uiLoading.refresh}>
- {m.common_refresh()}
- </DropdownMenu.Item>
- {/if}
-
- {#if canRemove}
- <DropdownMenu.Item onclick={() => confirmAction('remove')} disabled={uiLoading.remove}>
- {type === 'project' ? m.compose_destroy() : m.common_remove()}
- </DropdownMenu.Item>
- {/if}
- {/if}
- </DropdownMenu.Group>
- </DropdownMenu.Content>
- </DropdownMenu.Root>
+ {@render ActionsMenu()}
</div>
</div>
{/if}
diff --git a/frontend/src/lib/components/agent-command-block.svelte b/frontend/src/lib/components/agent-command-block.svelte
new file mode 100644
index 000000000..d1892df17
--- /dev/null
+++ b/frontend/src/lib/components/agent-command-block.svelte
@@ -0,0 +1,33 @@
+<script lang="ts">
+ import { CopyButton } from '$lib/components/ui/copy-button';
+
+ interface Props {
+ dockerRunLabel: string;
+ dockerRun: string;
+ dockerComposeLabel: string;
+ dockerCompose: string;
+ preClass?: string;
+ }
+
+ let { dockerRunLabel, dockerRun, dockerComposeLabel, dockerCompose, preClass = '' }: Props = $props();
+</script>
+
+<div class="space-y-2">
+ <div class="text-sm font-medium">{dockerRunLabel}</div>
+ <div class="relative">
+ <pre class="bg-muted overflow-x-auto rounded-md p-3 text-xs {preClass}"><code>{dockerRun}</code></pre>
+ <div class="absolute top-2 right-2">
+ <CopyButton text={dockerRun} size="icon" class="size-7" />
+ </div>
+ </div>
+</div>
+
+<div class="space-y-2">
+ <div class="text-sm font-medium">{dockerComposeLabel}</div>
+ <div class="relative">
+ <pre class="bg-muted overflow-x-auto rounded-md p-3 text-xs {preClass}"><code>{dockerCompose}</code></pre>
+ <div class="absolute top-2 right-2">
+ <CopyButton text={dockerCompose} size="icon" class="size-7" />
+ </div>
+ </div>
+</div>
diff --git a/frontend/src/lib/components/arcane-table/arcane-table-desktop-view.svelte b/frontend/src/lib/components/arcane-table/arcane-table-desktop-view.svelte
index 4f9907087..c6d02f8cb 100644
--- a/frontend/src/lib/components/arcane-table/arcane-table-desktop-view.svelte
+++ b/frontend/src/lib/components/arcane-table/arcane-table-desktop-view.svelte
@@ -4,8 +4,7 @@
import { createVirtualizer } from './virtualizer.svelte';
import Skeleton from '$lib/components/ui/skeleton/skeleton.svelte';
import * as Table from '$lib/components/ui/table/index.js';
- import * as Empty from '$lib/components/ui/empty/index.js';
- import { FolderXIcon, ArrowRightIcon, ArrowDownIcon } from '$lib/icons';
+ import { ArrowRightIcon, ArrowDownIcon } from '$lib/icons';
import { m } from '$lib/paraglide/messages';
import { cn } from '$lib/utils';
import {
@@ -17,6 +16,7 @@
type GroupSelectionState
} from './arcane-table.types.svelte';
import TableCheckbox from './arcane-table-checkbox.svelte';
+ import TableEmpty from './table-empty.svelte';
import type { Component, Snippet } from 'svelte';
import type { Attachment } from 'svelte/attachments';
import { slide } from 'svelte/transition';
@@ -124,10 +124,22 @@
// the full unpaginated set. Normal paginated pages (<= 100 rows) render plainly. Grouped and
// expandable layouts keep their existing, proven rendering.
const VIRTUALIZE_THRESHOLD = 100;
- const ROW_ESTIMATE_PX = 52;
+ // Rows are strictly single-line (Table.Cell is `whitespace-nowrap`) so they all share one height.
+ // We virtualize with a fixed row height instead of measuring every row: dynamic per-row measurement
+ // made the "All" view flicker — with an estimate that differed from the real height, each row
+ // re-measured as it scrolled in and nudged the rows already on screen. Calibrate once from the first
+ // rendered row, after which every offset is exact and stable.
+ const ROW_ESTIMATE_PX = 44;
+ let measuredRowHeight = $state<number | null>(null);
const flatRows = $derived(table.getRowModel().rows);
const shouldVirtualize = $derived(!isGrouped && !hasExpand && !!scrollElement && flatRows.length > VIRTUALIZE_THRESHOLD);
+ function calibrateRowHeight(node: HTMLTableRowElement) {
+ if (measuredRowHeight !== null) return;
+ const h = node.getBoundingClientRect().height;
+ if (h > 0) measuredRowHeight = h;
+ }
+
// Row actions are a real pinned column: sticky to the row's right edge with its own reserved
// width, so the floating button never overlaps data columns and survives horizontal scroll.
// bg-inherit picks up the row's background (including hover/selected tints) to mask content
@@ -141,14 +153,17 @@
// Runes can't be created conditionally, so the virtualizer always exists but is `enabled` only
// when we actually virtualize; disabled, it stays cheap and reports an empty window.
- const rowVirtualizer = createVirtualizer<HTMLElement, HTMLTableRowElement>(() => ({
- count: flatRows.length,
- getScrollElement: () => scrollElement ?? null,
- estimateSize: () => ROW_ESTIMATE_PX,
- overscan: 10,
- getItemKey: (index) => flatRows[index]?.id ?? index,
- enabled: shouldVirtualize
- }));
+ const rowVirtualizer = createVirtualizer<HTMLElement, HTMLTableRowElement>(() => {
+ const rowSize = measuredRowHeight ?? ROW_ESTIMATE_PX;
+ return {
+ count: flatRows.length,
+ getScrollElement: () => scrollElement ?? null,
+ estimateSize: () => rowSize,
+ overscan: 10,
+ getItemKey: (index) => flatRows[index]?.id ?? index,
+ enabled: shouldVirtualize
+ };
+ });
</script>
{#snippet cellContent(cell: ArcaneCell<TData>)}
@@ -164,7 +179,7 @@
{/if}
{/snippet}
-{#snippet flatRow(row: ArcaneRow<TData>, measureRow?: Attachment<HTMLTableRowElement>)}
+{#snippet dataRow(row: ArcaneRow<TData>, isGroupedRow: boolean, measureRow?: Attachment<HTMLTableRowElement>)}
{@const rowId = row.original.id}
{@const isExpanded = expandedRows?.has(rowId) ?? false}
<Table.Row
@@ -188,8 +203,9 @@
</button>
</Table.Cell>
{/if}
- {#each row.getVisibleCells() as cell (cell.id)}
- <Table.Cell class={getCellClasses(cell, false, false)}>
+ {#each row.getVisibleCells() as cell, cellIndex (cell.id)}
+ {@const isFirstDataCell = !selectionDisabled ? cellIndex === 1 : cellIndex === 0}
+ <Table.Cell class={getCellClasses(cell, isGroupedRow, isFirstDataCell)}>
{@render cellContent(cell)}
</Table.Cell>
{/each}
@@ -208,6 +224,14 @@
{/if}
{/snippet}
+{#snippet emptyState()}
+ <Table.Row>
+ <Table.Cell colspan={columnsCount} class="h-48">
+ <TableEmpty class={cn('rounded-lg py-12', unstyled ? 'bg-transparent' : 'bg-card/30 backdrop-blur-sm')} />
+ </Table.Cell>
+ </Table.Row>
+{/snippet}
+
{#snippet skeletonRows()}
{#each Array.from({ length: 8 }, (_, i) => i) as r (r)}
<Table.Row class="hover:bg-transparent">
@@ -296,91 +320,19 @@
<!-- Group Items (if not collapsed) -->
{#if !isCollapsed}
{#each groupRows as row (row.id)}
- {@const rowId = row.original.id}
- {@const isExpanded = expandedRows?.has(rowId) ?? false}
- <Table.Row
- data-state={(selectedIds ?? []).includes(rowId) && 'selected'}
- onclick={(event) => handleRowClick(event, rowId)}
- class={cn(hasExpand && 'cursor-pointer', isExpanded && 'bg-primary/15')}
- >
- {#if hasExpand}
- <Table.Cell class="w-8 px-2" data-row-select-ignore>
- <button
- class="text-muted-foreground hover:text-foreground flex items-center justify-center transition-transform duration-200"
- class:rotate-90={isExpanded}
- onclick={(e) => {
- e.stopPropagation();
- onToggleRowExpanded?.(rowId);
- }}
- aria-label={isExpanded ? 'Collapse row' : 'Expand row'}
- >
- <ArrowRightIcon class="size-4" />
- </button>
- </Table.Cell>
- {/if}
- {#each row.getVisibleCells() as cell, cellIndex (cell.id)}
- {@const isFirstDataCell = !selectionDisabled ? cellIndex === 1 : cellIndex === 0}
- <Table.Cell class={getCellClasses(cell, true, isFirstDataCell)}>
- {@render cellContent(cell)}
- </Table.Cell>
- {/each}
- </Table.Row>
-
- {#if hasExpand && isExpanded && expandedRowContent}
- <Table.Row class="bg-primary/10 hover:bg-primary/10">
- <Table.Cell colspan={columnsCount} class="p-0">
- <div transition:slide={{ duration: 200 }}>
- <div class="px-6 py-4">
- {@render expandedRowContent({ row, item: row.original })}
- </div>
- </div>
- </Table.Cell>
- </Table.Row>
- {/if}
+ {@render dataRow(row, true)}
{/each}
{/if}
{/each}
{#if groupedRows.length === 0}
- <Table.Row>
- <Table.Cell colspan={columnsCount} class="h-48">
- <Empty.Root
- class={cn('rounded-lg py-12', unstyled ? 'bg-transparent' : 'bg-card/30 backdrop-blur-sm')}
- role="status"
- aria-live="polite"
- >
- <Empty.Header>
- <Empty.Media variant="icon">
- <FolderXIcon class="text-muted-foreground/60 size-10" />
- </Empty.Media>
- <Empty.Title class="text-lg font-semibold">{m.common_no_results_found()}</Empty.Title>
- <Empty.Description class="text-muted-foreground text-sm">{m.common_no_results_hint()}</Empty.Description>
- </Empty.Header>
- </Empty.Root>
- </Table.Cell>
- </Table.Row>
+ {@render emptyState()}
{/if}
{:else}
{#if loading && flatRows.length === 0}
{@render skeletonRows()}
{:else if flatRows.length === 0}
- <Table.Row>
- <Table.Cell colspan={columnsCount} class="h-48">
- <Empty.Root
- class={cn('rounded-lg py-12', unstyled ? 'bg-transparent' : 'backdrop-blur-sm bg-card/30')}
- role="status"
- aria-live="polite"
- >
- <Empty.Header>
- <Empty.Media variant="icon">
- <FolderXIcon class="text-muted-foreground/60 size-10" />
- </Empty.Media>
- <Empty.Title class="text-lg font-semibold">{m.common_no_results_found()}</Empty.Title>
- <Empty.Description class="text-muted-foreground text-sm">{m.common_no_results_hint()}</Empty.Description>
- </Empty.Header>
- </Empty.Root>
- </Table.Cell>
- </Table.Row>
+ {@render emptyState()}
{:else if shouldVirtualize}
{@const vItems = rowVirtualizer.virtualItems}
{@const first = vItems[0]}
@@ -393,7 +345,7 @@
{#each vItems as vItem (vItem.key)}
{@const row = flatRows[vItem.index]}
{#if row}
- {@render flatRow(row, rowVirtualizer.measureElement)}
+ {@render dataRow(row, false, calibrateRowHeight)}
{/if}
{/each}
{#if padBottom > 0}
@@ -401,7 +353,7 @@
{/if}
{:else}
{#each flatRows as row (row.id)}
- {@render flatRow(row)}
+ {@render dataRow(row, false)}
{/each}
{/if}
{/if}
diff --git a/frontend/src/lib/components/arcane-table/arcane-table-mobile-view.svelte b/frontend/src/lib/components/arcane-table/arcane-table-mobile-view.svelte
index da39e1662..833263759 100644
--- a/frontend/src/lib/components/arcane-table/arcane-table-mobile-view.svelte
+++ b/frontend/src/lib/components/arcane-table/arcane-table-mobile-view.svelte
@@ -1,9 +1,8 @@
<script lang="ts" generics="TData extends Record<string, any> & { id: string }">
import type { ArcaneRow, ArcaneSvelteTable } from './table-features';
- import * as Empty from '$lib/components/ui/empty/index.js';
import Skeleton from '$lib/components/ui/skeleton/skeleton.svelte';
import DropdownCard from '$lib/components/dropdown-card.svelte';
- import { FolderXIcon } from '$lib/icons';
+ import TableEmpty from './table-empty.svelte';
import { m } from '$lib/paraglide/messages';
import { cn } from '$lib/utils';
import type { Snippet, Component } from 'svelte';
@@ -62,6 +61,29 @@
{/each}
{/snippet}
+{#snippet mobileRow(row: ArcaneRow<TData>)}
+ {@const rowId = row.original.id}
+ {@const isExpanded = expandedRows?.has(rowId) ?? false}
+ <!-- svelte-ignore a11y_click_events_have_key_events -->
+ <!-- svelte-ignore a11y_no_static_element_interactions -->
+ <div class={cn(hasExpand && 'cursor-pointer')} onclick={(e) => handleRowClick(e, rowId)}>
+ {@render mobileCard({ row, item: row.original, mobileFieldVisibility })}
+ </div>
+ {#if hasExpand && isExpanded && expandedRowContent}
+ <div class="bg-muted/30 px-4 py-3" transition:slide={{ duration: 200 }}>
+ {@render expandedRowContent({ row, item: row.original })}
+ </div>
+ {/if}
+{/snippet}
+
+{#snippet emptyState()}
+ <div class="p-4">
+ <TableEmpty
+ class={cn('min-h-48 rounded-xl py-12', unstyled ? 'border-transparent bg-transparent' : 'bg-card/30 backdrop-blur-sm')}
+ />
+ </div>
+{/snippet}
+
<div class="divide-border/30 divide-y">
{#if isGrouped && groupedRows}
<div class="space-y-4 py-2">
@@ -77,18 +99,7 @@
>
<div class="divide-border/30 divide-y">
{#each groupRows as row (row.id)}
- {@const rowId = row.original.id}
- {@const isExpanded = expandedRows?.has(rowId) ?? false}
- <!-- svelte-ignore a11y_click_events_have_key_events -->
- <!-- svelte-ignore a11y_no_static_element_interactions -->
- <div class={cn(hasExpand && 'cursor-pointer')} onclick={(e) => handleRowClick(e, rowId)}>
- {@render mobileCard({ row, item: row.original, mobileFieldVisibility })}
- </div>
- {#if hasExpand && isExpanded && expandedRowContent}
- <div class="bg-muted/30 px-4 py-3" transition:slide={{ duration: 200 }}>
- {@render expandedRowContent({ row, item: row.original })}
- </div>
- {/if}
+ {@render mobileRow(row)}
{:else}
<div class="text-muted-foreground flex h-24 items-center justify-center text-center">
{m.common_no_results_found()}
@@ -100,55 +111,16 @@
</div>
{#if groupedRows.length === 0}
- <div class="p-4">
- <Empty.Root
- class={cn('min-h-48 rounded-xl py-12', unstyled ? 'border-transparent bg-transparent' : 'bg-card/30 backdrop-blur-sm')}
- role="status"
- aria-live="polite"
- >
- <Empty.Header>
- <Empty.Media variant="icon">
- <FolderXIcon class="text-muted-foreground/60 size-10" />
- </Empty.Media>
- <Empty.Title class="text-lg font-semibold">{m.common_no_results_found()}</Empty.Title>
- <Empty.Description class="text-muted-foreground text-sm">{m.common_no_results_hint()}</Empty.Description>
- </Empty.Header>
- </Empty.Root>
- </div>
+ {@render emptyState()}
{/if}
{:else if loading && table.getRowModel().rows.length === 0}
{@render mobileSkeleton()}
{:else}
<!-- Non-grouped view (original behavior) -->
{#each table.getRowModel().rows as row (row.id)}
- {@const rowId = (row.original as any).id}
- {@const isExpanded = expandedRows?.has(rowId) ?? false}
- <!-- svelte-ignore a11y_click_events_have_key_events -->
- <!-- svelte-ignore a11y_no_static_element_interactions -->
- <div class={cn(hasExpand && 'cursor-pointer')} onclick={(e) => handleRowClick(e, rowId)}>
- {@render mobileCard({ row, item: row.original, mobileFieldVisibility })}
- </div>
- {#if hasExpand && isExpanded && expandedRowContent}
- <div class="bg-muted/30 px-4 py-3" transition:slide={{ duration: 200 }}>
- {@render expandedRowContent({ row, item: row.original })}
- </div>
- {/if}
+ {@render mobileRow(row)}
{:else}
- <div class="p-4">
- <Empty.Root
- class={cn('min-h-48 rounded-xl py-12', unstyled ? 'border-transparent bg-transparent' : 'bg-card/30 backdrop-blur-sm')}
- role="status"
- aria-live="polite"
- >
- <Empty.Header>
- <Empty.Media variant="icon">
- <FolderXIcon class="text-muted-foreground/60 size-10" />
- </Empty.Media>
- <Empty.Title class="text-lg font-semibold">{m.common_no_results_found()}</Empty.Title>
- <Empty.Description class="text-muted-foreground text-sm">{m.common_no_results_hint()}</Empty.Description>
- </Empty.Header>
- </Empty.Root>
- </div>
+ {@render emptyState()}
{/each}
{/if}
</div>
diff --git a/frontend/src/lib/components/arcane-table/arcane-table-toolbar.svelte b/frontend/src/lib/components/arcane-table/arcane-table-toolbar.svelte
index f2865c39f..5334f8d60 100644
--- a/frontend/src/lib/components/arcane-table/arcane-table-toolbar.svelte
+++ b/frontend/src/lib/components/arcane-table/arcane-table-toolbar.svelte
@@ -87,6 +87,29 @@
const activeFilterCount = $derived(table.state.columnFilters.length);
</script>
+{#snippet filterList()}
+ {#if typeColumn && typeColumnFilterOptions.length > 0 && !severityColumn && !vulnSeverityColumn}
+ <DataTableFacetedFilter column={typeColumn} title={m.common_type()} options={typeColumnFilterOptions} />
+ {/if}
+ {#if usageColumn}
+ <DataTableFacetedFilter column={usageColumn} title={m.common_usage()} options={usageFilters} />
+ {/if}
+ {#if updatesColumn}
+ <DataTableFacetedFilter column={updatesColumn} title={m.images_updates()} options={imageUpdateFilters} />
+ {/if}
+ {#if vulnSeverityColumn}
+ <DataTableFacetedFilter column={vulnSeverityColumn} title={m.events_col_severity()} options={vulnerabilitySeverityFilters} />
+ {:else if severityColumn}
+ <DataTableFacetedFilter column={severityColumn} title={m.events_col_severity()} options={severityFilters} />
+ {/if}
+ {#if imageNameColumn && imageNameFilterOptionsFormatted.length > 0}
+ <DataTableFacetedFilter column={imageNameColumn} title={m.common_image()} options={imageNameFilterOptionsFormatted} />
+ {/if}
+ {#if statusColumn && serviceCountColumn}
+ <DataTableFacetedFilter column={statusColumn} title={m.common_status()} options={projectStatusFilters} />
+ {/if}
+{/snippet}
+
<div class={cn('flex flex-wrap items-center gap-2 px-4 py-3', className)}>
<div class="order-1 flex min-w-0 flex-1 items-center gap-2 md:flex-none">
<div class="relative min-w-0 flex-1 md:w-64 md:flex-none">
@@ -105,30 +128,7 @@
{#if hasFilterColumns}
<div class="hidden items-center gap-1.5 md:flex">
- {#if typeColumn && typeColumnFilterOptions.length > 0 && !severityColumn && !vulnSeverityColumn}
- <DataTableFacetedFilter column={typeColumn} title={m.common_type()} options={typeColumnFilterOptions} />
- {/if}
- {#if usageColumn}
- <DataTableFacetedFilter column={usageColumn} title={m.common_usage()} options={usageFilters} />
- {/if}
- {#if updatesColumn}
- <DataTableFacetedFilter column={updatesColumn} title={m.images_updates()} options={imageUpdateFilters} />
- {/if}
- {#if vulnSeverityColumn}
- <DataTableFacetedFilter
- column={vulnSeverityColumn}
- title={m.events_col_severity()}
- options={vulnerabilitySeverityFilters}
- />
- {:else if severityColumn}
- <DataTableFacetedFilter column={severityColumn} title={m.events_col_severity()} options={severityFilters} />
- {/if}
- {#if imageNameColumn && imageNameFilterOptionsFormatted.length > 0}
- <DataTableFacetedFilter column={imageNameColumn} title={m.common_image()} options={imageNameFilterOptionsFormatted} />
- {/if}
- {#if statusColumn && serviceCountColumn}
- <DataTableFacetedFilter column={statusColumn} title={m.common_status()} options={projectStatusFilters} />
- {/if}
+ {@render filterList()}
</div>
<div class="md:hidden">
@@ -149,34 +149,7 @@
</Popover.Trigger>
<Popover.Content align="end" class="w-56 p-2">
<div class="flex flex-col gap-1.5">
- {#if typeColumn && typeColumnFilterOptions.length > 0 && !severityColumn && !vulnSeverityColumn}
- <DataTableFacetedFilter column={typeColumn} title={m.common_type()} options={typeColumnFilterOptions} />
- {/if}
- {#if usageColumn}
- <DataTableFacetedFilter column={usageColumn} title={m.common_usage()} options={usageFilters} />
- {/if}
- {#if updatesColumn}
- <DataTableFacetedFilter column={updatesColumn} title={m.images_updates()} options={imageUpdateFilters} />
- {/if}
- {#if vulnSeverityColumn}
- <DataTableFacetedFilter
- column={vulnSeverityColumn}
- title={m.events_col_severity()}
- options={vulnerabilitySeverityFilters}
- />
- {:else if severityColumn}
- <DataTableFacetedFilter column={severityColumn} title={m.events_col_severity()} options={severityFilters} />
- {/if}
- {#if imageNameColumn && imageNameFilterOptionsFormatted.length > 0}
- <DataTableFacetedFilter
- column={imageNameColumn}
- title={m.common_image()}
- options={imageNameFilterOptionsFormatted}
- />
- {/if}
- {#if statusColumn && serviceCountColumn}
- <DataTableFacetedFilter column={statusColumn} title={m.common_status()} options={projectStatusFilters} />
- {/if}
+ {@render filterList()}
</div>
</Popover.Content>
</Popover.Root>
diff --git a/frontend/src/lib/components/arcane-table/arcane-table.svelte b/frontend/src/lib/components/arcane-table/arcane-table.svelte
index 3ea453f78..799293c97 100644
--- a/frontend/src/lib/components/arcane-table/arcane-table.svelte
+++ b/frontend/src/lib/components/arcane-table/arcane-table.svelte
@@ -659,85 +659,41 @@
if (persistTimeout) clearTimeout(persistTimeout);
};
});
+
+ // Styled/unstyled differ only in wrapper chrome; the inner table/mobile/pagination tree is shared.
+ const shellClass = $derived(
+ unstyled
+ ? 'flex h-full min-h-0 flex-col'
+ : 'bg-background/60 flex h-full min-h-0 flex-col overflow-hidden rounded-xl border backdrop-blur-sm'
+ );
+ const toolbarWrapClass = $derived(unstyled ? 'w-full shrink-0 border-b' : 'border-border/50 w-full shrink-0 border-b');
</script>
{#snippet PaginationSnippet()}
<ArcaneTablePagination {items} {currentPage} {totalPages} {totalItems} {pageSize} {canPrev} {canNext} {setPage} {setPageSize} />
{/snippet}
+{#snippet MobileViewSnippet()}
+ <ArcaneTableMobileView
+ {table}
+ {mobileCard}
+ {mobileFieldVisibility}
+ groupedRows={effectiveGroupedRows}
+ {groupIcon}
+ {unstyled}
+ {expandedRowContent}
+ {expandedRows}
+ onToggleRowExpanded={toggleRowExpanded}
+ {loading}
+ />
+{/snippet}
+
{#if customTableView}
{@render customTableView({ table, renderPagination: PaginationSnippet, mobileFieldsForOptions, onToggleMobileField })}
-{:else if unstyled}
- <div class="flex h-full min-h-0 flex-col">
- {#if !withoutSearch}
- <div class="w-full shrink-0 border-b">
- <DataTableToolbar
- {table}
- {selectedIds}
- {selectionDisabled}
- {bulkActions}
- {withoutFilters}
- mobileFields={mobileFieldsForOptions}
- {onToggleMobileField}
- {customViewOptions}
- {customToolbarActions}
- {imageNameFilterOptions}
- />
- </div>
- {/if}
-
- <div
- bind:this={desktopScrollEl}
- class="bg-background/80 [isolation:isolate] hidden h-full min-h-0 flex-1 overflow-auto md:block"
- >
- <ArcaneTableDesktopView
- {table}
- {selectedIds}
- columnsCount={effectiveColumnsCount}
- groupedRows={effectiveGroupedRows}
- {groupIcon}
- {groupCollapsedState}
- {selectionDisabled}
- onGroupToggle={handleGroupToggle}
- {getGroupSelectionState}
- {onToggleGroupSelection}
- onToggleRowSelection={(id, selected) => onToggleRow(selected, id)}
- {unstyled}
- {expandedRowContent}
- {expandedRows}
- onToggleRowExpanded={toggleRowExpanded}
- scrollElement={desktopScrollEl}
- {loading}
- />
- </div>
-
- <div class="bg-background/80 [isolation:isolate] block flex-1 overflow-auto md:hidden">
- <div class="divide-border/40 divide-y">
- <ArcaneTableMobileView
- {table}
- {mobileCard}
- {mobileFieldVisibility}
- groupedRows={effectiveGroupedRows}
- {groupIcon}
- {unstyled}
- {expandedRowContent}
- {expandedRows}
- onToggleRowExpanded={toggleRowExpanded}
- {loading}
- />
- </div>
- </div>
-
- {#if !withoutPagination}
- <div class="border-border/50 shrink-0 border-t px-4 py-3">
- {@render PaginationSnippet()}
- </div>
- {/if}
- </div>
{:else}
- <div class="bg-background/60 flex h-full min-h-0 flex-col overflow-hidden rounded-xl border backdrop-blur-sm">
+ <div class={shellClass}>
{#if !withoutSearch}
- <div class="border-border/50 w-full shrink-0 border-b">
+ <div class={toolbarWrapClass}>
<DataTableToolbar
{table}
{selectedIds}
@@ -769,6 +725,7 @@
{getGroupSelectionState}
{onToggleGroupSelection}
onToggleRowSelection={(id, selected) => onToggleRow(selected, id)}
+ {unstyled}
{expandedRowContent}
{expandedRows}
onToggleRowExpanded={toggleRowExpanded}
@@ -778,17 +735,13 @@
</div>
<div class="bg-background/80 [isolation:isolate] block flex-1 overflow-auto md:hidden">
- <ArcaneTableMobileView
- {table}
- {mobileCard}
- {mobileFieldVisibility}
- groupedRows={effectiveGroupedRows}
- {groupIcon}
- {expandedRowContent}
- {expandedRows}
- onToggleRowExpanded={toggleRowExpanded}
- {loading}
- />
+ {#if unstyled}
+ <div class="divide-border/40 divide-y">
+ {@render MobileViewSnippet()}
+ </div>
+ {:else}
+ {@render MobileViewSnippet()}
+ {/if}
</div>
{#if !withoutPagination}
diff --git a/frontend/src/lib/components/arcane-table/cards/universal-mobile-card.svelte b/frontend/src/lib/components/arcane-table/cards/universal-mobile-card.svelte
index 9b1d1c3f5..0330e69f7 100644
--- a/frontend/src/lib/components/arcane-table/cards/universal-mobile-card.svelte
+++ b/frontend/src/lib/components/arcane-table/cards/universal-mobile-card.svelte
@@ -109,6 +109,29 @@
}
</script>
+{#snippet FieldValue(field: FieldDefinition<T>, value: any, isCompact: boolean)}
+ {#if field.type === 'badge' && field.badgeVariant}
+ <StatusBadge variant={field.badgeVariant} text={String(value)} size="sm" />
+ {:else if field.type === 'mono'}
+ <span class={isCompact ? 'text-muted-foreground truncate font-mono text-xs leading-tight' : 'font-mono text-xs'}>{value}</span
+ >
+ {:else if field.type === 'component' && field.component}
+ {#if isCompact}
+ <span class="text-muted-foreground min-w-0 flex-1 text-xs leading-tight">
+ {@render field.component(value)}
+ </span>
+ {:else}
+ {@render field.component(value)}
+ {/if}
+ {:else if isCompact}
+ <span class="text-muted-foreground min-w-0 flex-1 truncate text-xs leading-tight">
+ {value}
+ </span>
+ {:else}
+ {value}
+ {/if}
+{/snippet}
+
<div class={cn('group relative w-full px-3 py-2', className)}>
<Card.Root
variant="subtle"
@@ -197,15 +220,7 @@
{field.label}
</div>
<div class="truncate text-sm leading-snug font-medium">
- {#if field.type === 'badge' && field.badgeVariant}
- <StatusBadge variant={field.badgeVariant} text={String(value)} size="sm" />
- {:else if field.type === 'mono'}
- <span class="font-mono text-xs">{value}</span>
- {:else if field.type === 'component' && field.component}
- {@render field.component(value)}
- {:else}
- {value}
- {/if}
+ {@render FieldValue(field, value, false)}
</div>
</div>
</div>
@@ -218,19 +233,7 @@
{#if value !== null && value !== undefined}
<div class="flex items-baseline gap-2">
<span class="text-muted-foreground text-[11px] font-semibold tracking-wide uppercase">{field.label}:</span>
- {#if field.type === 'badge' && field.badgeVariant}
- <StatusBadge variant={field.badgeVariant} text={String(value)} size="sm" />
- {:else if field.type === 'mono'}
- <span class="text-muted-foreground truncate font-mono text-xs leading-tight">{value}</span>
- {:else if field.type === 'component' && field.component}
- <span class="text-muted-foreground min-w-0 flex-1 text-xs leading-tight">
- {@render field.component(value)}
- </span>
- {:else}
- <span class="text-muted-foreground min-w-0 flex-1 truncate text-xs leading-tight">
- {value}
- </span>
- {/if}
+ {@render FieldValue(field, value, true)}
</div>
{/if}
{/each}
diff --git a/frontend/src/lib/components/arcane-table/cells/checked-at-cell.svelte b/frontend/src/lib/components/arcane-table/cells/checked-at-cell.svelte
new file mode 100644
index 000000000..2ce018b78
--- /dev/null
+++ b/frontend/src/lib/components/arcane-table/cells/checked-at-cell.svelte
@@ -0,0 +1,7 @@
+<script lang="ts">
+ import { formatImageUpdateCheckedAt } from '$lib/utils/image-updates';
+
+ let { value }: { value: unknown } = $props();
+</script>
+
+<span class="text-sm">{formatImageUpdateCheckedAt(typeof value === 'string' ? value : '')}</span>
diff --git a/frontend/src/lib/components/arcane-table/cells/container-action-menu-item.svelte b/frontend/src/lib/components/arcane-table/cells/container-action-menu-item.svelte
new file mode 100644
index 000000000..3da55626b
--- /dev/null
+++ b/frontend/src/lib/components/arcane-table/cells/container-action-menu-item.svelte
@@ -0,0 +1,25 @@
+<script lang="ts">
+ import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
+ import { Spinner } from '$lib/components/ui/spinner/index.js';
+ import type { Component } from 'svelte';
+
+ interface Props {
+ icon: Component<any>;
+ label: string;
+ onclick: () => void;
+ loading?: boolean;
+ disabled?: boolean;
+ destructive?: boolean;
+ }
+
+ let { icon: Icon, label, onclick, loading = false, disabled = false, destructive = false }: Props = $props();
+</script>
+
+<DropdownMenu.Item {onclick} {disabled} variant={destructive ? 'destructive' : 'default'}>
+ {#if loading}
+ <Spinner class="size-4" />
+ {:else}
+ <Icon class="size-4" />
+ {/if}
+ {label}
+</DropdownMenu.Item>
diff --git a/frontend/src/lib/components/arcane-table/cells/created-at-cell.svelte b/frontend/src/lib/components/arcane-table/cells/created-at-cell.svelte
new file mode 100644
index 000000000..63a044573
--- /dev/null
+++ b/frontend/src/lib/components/arcane-table/cells/created-at-cell.svelte
@@ -0,0 +1,8 @@
+<script lang="ts">
+ import { format } from 'date-fns';
+ import { m } from '$lib/paraglide/messages';
+
+ let { value }: { value: unknown } = $props();
+</script>
+
+<span class="text-sm">{value ? format(new Date(String(value)), 'PP p') : m.common_na()}</span>
diff --git a/frontend/src/lib/components/arcane-table/cells/digest-cell.svelte b/frontend/src/lib/components/arcane-table/cells/digest-cell.svelte
new file mode 100644
index 000000000..a7fb3a8dd
--- /dev/null
+++ b/frontend/src/lib/components/arcane-table/cells/digest-cell.svelte
@@ -0,0 +1,8 @@
+<script lang="ts">
+ let { value }: { value: unknown } = $props();
+ const text = $derived(typeof value === 'string' ? value : '-');
+</script>
+
+<span class="font-mono text-xs break-all whitespace-normal" title={text !== '-' ? text : undefined}>
+ {text}
+</span>
diff --git a/frontend/src/lib/components/arcane-table/cells/enabled-status-cell.svelte b/frontend/src/lib/components/arcane-table/cells/enabled-status-cell.svelte
new file mode 100644
index 000000000..ab6a672a3
--- /dev/null
+++ b/frontend/src/lib/components/arcane-table/cells/enabled-status-cell.svelte
@@ -0,0 +1,9 @@
+<script lang="ts">
+ import StatusBadge from '$lib/components/badges/status-badge.svelte';
+ import { m } from '$lib/paraglide/messages';
+
+ let { value }: { value: unknown } = $props();
+ const enabled = $derived(Boolean(value));
+</script>
+
+<StatusBadge variant={enabled ? 'green' : 'red'} text={enabled ? m.common_enabled() : m.common_disabled()} />
diff --git a/frontend/src/lib/components/arcane-table/cells/in-use-status.svelte b/frontend/src/lib/components/arcane-table/cells/in-use-status.svelte
new file mode 100644
index 000000000..e5c736b9a
--- /dev/null
+++ b/frontend/src/lib/components/arcane-table/cells/in-use-status.svelte
@@ -0,0 +1,12 @@
+<script lang="ts">
+ import StatusBadge from '$lib/components/badges/status-badge.svelte';
+ import { m } from '$lib/paraglide/messages';
+
+ let { inUse }: { inUse: boolean } = $props();
+</script>
+
+{#if inUse}
+ <StatusBadge text={m.common_in_use()} variant="green" />
+{:else}
+ <StatusBadge text={m.common_unused()} variant="amber" />
+{/if}
diff --git a/frontend/src/lib/components/arcane-table/cells/remove-menu-item.svelte b/frontend/src/lib/components/arcane-table/cells/remove-menu-item.svelte
new file mode 100644
index 000000000..592774085
--- /dev/null
+++ b/frontend/src/lib/components/arcane-table/cells/remove-menu-item.svelte
@@ -0,0 +1,21 @@
+<script lang="ts">
+ import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
+ import { TrashIcon } from '$lib/icons';
+ import { m } from '$lib/paraglide/messages';
+
+ interface Props {
+ onclick: () => void;
+ disabled?: boolean;
+ withSeparator?: boolean;
+ }
+
+ let { onclick, disabled = false, withSeparator = true }: Props = $props();
+</script>
+
+{#if withSeparator}
+ <DropdownMenu.Separator />
+{/if}
+<DropdownMenu.Item variant="destructive" {onclick} {disabled}>
+ <TrashIcon class="size-4" />
+ {m.common_remove()}
+</DropdownMenu.Item>
diff --git a/frontend/src/lib/components/arcane-table/cells/unix-created-cell.svelte b/frontend/src/lib/components/arcane-table/cells/unix-created-cell.svelte
new file mode 100644
index 000000000..3513cb359
--- /dev/null
+++ b/frontend/src/lib/components/arcane-table/cells/unix-created-cell.svelte
@@ -0,0 +1,7 @@
+<script lang="ts">
+ import { format } from 'date-fns';
+
+ let { value }: { value: unknown } = $props();
+</script>
+
+{format(new Date(Number(value || 0) * 1000), 'PP p')}
diff --git a/frontend/src/lib/components/arcane-table/row-actions-menu.svelte b/frontend/src/lib/components/arcane-table/row-actions-menu.svelte
new file mode 100644
index 000000000..166d19927
--- /dev/null
+++ b/frontend/src/lib/components/arcane-table/row-actions-menu.svelte
@@ -0,0 +1,33 @@
+<script lang="ts">
+ import type { Snippet } from 'svelte';
+ import { ArcaneButton } from '$lib/components/arcane-button/index.js';
+ import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
+ import { EllipsisIcon } from '$lib/icons';
+ import { m } from '$lib/paraglide/messages';
+
+ let {
+ children,
+ triggerClass = 'size-8',
+ iconClass = 'size-4'
+ }: {
+ children: Snippet;
+ triggerClass?: string;
+ iconClass?: string;
+ } = $props();
+</script>
+
+<DropdownMenu.Root>
+ <DropdownMenu.Trigger>
+ {#snippet child({ props })}
+ <ArcaneButton {...props} action="base" tone="ghost" size="icon" class={triggerClass}>
+ <span class="sr-only">{m.common_open_menu()}</span>
+ <EllipsisIcon class={iconClass} />
+ </ArcaneButton>
+ {/snippet}
+ </DropdownMenu.Trigger>
+ <DropdownMenu.Content align="end">
+ <DropdownMenu.Group>
+ {@render children()}
+ </DropdownMenu.Group>
+ </DropdownMenu.Content>
+</DropdownMenu.Root>
diff --git a/frontend/src/lib/components/arcane-table/table-empty.svelte b/frontend/src/lib/components/arcane-table/table-empty.svelte
new file mode 100644
index 000000000..7af4c7ade
--- /dev/null
+++ b/frontend/src/lib/components/arcane-table/table-empty.svelte
@@ -0,0 +1,17 @@
+<script lang="ts">
+ import * as Empty from '$lib/components/ui/empty/index.js';
+ import { FolderXIcon } from '$lib/icons';
+ import { m } from '$lib/paraglide/messages';
+
+ let { class: className }: { class?: string } = $props();
+</script>
+
+<Empty.Root class={className} role="status" aria-live="polite">
+ <Empty.Header>
+ <Empty.Media variant="icon">
+ <FolderXIcon class="text-muted-foreground/60 size-10" />
+ </Empty.Media>
+ <Empty.Title class="text-lg font-semibold">{m.common_no_results_found()}</Empty.Title>
+ <Empty.Description class="text-muted-foreground text-sm">{m.common_no_results_hint()}</Empty.Description>
+ </Empty.Header>
+</Empty.Root>
diff --git a/frontend/src/lib/components/category-index-page.svelte b/frontend/src/lib/components/category-index-page.svelte
new file mode 100644
index 000000000..d51f1440c
--- /dev/null
+++ b/frontend/src/lib/components/category-index-page.svelte
@@ -0,0 +1,242 @@
+<script lang="ts">
+ import type { Component, ComponentProps, Snippet } from 'svelte';
+ import { ArcaneButton } from '$lib/components/arcane-button/index.js';
+ import { Card } from '$lib/components/ui/card';
+ import { UiConfigDisabledTag } from '$lib/components/badges/index.js';
+ import * as InputGroup from '$lib/components/ui/input-group/index.js';
+ import { Spinner } from '$lib/components/ui/spinner/index.js';
+ import HeaderCard from '$lib/components/header-card.svelte';
+ import { SearchIcon, ArrowRightIcon, CloseIcon } from '$lib/icons';
+ import type { NormalizedCategory } from './category-index-page.types';
+
+ interface CategorySearch {
+ searchQuery: string;
+ showSearchResults: boolean;
+ searchResults: NormalizedCategory[];
+ isSearching: boolean;
+ performSearch: (query: string) => void | Promise<void>;
+ debouncedSearch: (query: string) => void;
+ clearSearch: () => void;
+ }
+
+ interface Props {
+ // Header
+ headerIcon: Component;
+ title: string;
+ subtitle: string;
+ // Search input
+ searchPlaceholder: string;
+ clearSearchLabel: string;
+ // Search-results empty/loading states
+ searchingLabel: string;
+ noResultsTitle: string;
+ noResultsDescription: string;
+ // Matching-items section
+ matchingItemsLabel: string;
+ // Go-to-page button on each result card
+ goToPageLabel: string;
+ goToPageButtonTone?: ComponentProps<typeof ArcaneButton>['tone'];
+ // Class deltas between the two pages
+ rootClass: string;
+ cardClass: string;
+ resultCardClass: string;
+ searchIconClass?: string;
+ // Data
+ categories: NormalizedCategory[];
+ categorySearch: CategorySearch;
+ navigate: (href: string) => void;
+ // Structurally-different regions rendered by the parent page
+ resultsHeading: Snippet;
+ moreKeywords: Snippet<[number]>;
+ }
+
+ let {
+ headerIcon,
+ title,
+ subtitle,
+ searchPlaceholder,
+ clearSearchLabel,
+ searchingLabel,
+ noResultsTitle,
+ noResultsDescription,
+ matchingItemsLabel,
+ goToPageLabel,
+ goToPageButtonTone,
+ rootClass,
+ cardClass,
+ resultCardClass,
+ searchIconClass = 'size-4',
+ categories,
+ categorySearch,
+ navigate,
+ resultsHeading,
+ moreKeywords
+ }: Props = $props();
+
+ const HeaderIcon = $derived(headerIcon);
+</script>
+
+<div class={rootClass}>
+ <HeaderCard>
+ <div class="flex items-center justify-between gap-4">
+ <div class="flex min-w-64 flex-1 items-center gap-3 sm:gap-4">
+ <div
+ class="bg-primary/10 text-primary ring-primary/20 flex size-8 shrink-0 items-center justify-center rounded-lg ring-1 sm:size-10"
+ >
+ <HeaderIcon class="size-4 sm:size-5" />
+ </div>
+ <div class="min-w-0">
+ <h1 class="text-3xl font-semibold tracking-tight">{title}</h1>
+ <p class="text-muted-foreground mt-1 text-sm sm:text-base">{subtitle}</p>
+ </div>
+ </div>
+ <div class="flex items-center gap-3">
+ <UiConfigDisabledTag />
+ </div>
+ </div>
+
+ <div class="relative mt-4 w-full sm:mt-6 sm:max-w-md">
+ <InputGroup.Root>
+ <InputGroup.Input
+ placeholder={searchPlaceholder}
+ value={categorySearch.searchQuery}
+ oninput={(e) => {
+ categorySearch.searchQuery = e.currentTarget.value;
+ categorySearch.debouncedSearch(e.currentTarget.value);
+ }}
+ onkeydown={(e) => {
+ if (e.key === 'Enter') {
+ categorySearch.performSearch((e.currentTarget as HTMLInputElement).value);
+ }
+ }}
+ />
+ <InputGroup.Addon>
+ {#if categorySearch.showSearchResults}
+ <ArcaneButton
+ action="base"
+ tone="ghost"
+ size="sm"
+ onclick={categorySearch.clearSearch}
+ class="h-6 w-6 p-0"
+ icon={CloseIcon}
+ showLabel={false}
+ customLabel={clearSearchLabel}
+ />
+ {:else}
+ <SearchIcon class={searchIconClass} />
+ {/if}
+ </InputGroup.Addon>
+ </InputGroup.Root>
+ </div>
+ </HeaderCard>
+
+ {#if !categorySearch.showSearchResults}
+ <div class="grid grid-cols-1 gap-4 sm:grid-cols-2 sm:gap-6 xl:grid-cols-3">
+ {#each categories as category (category.id)}
+ {@const Icon = category.icon}
+ <Card class={cardClass}>
+ <button onclick={() => navigate(category.href)} class="w-full p-4 text-left sm:p-6">
+ <div class="flex items-start justify-between gap-3">
+ <div class="flex min-w-0 flex-1 items-start gap-3 sm:gap-4">
+ <div
+ class="bg-primary/5 text-primary ring-primary/10 group-hover:bg-primary/10 flex size-10 shrink-0 items-center justify-center rounded-lg ring-1 transition-colors sm:size-12"
+ >
+ <Icon class="size-5 sm:size-6" />
+ </div>
+ <div class="min-w-0 flex-1">
+ <h2 class="text-sm leading-tight font-semibold sm:text-base">{category.title}</h2>
+ <p class="text-muted-foreground mt-1 text-xs leading-relaxed sm:text-sm">{category.description}</p>
+ </div>
+ </div>
+ <ArrowRightIcon class="text-muted-foreground group-hover:text-foreground mt-1 size-4 shrink-0 transition-colors" />
+ </div>
+ </button>
+ </Card>
+ {/each}
+ </div>
+ {:else}
+ <div class="space-y-6 sm:space-y-8">
+ <div class="flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between">
+ <h2 class="text-base font-semibold sm:text-lg">
+ {@render resultsHeading()}
+ </h2>
+ </div>
+
+ {#if categorySearch.isSearching}
+ <div class="py-8 text-center sm:py-12">
+ <Spinner class="text-primary mx-auto mb-3 size-8 sm:mb-4 sm:size-12" />
+ <p class="text-muted-foreground text-sm sm:text-base">{searchingLabel}</p>
+ </div>
+ {:else if categorySearch.searchResults.length === 0}
+ <div class="py-8 text-center sm:py-12">
+ <SearchIcon class="text-muted-foreground mx-auto mb-3 size-8 sm:mb-4 sm:size-12" />
+ <h3 class="mb-2 text-base font-medium sm:text-lg">{noResultsTitle}</h3>
+ <p class="text-muted-foreground text-sm sm:text-base">{noResultsDescription}</p>
+ </div>
+ {:else}
+ <div class="space-y-4 sm:space-y-6">
+ {#each categorySearch.searchResults as result (result.id)}
+ {@const Icon = result.icon}
+ <div class={resultCardClass}>
+ <div class="border-b p-4 sm:p-6">
+ <div class="flex items-center justify-between">
+ <div class="flex items-center gap-3">
+ <Icon class="text-primary size-4 shrink-0 sm:size-5" />
+ <div>
+ <h3 class="text-base font-semibold sm:text-lg">{result.title}</h3>
+ <p class="text-muted-foreground text-xs sm:text-sm">{result.description}</p>
+ </div>
+ </div>
+ <ArcaneButton
+ action="base"
+ tone={goToPageButtonTone}
+ size="sm"
+ onclick={() => navigate(result.href)}
+ class="shrink-0"
+ customLabel={goToPageLabel}
+ />
+ </div>
+ </div>
+
+ <!-- Show matching items with descriptions -->
+ {#if result.matchingItems && result.matchingItems.length > 0}
+ <div class="space-y-3 p-4 sm:p-6">
+ <h4 class="text-muted-foreground mb-3 text-sm font-medium">{matchingItemsLabel}</h4>
+ {#each result.matchingItems as item (item.key)}
+ <div class="bg-background/60 border-primary/20 rounded-md border-l-2 p-3">
+ <div class="flex items-start justify-between gap-3">
+ <div class="min-w-0 flex-1">
+ <h5 class="text-sm font-medium">{item.label}</h5>
+ {#if item.description}
+ <p class="text-muted-foreground mt-1 text-xs">{item.description}</p>
+ {/if}
+ {#if item.keywords && item.keywords.length > 0}
+ <div class="mt-2 flex flex-wrap gap-1">
+ {#each item.keywords.slice(0, 6) as keyword (keyword)}
+ <span class="bg-muted/50 text-muted-foreground rounded px-2 py-0.5 text-xs">
+ {keyword}
+ </span>
+ {/each}
+ {#if item.keywords.length > 6}
+ <span class="text-muted-foreground px-2 py-0.5 text-xs">
+ {@render moreKeywords(item.keywords.length - 6)}
+ </span>
+ {/if}
+ </div>
+ {/if}
+ </div>
+ <div class="bg-muted/30 text-muted-foreground shrink-0 rounded px-2 py-1 font-mono text-xs">
+ {item.type}
+ </div>
+ </div>
+ </div>
+ {/each}
+ </div>
+ {/if}
+ </div>
+ {/each}
+ </div>
+ {/if}
+ </div>
+ {/if}
+</div>
diff --git a/frontend/src/lib/components/category-index-page.types.ts b/frontend/src/lib/components/category-index-page.types.ts
new file mode 100644
index 000000000..00e31618d
--- /dev/null
+++ b/frontend/src/lib/components/category-index-page.types.ts
@@ -0,0 +1,22 @@
+import type { Component } from 'svelte';
+
+// Normalized meta shape for a matching item within a search result.
+export interface CategoryMatchingItem {
+ key: string;
+ label: string;
+ type: string;
+ keywords?: string[];
+ description?: string;
+}
+
+// Normalized category / search-result shape shared by both index pages.
+export interface NormalizedCategory {
+ id: string;
+ title: string;
+ description: string;
+ icon: Component;
+ // Resolved navigation target (customize uses category.url directly,
+ // settings resolves some ids to a different url — both flatten to this).
+ href: string;
+ matchingItems?: CategoryMatchingItem[];
+}
diff --git a/frontend/src/lib/components/code-editor/theme.ts b/frontend/src/lib/components/code-editor/theme.ts
index aa281aa12..b8a1dc3e4 100644
--- a/frontend/src/lib/components/code-editor/theme.ts
+++ b/frontend/src/lib/components/code-editor/theme.ts
@@ -28,114 +28,108 @@ function getAccentColorWithAlpha(alpha: number): string {
return accentColor;
}
-export const arcaneDarkInit = (options?: Partial<CreateThemeOptions>) => {
- const { theme = 'dark', settings = {}, styles = [] } = options || {};
-
- const accentColor = getAccentColor();
- const accentWithAlpha35 = getAccentColorWithAlpha(0.35);
- const accentWithAlpha15 = getAccentColorWithAlpha(0.15);
- const accentWithAlpha05 = getAccentColorWithAlpha(0.05);
-
- const dynamicSettings: CreateThemeOptions['settings'] = {
- background: '#0d1117',
- foreground: '#c9d1d9',
- caret: accentColor,
- selection: accentWithAlpha35,
- selectionMatch: accentWithAlpha15,
- lineHighlight: accentWithAlpha05,
- gutterBackground: '#0d1117',
- gutterForeground: '#8b949e',
- gutterActiveForeground: '#c9d1d9',
- gutterBorder: 'transparent',
-
- fontFamily: '"Mona Sans Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", "Courier New", monospace',
- fontSize: '13px'
- };
-
- const dynamicStyles: CreateThemeOptions['styles'] = [
- { tag: [t.comment, t.meta], color: '#8b949e' },
- { tag: [t.keyword, t.modifier, t.operatorKeyword], color: '#ff7b72' },
-
- { tag: [t.typeName, t.namespace, t.number, t.atom, t.bool], color: '#ffa657' },
- { tag: [t.function(t.variableName), t.labelName], color: accentColor },
- {
- tag: [t.className, t.definition(t.variableName), t.propertyName, t.attributeName],
- color: '#d2a8ff'
- },
-
- { tag: [t.variableName, t.name], color: '#e6edf3' },
- { tag: [t.string, t.inserted, t.regexp, t.special(t.string)], color: '#7ee787' },
- { tag: [t.operator, t.url, t.link, t.escape], color: '#a5d6ff' },
-
- { tag: [t.separator, t.punctuation], color: '#6e7681' },
-
- { tag: t.heading, color: '#e6edf3', fontWeight: 'bold' },
- { tag: t.strong, fontWeight: 'bold' },
- { tag: t.emphasis, fontStyle: 'italic' },
- { tag: t.strikethrough, textDecoration: 'line-through' },
- { tag: t.invalid, color: '#f85149' },
- { tag: t.link, textDecoration: 'underline' }
- ];
-
- return createTheme({
- theme,
- settings: { ...dynamicSettings, ...settings },
- styles: [...dynamicStyles, ...styles]
- });
-};
-
-export const arcaneLightInit = (options?: Partial<CreateThemeOptions>) => {
- const { theme = 'light', settings = {}, styles = [] } = options || {};
+interface ArcaneThemePalette {
+ theme: 'dark' | 'light';
+ background: string;
+ foreground: string;
+ gutterForeground: string;
+ comment: string;
+ keyword: string;
+ typeName: string;
+ className: string;
+ variableName: string;
+ string: string;
+ operator: string;
+ separator: string;
+ invalid: string;
+}
- const accentColor = getAccentColor();
- const accentWithAlpha35 = getAccentColorWithAlpha(0.35);
- const accentWithAlpha15 = getAccentColorWithAlpha(0.15);
- const accentWithAlpha05 = getAccentColorWithAlpha(0.05);
-
- const dynamicSettings: CreateThemeOptions['settings'] = {
- background: '#ffffff',
- foreground: '#24292f',
- caret: accentColor,
- selection: accentWithAlpha35,
- selectionMatch: accentWithAlpha15,
- lineHighlight: accentWithAlpha05,
- gutterBackground: '#ffffff',
- gutterForeground: '#8c959f',
- gutterActiveForeground: '#24292f',
- gutterBorder: 'transparent',
-
- fontFamily: '"Mona Sans Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", "Courier New", monospace',
- fontSize: '13px'
+function createArcaneThemeInit(palette: ArcaneThemePalette) {
+ return (options?: Partial<CreateThemeOptions>) => {
+ const { theme = palette.theme, settings = {}, styles = [] } = options || {};
+
+ const accentColor = getAccentColor();
+ const accentWithAlpha35 = getAccentColorWithAlpha(0.35);
+ const accentWithAlpha15 = getAccentColorWithAlpha(0.15);
+ const accentWithAlpha05 = getAccentColorWithAlpha(0.05);
+
+ const dynamicSettings: CreateThemeOptions['settings'] = {
+ background: palette.background,
+ foreground: palette.foreground,
+ caret: accentColor,
+ selection: accentWithAlpha35,
+ selectionMatch: accentWithAlpha15,
+ lineHighlight: accentWithAlpha05,
+ gutterBackground: palette.background,
+ gutterForeground: palette.gutterForeground,
+ gutterActiveForeground: palette.foreground,
+ gutterBorder: 'transparent',
+
+ fontFamily: '"Mona Sans Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", "Courier New", monospace',
+ fontSize: '13px'
+ };
+
+ const dynamicStyles: CreateThemeOptions['styles'] = [
+ { tag: [t.comment, t.meta], color: palette.comment },
+ { tag: [t.keyword, t.modifier, t.operatorKeyword], color: palette.keyword },
+
+ { tag: [t.typeName, t.namespace, t.number, t.atom, t.bool], color: palette.typeName },
+ { tag: [t.function(t.variableName), t.labelName], color: accentColor },
+ {
+ tag: [t.className, t.definition(t.variableName), t.propertyName, t.attributeName],
+ color: palette.className
+ },
+
+ { tag: [t.variableName, t.name], color: palette.variableName },
+ { tag: [t.string, t.inserted, t.regexp, t.special(t.string)], color: palette.string },
+ { tag: [t.operator, t.url, t.link, t.escape], color: palette.operator },
+
+ { tag: [t.separator, t.punctuation], color: palette.separator },
+
+ { tag: t.heading, color: palette.variableName, fontWeight: 'bold' },
+ { tag: t.strong, fontWeight: 'bold' },
+ { tag: t.emphasis, fontStyle: 'italic' },
+ { tag: t.strikethrough, textDecoration: 'line-through' },
+ { tag: t.invalid, color: palette.invalid },
+ { tag: t.link, textDecoration: 'underline' }
+ ];
+
+ return createTheme({
+ theme,
+ settings: { ...dynamicSettings, ...settings },
+ styles: [...dynamicStyles, ...styles]
+ });
};
+}
- const dynamicStyles: CreateThemeOptions['styles'] = [
- { tag: [t.comment, t.meta], color: '#6e7781' },
- { tag: [t.keyword, t.modifier, t.operatorKeyword], color: '#cf222e' },
-
- { tag: [t.typeName, t.namespace, t.number, t.atom, t.bool], color: '#953800' },
- { tag: [t.function(t.variableName), t.labelName], color: accentColor },
- {
- tag: [t.className, t.definition(t.variableName), t.propertyName, t.attributeName],
- color: '#8250df'
- },
-
- { tag: [t.variableName, t.name], color: '#24292f' },
- { tag: [t.string, t.inserted, t.regexp, t.special(t.string)], color: '#0a3069' },
- { tag: [t.operator, t.url, t.link, t.escape], color: '#0550ae' },
-
- { tag: [t.separator, t.punctuation], color: '#6e7781' },
-
- { tag: t.heading, color: '#24292f', fontWeight: 'bold' },
- { tag: t.strong, fontWeight: 'bold' },
- { tag: t.emphasis, fontStyle: 'italic' },
- { tag: t.strikethrough, textDecoration: 'line-through' },
- { tag: t.invalid, color: '#cf222e' },
- { tag: t.link, textDecoration: 'underline' }
- ];
-
- return createTheme({
- theme,
- settings: { ...dynamicSettings, ...settings },
- styles: [...dynamicStyles, ...styles]
- });
-};
+export const arcaneDarkInit = createArcaneThemeInit({
+ theme: 'dark',
+ background: '#0d1117',
+ foreground: '#c9d1d9',
+ gutterForeground: '#8b949e',
+ comment: '#8b949e',
+ keyword: '#ff7b72',
+ typeName: '#ffa657',
+ className: '#d2a8ff',
+ variableName: '#e6edf3',
+ string: '#7ee787',
+ operator: '#a5d6ff',
+ separator: '#6e7681',
+ invalid: '#f85149'
+});
+
+export const arcaneLightInit = createArcaneThemeInit({
+ theme: 'light',
+ background: '#ffffff',
+ foreground: '#24292f',
+ gutterForeground: '#8c959f',
+ comment: '#6e7781',
+ keyword: '#cf222e',
+ typeName: '#953800',
+ className: '#8250df',
+ variableName: '#24292f',
+ string: '#0a3069',
+ operator: '#0550ae',
+ separator: '#6e7781',
+ invalid: '#cf222e'
+});
diff --git a/frontend/src/lib/components/compose-create-menu.svelte b/frontend/src/lib/components/compose-create-menu.svelte
new file mode 100644
index 000000000..4123d4ae3
--- /dev/null
+++ b/frontend/src/lib/components/compose-create-menu.svelte
@@ -0,0 +1,163 @@
+<!--
+ compose-create-menu — the split-button + dropdown "create" menu shared by the
+ new-project and new-swarm-stack compose pages. The primary button submits the
+ form; the dropdown exposes template / docker-run / git-repo actions plus a
+ "create template" item.
+
+ Every label and action is passed in so this component owns no message keys and
+ no business logic — it purely renders the shared chrome.
+-->
+<script lang="ts">
+ import { ArcaneButton } from '$lib/components/arcane-button/index.js';
+ import { Spinner } from '$lib/components/ui/spinner/index.js';
+ import * as ArcaneTooltip from '$lib/components/arcane-tooltip';
+ import * as ButtonGroup from '$lib/components/ui/button-group/index.js';
+ import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
+ import IfPermitted from '$lib/components/if-permitted.svelte';
+ import { TerminalIcon, TemplateIcon, AddIcon, ArrowDownIcon as ChevronDown, GitBranchIcon } from '$lib/icons';
+ import { dropdownContentClass, dropdownItemClass, templateBtnClass } from '$lib/utils/compose-flow';
+
+ interface Props {
+ // Tooltip shows when the tooltipOpen prop is truthy-undefined (bits-ui
+ // convention: `undefined` = auto/hover, `false` = force-closed).
+ tooltipOpen: boolean | undefined;
+ tooltipTitle: string;
+ tooltipDescription: string;
+ tooltipExample: string;
+ // Show the tooltip body only when the name is still empty.
+ tooltipVisible: boolean;
+
+ // Primary create button.
+ showCreateButton?: boolean;
+ createDisabled: boolean;
+ createLoading: boolean;
+ createLabel: string;
+ createLoadingLabel: string;
+ onCreate: () => void;
+
+ // Dropdown items.
+ itemsDisabled: boolean;
+ useTemplateLabel: string;
+ onUseTemplate: () => void;
+ convertLabel: string;
+ onConvert: () => void;
+ fromGitLabel: string;
+ onFromGit: () => void | Promise<void>;
+
+ // Create-template item.
+ createTemplateLabel: string;
+ createTemplateDisabled: boolean;
+ createTemplateLoading: boolean;
+ onCreateTemplate: () => void;
+ // When set, the create-template item is gated behind this RBAC permission
+ // (with a leading separator), matching the new-project page. When omitted,
+ // the item renders unconditionally (new-swarm-stack page).
+ createTemplatePermission?: string;
+ }
+
+ let {
+ tooltipOpen,
+ tooltipTitle,
+ tooltipDescription,
+ tooltipExample,
+ tooltipVisible,
+ showCreateButton = true,
+ createDisabled,
+ createLoading,
+ createLabel,
+ createLoadingLabel,
+ onCreate,
+ itemsDisabled,
+ useTemplateLabel,
+ onUseTemplate,
+ convertLabel,
+ onConvert,
+ fromGitLabel,
+ onFromGit,
+ createTemplateLabel,
+ createTemplateDisabled,
+ createTemplateLoading,
+ onCreateTemplate,
+ createTemplatePermission
+ }: Props = $props();
+</script>
+
+{#snippet createTemplateItem()}
+ <DropdownMenu.Item class={dropdownItemClass} disabled={createTemplateDisabled} onclick={onCreateTemplate}>
+ {#if createTemplateLoading}
+ <Spinner class="size-4" />
+ {:else}
+ <AddIcon class="size-4" />
+ {/if}
+ {createTemplateLabel}
+ </DropdownMenu.Item>
+{/snippet}
+
+<ButtonGroup.Root>
+ <ArcaneTooltip.Root open={tooltipOpen}>
+ <ArcaneTooltip.Trigger>
+ <span>
+ {#if showCreateButton}
+ <ArcaneButton
+ action="create"
+ tone="ghost"
+ disabled={createDisabled}
+ onclick={onCreate}
+ class={`${templateBtnClass} gap-2 rounded-r-none`}
+ loading={createLoading}
+ customLabel={createLabel}
+ loadingLabel={createLoadingLabel}
+ />
+ {/if}
+ </span>
+ </ArcaneTooltip.Trigger>
+ <ArcaneTooltip.Content class="arcane-tooltip-content max-w-[280px]">
+ {#if tooltipVisible}
+ <p class="mb-1 text-sm font-medium">{tooltipTitle}</p>
+ <p class="text-muted-foreground text-xs">{tooltipDescription}</p>
+ <p class="bg-muted mt-1.5 inline-block rounded px-1.5 py-0.5 font-mono text-xs">
+ {tooltipExample}
+ </p>
+ {/if}
+ </ArcaneTooltip.Content>
+ </ArcaneTooltip.Root>
+
+ <DropdownMenu.Root>
+ <DropdownMenu.Trigger>
+ {#snippet child({ props })}
+ <ArcaneButton
+ {...props}
+ action="base"
+ tone="ghost"
+ class={`${templateBtnClass} -ml-px rounded-l-none px-2`}
+ icon={ChevronDown}
+ />
+ {/snippet}
+ </DropdownMenu.Trigger>
+ <DropdownMenu.Content align="end" class={dropdownContentClass}>
+ <DropdownMenu.Group>
+ <DropdownMenu.Item class={dropdownItemClass} disabled={itemsDisabled} onclick={onUseTemplate}>
+ <TemplateIcon class="size-4" />
+ {useTemplateLabel}
+ </DropdownMenu.Item>
+ <DropdownMenu.Item class={dropdownItemClass} onclick={onConvert}>
+ <TerminalIcon class="size-4" />
+ {convertLabel}
+ </DropdownMenu.Item>
+ <DropdownMenu.Item class={dropdownItemClass} onclick={onFromGit}>
+ <GitBranchIcon class="size-4" />
+ {fromGitLabel}
+ </DropdownMenu.Item>
+ {#if createTemplatePermission}
+ <IfPermitted perm={createTemplatePermission}>
+ <DropdownMenu.Separator />
+ {@render createTemplateItem()}
+ </IfPermitted>
+ {:else}
+ <DropdownMenu.Separator />
+ {@render createTemplateItem()}
+ {/if}
+ </DropdownMenu.Group>
+ </DropdownMenu.Content>
+ </DropdownMenu.Root>
+</ButtonGroup.Root>
diff --git a/frontend/src/lib/components/compose-file-editor-panel.svelte b/frontend/src/lib/components/compose-file-editor-panel.svelte
new file mode 100644
index 000000000..49f172fc1
--- /dev/null
+++ b/frontend/src/lib/components/compose-file-editor-panel.svelte
@@ -0,0 +1,74 @@
+<!--
+ compose-file-editor-panel — the row of editor toolbar buttons rendered inside
+ the tab strip of the tree-layout compose editor (outline toggle, optional diff
+ toggle, command-palette open). Shared by the new-project, edit-project, and
+ new-swarm-stack compose pages.
+
+ The buttons are the only markup that was duplicated verbatim across all three
+ pages; the surrounding ResizableSplit + file tree + CodePanel wiring is kept in
+ each page because its bindings (compose/env value + validation state, per-file
+ content, read-only + diff + load-error handling, persistKey, resize callbacks)
+ differ per page and cannot be unified without changing behavior.
+-->
+<script lang="ts">
+ import { ArcaneButton } from '$lib/components/arcane-button/index.js';
+ import { ArrowsUpDownIcon, FileTextIcon, SearchIcon } from '$lib/icons';
+
+ interface Props {
+ outlineOpen: boolean;
+ outlineLabel: string;
+ onToggleOutline: () => void;
+ // When showDiff is false the diff toggle is omitted (new-swarm-stack page).
+ showDiff?: boolean;
+ diffOpen?: boolean;
+ diffLabel?: string;
+ onToggleDiff?: () => void;
+ commandPaletteLabel: string;
+ onOpenCommandPalette: () => void;
+ }
+
+ let {
+ outlineOpen,
+ outlineLabel,
+ onToggleOutline,
+ showDiff = true,
+ diffOpen = false,
+ diffLabel,
+ onToggleDiff,
+ commandPaletteLabel,
+ onOpenCommandPalette
+ }: Props = $props();
+</script>
+
+<ArcaneButton
+ action="base"
+ tone={outlineOpen ? 'outline-primary' : 'ghost'}
+ size="icon"
+ class="size-6"
+ showLabel={false}
+ icon={FileTextIcon}
+ customLabel={outlineLabel}
+ onclick={onToggleOutline}
+/>
+{#if showDiff}
+ <ArcaneButton
+ action="base"
+ tone={diffOpen ? 'outline-primary' : 'ghost'}
+ size="icon"
+ class="size-6"
+ showLabel={false}
+ icon={ArrowsUpDownIcon}
+ customLabel={diffLabel}
+ onclick={onToggleDiff}
+ />
+{/if}
+<ArcaneButton
+ action="base"
+ tone="ghost"
+ size="icon"
+ class="size-6"
+ showLabel={false}
+ icon={SearchIcon}
+ customLabel={commandPaletteLabel}
+ onclick={onOpenCommandPalette}
+/>
diff --git a/frontend/src/lib/components/detail-card-empty.svelte b/frontend/src/lib/components/detail-card-empty.svelte
new file mode 100644
index 000000000..f9bc0a3dd
--- /dev/null
+++ b/frontend/src/lib/components/detail-card-empty.svelte
@@ -0,0 +1,12 @@
+<script lang="ts">
+ interface Props {
+ message: string;
+ padding?: string;
+ }
+
+ let { message, padding = 'py-12' }: Props = $props();
+</script>
+
+<div class="text-muted-foreground rounded-lg border border-dashed {padding} text-center">
+ <div class="text-sm">{message}</div>
+</div>
diff --git a/frontend/src/lib/components/detail-section-card.svelte b/frontend/src/lib/components/detail-section-card.svelte
new file mode 100644
index 000000000..fc526df9d
--- /dev/null
+++ b/frontend/src/lib/components/detail-section-card.svelte
@@ -0,0 +1,30 @@
+<script lang="ts">
+ import * as Card from '$lib/components/ui/card';
+ import type { Snippet } from 'svelte';
+
+ interface Props {
+ icon: any;
+ title: string;
+ description?: string;
+ id?: string;
+ children: Snippet;
+ }
+
+ let { icon, title, description, id, children }: Props = $props();
+</script>
+
+<Card.Root {id}>
+ <Card.Header {icon}>
+ <div class="flex flex-col space-y-1.5">
+ <Card.Title>
+ <h2>{title}</h2>
+ </Card.Title>
+ {#if description}
+ <Card.Description>{description}</Card.Description>
+ {/if}
+ </div>
+ </Card.Header>
+ <Card.Content class="p-4">
+ {@render children()}
+ </Card.Content>
+</Card.Root>
diff --git a/frontend/src/lib/components/dialogs/create-container-dialog.svelte b/frontend/src/lib/components/dialogs/create-container-dialog.svelte
index 84b0fb77e..f18d1c1fb 100644
--- a/frontend/src/lib/components/dialogs/create-container-dialog.svelte
+++ b/frontend/src/lib/components/dialogs/create-container-dialog.svelte
@@ -138,6 +138,7 @@
return result;
}
+ // fallow-ignore-next-line code-duplication add/remove row-editor; divergent state shape from customize/variables
function addEnvVar() {
envVars = [...envVars, { key: '', value: '' }];
}
diff --git a/frontend/src/lib/components/dialogs/create-service-dialog.svelte b/frontend/src/lib/components/dialogs/create-service-dialog.svelte
deleted file mode 100644
index 881796fe3..000000000
--- a/frontend/src/lib/components/dialogs/create-service-dialog.svelte
+++ /dev/null
@@ -1,374 +0,0 @@
-<script lang="ts">
- import { ResponsiveDialog } from '$lib/components/ui/responsive-dialog/index.js';
- import { ArcaneButton } from '$lib/components/arcane-button/index.js';
- import { Input } from '$lib/components/ui/input/index.js';
- import * as Select from '$lib/components/ui/select/index.js';
- import { z } from 'zod/v4';
- import { createForm, preventDefault } from '$lib/utils/settings';
- import { m } from '$lib/paraglide/messages';
- import { AddIcon, TrashIcon } from '$lib/icons';
- import * as Accordion from '$lib/components/ui/accordion/index.js';
- import FormInput from '$lib/components/form/form-input.svelte';
- import type { SwarmServiceCreateSpec } from '$lib/types/swarm';
-
- type CreateServiceDialogProps = {
- open: boolean;
- onSubmit: (spec: SwarmServiceCreateSpec) => void;
- isLoading: boolean;
- };
-
- let { open = $bindable(false), onSubmit, isLoading }: CreateServiceDialogProps = $props();
-
- const formSchema = z.object({
- name: z.string().min(1, m.common_name_required()),
- image: z.string().min(1, m.swarm_service_form_image_required()),
- replicas: z.coerce.number().int().min(0).default(1)
- });
-
- const formData = {
- name: '',
- image: '',
- replicas: 1
- };
-
- let { inputs, ...form } = $derived(createForm<typeof formSchema>(formSchema, formData));
- let mode = $state<'replicated' | 'global'>('replicated');
- let command = $state({ value: '', error: '' });
- let args = $state({ value: '', error: '' });
- let workingDir = $state({ value: '', error: '' });
- let user = $state({ value: '', error: '' });
- let hostname = $state({ value: '', error: '' });
- let ports = $state<Array<{ target: string; published: string; protocol: 'tcp' | 'udp' }>>([]);
- let envVars = $state<Array<{ key: string; value: string }>>([]);
- let mounts = $state<Array<{ type: 'volume' | 'bind'; source: string; target: string }>>([]);
- let labels = $state<Array<{ key: string; value: string }>>([]);
-
- function addPort() {
- ports = [...ports, { target: '', published: '', protocol: 'tcp' }];
- }
-
- function removePort(index: number) {
- ports = ports.filter((_, i) => i !== index);
- }
-
- function addEnvVar() {
- envVars = [...envVars, { key: '', value: '' }];
- }
-
- function removeEnvVar(index: number) {
- envVars = envVars.filter((_, i) => i !== index);
- }
-
- function addMount() {
- mounts = [...mounts, { type: 'volume', source: '', target: '' }];
- }
-
- function removeMount(index: number) {
- mounts = mounts.filter((_, i) => i !== index);
- }
-
- function addLabel() {
- labels = [...labels, { key: '', value: '' }];
- }
-
- function removeLabel(index: number) {
- labels = labels.filter((_, i) => i !== index);
- }
-
- function handleSubmit() {
- const validated = form.validate();
- if (!validated) return;
-
- const { name, image, replicas } = validated;
-
- const spec: SwarmServiceCreateSpec = {
- Name: name,
- TaskTemplate: {
- ContainerSpec: {
- Image: image
- }
- },
- Mode: mode === 'replicated' ? { Replicated: { Replicas: replicas } } : { Global: {} }
- };
-
- // Add optional container config
- if (command.value.trim()) {
- spec.TaskTemplate.ContainerSpec.Command = command.value.trim().split(' ').filter(Boolean);
- }
- if (args.value.trim()) {
- spec.TaskTemplate.ContainerSpec.Args = args.value.trim().split(' ').filter(Boolean);
- }
- if (workingDir.value.trim()) {
- spec.TaskTemplate.ContainerSpec.Dir = workingDir.value.trim();
- }
- if (user.value.trim()) {
- spec.TaskTemplate.ContainerSpec.User = user.value.trim();
- }
- if (hostname.value.trim()) {
- spec.TaskTemplate.ContainerSpec.Hostname = hostname.value.trim();
- }
-
- // Add environment variables
- if (envVars.length > 0) {
- const filtered = envVars.filter((e) => e.key.trim());
- if (filtered.length > 0) {
- spec.TaskTemplate.ContainerSpec.Env = filtered.map((e) => `${e.key}=${e.value}`);
- }
- }
-
- // Add mounts
- if (mounts.length > 0) {
- const filtered = mounts.filter((m) => m.source.trim() && m.target.trim());
- if (filtered.length > 0) {
- spec.TaskTemplate.ContainerSpec.Mounts = filtered.map((m) => ({
- Type: m.type,
- Source: m.source,
- Target: m.target
- }));
- }
- }
-
- // Add labels
- if (labels.length > 0) {
- const filtered = labels.filter((l) => l.key.trim());
- if (filtered.length > 0) {
- const labelsRecord: Record<string, string> = {};
- filtered.forEach((l) => {
- labelsRecord[l.key] = l.value;
- });
- spec.Labels = labelsRecord;
- }
- }
-
- // Add ports
- if (ports.length > 0) {
- const filtered = ports.filter((p) => p.target.trim());
- if (filtered.length > 0) {
- spec.EndpointSpec = {
- Ports: filtered.map((p) => ({
- TargetPort: parseInt(p.target),
- PublishedPort: p.published ? parseInt(p.published) : undefined,
- Protocol: p.protocol
- }))
- };
- }
- }
-
- onSubmit(spec);
- }
-
- function handleOpenChange(newOpenState: boolean) {
- open = newOpenState;
- if (!newOpenState) {
- form.reset();
- mode = 'replicated';
- command.value = '';
- args.value = '';
- workingDir.value = '';
- user.value = '';
- hostname.value = '';
- ports = [];
- envVars = [];
- mounts = [];
- labels = [];
- }
- }
-</script>
-
-<ResponsiveDialog
- {open}
- onOpenChange={handleOpenChange}
- variant="sheet"
- title={m.swarm_service_create_title()}
- description={m.swarm_service_create_description()}
- contentClass="sm:max-w-[600px]"
->
- {#snippet children()}
- <form onsubmit={preventDefault(handleSubmit)} class="space-y-6 py-4">
- <!-- Basic Config -->
- <div class="space-y-4">
- <FormInput input={$inputs.name} label={m.common_name()} placeholder="my-service" disabled={isLoading} />
- <FormInput
- input={$inputs.image}
- label={m.swarm_service_form_image_label()}
- placeholder={m.swarm_service_form_image_placeholder()}
- disabled={isLoading}
- />
- </div>
-
- <div class="grid grid-cols-2 gap-4">
- <FormInput label={m.swarm_mode()}>
- {#snippet children()}
- <Select.Root type="single" bind:value={mode} disabled={isLoading}>
- <Select.Trigger class="w-full">
- <span class="capitalize"
- >{mode === 'replicated' ? m.swarm_service_mode_replicated() : m.swarm_service_mode_global()}</span
- >
- </Select.Trigger>
- <Select.Content>
- <Select.Item value="replicated" label={m.swarm_service_mode_replicated()}
- >{m.swarm_service_mode_replicated()}</Select.Item
- >
- <Select.Item value="global" label={m.swarm_service_mode_global()}>{m.swarm_service_mode_global()}</Select.Item>
- </Select.Content>
- </Select.Root>
- {/snippet}
- </FormInput>
-
- {#if mode === 'replicated'}
- <FormInput input={$inputs.replicas} label={m.swarm_replicas()} type="number" disabled={isLoading} />
- {/if}
- </div>
-
- <Accordion.Root class="w-full space-y-5" type="multiple">
- <Accordion.Item value="ports">
- <Accordion.Trigger class="text-sm font-medium">{m.swarm_service_form_ports()}</Accordion.Trigger>
- <Accordion.Content class="pt-6 pb-5">
- <div class="space-y-4">
- {#each ports as port, i (i)}
- <div class="flex items-center gap-4">
- <Input placeholder="8080" bind:value={port.target} disabled={isLoading} class="flex-1" />
- <span class="text-muted-foreground">:</span>
- <Input placeholder="80" bind:value={port.published} disabled={isLoading} class="flex-1" />
- <Select.Root type="single" bind:value={port.protocol} disabled={isLoading}>
- <Select.Trigger class="w-20">
- <span class="uppercase">{port.protocol}</span>
- </Select.Trigger>
- <Select.Content>
- <Select.Item value="tcp" label="TCP">TCP</Select.Item>
- <Select.Item value="udp" label="UDP">UDP</Select.Item>
- </Select.Content>
- </Select.Root>
- <ArcaneButton action="remove" size="sm" onclick={() => removePort(i)} disabled={isLoading} icon={TrashIcon} />
- </div>
- {/each}
- <ArcaneButton
- action="create"
- size="sm"
- onclick={addPort}
- disabled={isLoading}
- icon={AddIcon}
- customLabel={m.swarm_service_form_add_port()}
- />
- </div>
- </Accordion.Content>
- </Accordion.Item>
-
- <Accordion.Item value="env">
- <Accordion.Trigger class="text-sm font-medium">{m.swarm_service_form_env_vars()}</Accordion.Trigger>
- <Accordion.Content class="pt-6 pb-5">
- <div class="space-y-4">
- {#each envVars as env, i (i)}
- <div class="flex items-center gap-4">
- <Input placeholder="KEY" bind:value={env.key} disabled={isLoading} class="flex-1" />
- <span class="text-muted-foreground">=</span>
- <Input placeholder="value" bind:value={env.value} disabled={isLoading} class="flex-1" />
- <ArcaneButton action="remove" size="sm" onclick={() => removeEnvVar(i)} disabled={isLoading} icon={TrashIcon} />
- </div>
- {/each}
- <ArcaneButton
- action="create"
- size="sm"
- onclick={addEnvVar}
- disabled={isLoading}
- icon={AddIcon}
- customLabel={m.swarm_service_form_add_variable()}
- />
- </div>
- </Accordion.Content>
- </Accordion.Item>
-
- <Accordion.Item value="mounts">
- <Accordion.Trigger class="text-sm font-medium">{m.swarm_service_form_mounts()}</Accordion.Trigger>
- <Accordion.Content class="pt-6 pb-5">
- <div class="space-y-4">
- {#each mounts as mount, i (i)}
- <div class="flex items-center gap-4">
- <Select.Root type="single" bind:value={mount.type} disabled={isLoading}>
- <Select.Trigger class="w-24">
- <span class="capitalize">{mount.type}</span>
- </Select.Trigger>
- <Select.Content>
- <Select.Item value="volume" label="Volume">Volume</Select.Item>
- <Select.Item value="bind" label="Bind">Bind</Select.Item>
- </Select.Content>
- </Select.Root>
- <Input placeholder="source" bind:value={mount.source} disabled={isLoading} class="flex-1" />
- <span class="text-muted-foreground">→</span>
- <Input placeholder="/target" bind:value={mount.target} disabled={isLoading} class="flex-1" />
- <ArcaneButton action="remove" size="sm" onclick={() => removeMount(i)} disabled={isLoading} icon={TrashIcon} />
- </div>
- {/each}
- <ArcaneButton
- action="create"
- size="sm"
- onclick={addMount}
- disabled={isLoading}
- icon={AddIcon}
- customLabel={m.swarm_service_form_add_mount()}
- />
- </div>
- </Accordion.Content>
- </Accordion.Item>
-
- <Accordion.Item value="labels">
- <Accordion.Trigger class="text-sm font-medium">{m.swarm_service_form_labels()}</Accordion.Trigger>
- <Accordion.Content class="pt-6 pb-5">
- <div class="space-y-4">
- {#each labels as label, i (i)}
- <div class="flex items-center gap-4">
- <Input placeholder="key" bind:value={label.key} disabled={isLoading} class="flex-1" />
- <span class="text-muted-foreground">=</span>
- <Input placeholder="value" bind:value={label.value} disabled={isLoading} class="flex-1" />
- <ArcaneButton action="remove" size="sm" onclick={() => removeLabel(i)} disabled={isLoading} icon={TrashIcon} />
- </div>
- {/each}
- <ArcaneButton
- action="create"
- size="sm"
- onclick={addLabel}
- disabled={isLoading}
- icon={AddIcon}
- customLabel={m.swarm_service_form_add_label()}
- />
- </div>
- </Accordion.Content>
- </Accordion.Item>
-
- <Accordion.Item value="advanced">
- <Accordion.Trigger class="text-sm font-medium">{m.swarm_service_form_advanced()}</Accordion.Trigger>
- <Accordion.Content class="pt-6 pb-5">
- <div class="space-y-5">
- <FormInput input={command} label={m.swarm_service_form_command()} placeholder="/bin/sh" disabled={isLoading} />
- <FormInput input={args} label={m.swarm_service_form_arguments()} placeholder="-c echo hello" disabled={isLoading} />
- <FormInput input={workingDir} label={m.swarm_service_form_working_dir()} placeholder="/app" disabled={isLoading} />
- <FormInput input={user} label={m.swarm_service_form_user()} placeholder="1000:1000" disabled={isLoading} />
- <FormInput input={hostname} label={m.swarm_hostname()} placeholder="my-service" disabled={isLoading} />
- </div>
- </Accordion.Content>
- </Accordion.Item>
- </Accordion.Root>
- </form>
- {/snippet}
-
- {#snippet footer()}
- <div class="flex w-full flex-row gap-2">
- <ArcaneButton
- action="cancel"
- tone="ghost"
- type="button"
- class="flex-1"
- onclick={() => (open = false)}
- disabled={isLoading}
- />
- <ArcaneButton
- action="create"
- type="button"
- class="flex-1"
- disabled={isLoading}
- loading={isLoading}
- onclick={handleSubmit}
- />
- </div>
- {/snippet}
-</ResponsiveDialog>
diff --git a/frontend/src/lib/components/dialogs/gitops-dialog-footer.svelte b/frontend/src/lib/components/dialogs/gitops-dialog-footer.svelte
new file mode 100644
index 000000000..39e2a4659
--- /dev/null
+++ b/frontend/src/lib/components/dialogs/gitops-dialog-footer.svelte
@@ -0,0 +1,19 @@
+<script lang="ts">
+ import type { Snippet } from 'svelte';
+ import { Button } from '$lib/components/ui/button/index.js';
+
+ interface Props {
+ cancelLabel: string;
+ isLoading?: boolean;
+ onCancel: () => void;
+ primary: Snippet;
+ }
+
+ let { cancelLabel, isLoading = false, onCancel, primary }: Props = $props();
+</script>
+
+<Button type="button" class="arcane-button-cancel flex-1" variant="outline" onclick={onCancel} disabled={isLoading}>
+ {cancelLabel}
+</Button>
+
+{@render primary()}
diff --git a/frontend/src/lib/components/dialogs/gitops-import-dialog.svelte b/frontend/src/lib/components/dialogs/gitops-import-dialog.svelte
index 64625771c..291283606 100644
--- a/frontend/src/lib/components/dialogs/gitops-import-dialog.svelte
+++ b/frontend/src/lib/components/dialogs/gitops-import-dialog.svelte
@@ -4,6 +4,7 @@
import { Spinner } from '$lib/components/ui/spinner/index.js';
import { Label } from '$lib/components/ui/label/index.js';
import { Textarea } from '$lib/components/ui/textarea/index.js';
+ import GitopsDialogFooter from '$lib/components/dialogs/gitops-dialog-footer.svelte';
import type { ImportGitOpsSyncRequest } from '$lib/types/automation';
import { m } from '$lib/paraglide/messages';
@@ -102,21 +103,15 @@
{/snippet}
{#snippet footer()}
- <Button
- type="button"
- class="arcane-button-cancel flex-1"
- variant="outline"
- onclick={() => (open = false)}
- disabled={isLoading}
- >
- {m.common_cancel()}
- </Button>
-
- <Button onclick={handleSubmit} class="arcane-button-create flex-1" disabled={isLoading}>
- {#if isLoading}
- <Spinner class="mr-2 size-4" />
- {/if}
- {m.git_sync_import_button()}
- </Button>
+ <GitopsDialogFooter cancelLabel={m.common_cancel()} {isLoading} onCancel={() => (open = false)}>
+ {#snippet primary()}
+ <Button onclick={handleSubmit} class="arcane-button-create flex-1" disabled={isLoading}>
+ {#if isLoading}
+ <Spinner class="mr-2 size-4" />
+ {/if}
+ {m.git_sync_import_button()}
+ </Button>
+ {/snippet}
+ </GitopsDialogFooter>
{/snippet}
</ResponsiveDialog>
diff --git a/frontend/src/lib/components/dialogs/gitops-sync-dialog.svelte b/frontend/src/lib/components/dialogs/gitops-sync-dialog.svelte
index ca14ced16..381416ce7 100644
--- a/frontend/src/lib/components/dialogs/gitops-sync-dialog.svelte
+++ b/frontend/src/lib/components/dialogs/gitops-sync-dialog.svelte
@@ -10,6 +10,7 @@
import { Switch } from '$lib/components/ui/switch/index.js';
import { Input } from '$lib/components/ui/input/index.js';
import FileBrowserDialog from '$lib/components/dialogs/file-browser-dialog.svelte';
+ import GitopsDialogFooter from '$lib/components/dialogs/gitops-dialog-footer.svelte';
import type {
FileTreeNode,
GitOpsSync,
@@ -268,6 +269,22 @@
}
</script>
+{#snippet BrowseFilesButton(target: 'compose' | 'preDeployScript')}
+ <Button
+ type="button"
+ variant="outline"
+ size="icon"
+ onclick={() => {
+ fileBrowserTarget = target;
+ showFileBrowser = true;
+ }}
+ disabled={!selectedRepository?.value || !$inputs.branch.value}
+ title={m.git_sync_browse_files_title()}
+ >
+ <FolderOpenIcon class="size-4" />
+ </Button>
+{/snippet}
+
<ResponsiveDialog
bind:open
title={isEditMode ? m.git_sync_edit_title() : m.git_sync_add_title()}
@@ -379,19 +396,7 @@
bind:input={$inputs.composePath}
/>
</div>
- <Button
- type="button"
- variant="outline"
- size="icon"
- onclick={() => {
- fileBrowserTarget = 'compose';
- showFileBrowser = true;
- }}
- disabled={!selectedRepository?.value || !$inputs.branch.value}
- title={m.git_sync_browse_files_title()}
- >
- <FolderOpenIcon class="size-4" />
- </Button>
+ {@render BrowseFilesButton('compose')}
</div>
</div>
</div>
@@ -522,19 +527,7 @@
aria-invalid={$inputs.preDeployScriptPath.error ? 'true' : undefined}
/>
</div>
- <Button
- type="button"
- variant="outline"
- size="icon"
- onclick={() => {
- fileBrowserTarget = 'preDeployScript';
- showFileBrowser = true;
- }}
- disabled={!selectedRepository?.value || !$inputs.branch.value}
- title={m.git_sync_browse_files_title()}
- >
- <FolderOpenIcon class="size-4" />
- </Button>
+ {@render BrowseFilesButton('preDeployScript')}
</div>
<p class="text-muted-foreground text-xs">{m.git_sync_pre_deploy_script_path_help()}</p>
{#if $inputs.preDeployScriptPath.error}
@@ -628,22 +621,16 @@
{/snippet}
{#snippet footer()}
- <Button
- type="button"
- class="arcane-button-cancel flex-1"
- variant="outline"
- onclick={() => (open = false)}
- disabled={isLoading}
- >
- {m.common_cancel()}
- </Button>
-
- <Button type="submit" form="sync-form" class="arcane-button-create flex-1" disabled={isLoading}>
- {#if isLoading}
- <Spinner class="mr-2 size-4" />
- {/if}
- {isEditMode ? m.common_save_changes() : m.common_add_button({ resource: m.resource_sync_cap() })}
- </Button>
+ <GitopsDialogFooter cancelLabel={m.common_cancel()} {isLoading} onCancel={() => (open = false)}>
+ {#snippet primary()}
+ <Button type="submit" form="sync-form" class="arcane-button-create flex-1" disabled={isLoading}>
+ {#if isLoading}
+ <Spinner class="mr-2 size-4" />
+ {/if}
+ {isEditMode ? m.common_save_changes() : m.common_add_button({ resource: m.resource_sync_cap() })}
+ </Button>
+ {/snippet}
+ </GitopsDialogFooter>
{/snippet}
</ResponsiveDialog>
diff --git a/frontend/src/routes/(app)/swarm/services/service-editor-dialog.svelte b/frontend/src/lib/components/dialogs/service-editor-dialog.svelte
similarity index 100%
rename from frontend/src/routes/(app)/swarm/services/service-editor-dialog.svelte
rename to frontend/src/lib/components/dialogs/service-editor-dialog.svelte
diff --git a/frontend/src/lib/components/env-vars-list.svelte b/frontend/src/lib/components/env-vars-list.svelte
new file mode 100644
index 000000000..a68d2cf47
--- /dev/null
+++ b/frontend/src/lib/components/env-vars-list.svelte
@@ -0,0 +1,29 @@
+<script lang="ts">
+ import { KeyValueCard, KeyValueGrid } from '$lib/components/resource-detail';
+
+ interface Props {
+ envVars: string[];
+ nameOnlyLabel: string;
+ valueTitle?: string;
+ }
+
+ let { envVars, nameOnlyLabel, valueTitle }: Props = $props();
+</script>
+
+<KeyValueGrid>
+ {#each envVars as env, index (index)}
+ {#if env.includes('=')}
+ {@const [key, ...valueParts] = env.split('=')}
+ {@const value = valueParts.join('=')}
+ <KeyValueCard label={key ?? ''} {valueTitle}>{value}</KeyValueCard>
+ {:else}
+ <KeyValueCard
+ label={nameOnlyLabel}
+ labelClass="text-muted-foreground text-xs font-semibold tracking-wide uppercase"
+ {valueTitle}
+ >
+ {env}
+ </KeyValueCard>
+ {/if}
+ {/each}
+</KeyValueGrid>
diff --git a/frontend/src/lib/components/file-browser/FileList.svelte b/frontend/src/lib/components/file-browser/FileList.svelte
index cc10c06da..14da94ba3 100644
--- a/frontend/src/lib/components/file-browser/FileList.svelte
+++ b/frontend/src/lib/components/file-browser/FileList.svelte
@@ -5,7 +5,6 @@
FileTextIcon,
DownloadIcon,
TrashIcon,
- EllipsisIcon,
EyeOnIcon,
ClockIcon,
RestartIcon,
@@ -19,7 +18,7 @@
import * as DropdownMenu from '$lib/components/ui/dropdown-menu';
import * as Tooltip from '$lib/components/ui/tooltip';
import { openConfirmDialog } from '$lib/components/confirm-dialog';
- import { ArcaneButton } from '$lib/components/arcane-button';
+ import RowActionsMenu from './row-actions-menu.svelte';
import { bytes } from '$lib/utils/formatting';
import { format } from 'date-fns';
import { activityToastOptions, extractActivityId } from '$lib/utils/activity-toast';
@@ -193,49 +192,31 @@
{/snippet}
{#snippet RowActions({ item }: { item: FileEntry })}
- <DropdownMenu.Root>
- <DropdownMenu.Trigger>
- {#snippet child({ props })}
- <ArcaneButton
- {...props}
- action="base"
- tone="ghost"
- size="icon"
- class="relative size-8 p-0"
- icon={EllipsisIcon}
- showLabel={false}
- customLabel={m.common_open_menu()}
- />
- {/snippet}
- </DropdownMenu.Trigger>
- <DropdownMenu.Content align="end">
- <DropdownMenu.Group>
- {#if !item.isDirectory}
- <DropdownMenu.Item onclick={() => onPreview(item)}>
- <EyeOnIcon class="size-4" />
- {m.common_view()}
- </DropdownMenu.Item>
- <DropdownMenu.Item onclick={() => handleDownload(item)}>
- <DownloadIcon class="size-4" />
- {m.templates_download()}
- </DropdownMenu.Item>
- {#if onRestoreFromBackup && !item.isSymlink}
- <DropdownMenu.Item onclick={() => onRestoreFromBackup(item)}>
- <RestartIcon class="size-4" />
- Restore from backup
- </DropdownMenu.Item>
- {/if}
- <DropdownMenu.Separator />
- {/if}
- {#if onDelete}
- <DropdownMenu.Item variant="destructive" onclick={() => handleDelete(item)}>
- <TrashIcon class="size-4" />
- {m.common_delete()}
- </DropdownMenu.Item>
- {/if}
- </DropdownMenu.Group>
- </DropdownMenu.Content>
- </DropdownMenu.Root>
+ <RowActionsMenu openMenuLabel={m.common_open_menu()}>
+ {#if !item.isDirectory}
+ <DropdownMenu.Item onclick={() => onPreview(item)}>
+ <EyeOnIcon class="size-4" />
+ {m.common_view()}
+ </DropdownMenu.Item>
+ <DropdownMenu.Item onclick={() => handleDownload(item)}>
+ <DownloadIcon class="size-4" />
+ {m.templates_download()}
+ </DropdownMenu.Item>
+ {#if onRestoreFromBackup && !item.isSymlink}
+ <DropdownMenu.Item onclick={() => onRestoreFromBackup(item)}>
+ <RestartIcon class="size-4" />
+ Restore from backup
+ </DropdownMenu.Item>
+ {/if}
+ <DropdownMenu.Separator />
+ {/if}
+ {#if onDelete}
+ <DropdownMenu.Item variant="destructive" onclick={() => handleDelete(item)}>
+ <TrashIcon class="size-4" />
+ {m.common_delete()}
+ </DropdownMenu.Item>
+ {/if}
+ </RowActionsMenu>
{/snippet}
{#snippet FileMobileCardSnippet({
diff --git a/frontend/src/lib/components/file-browser/GenericFileBrowser.svelte b/frontend/src/lib/components/file-browser/GenericFileBrowser.svelte
index 249729192..af959dcd3 100644
--- a/frontend/src/lib/components/file-browser/GenericFileBrowser.svelte
+++ b/frontend/src/lib/components/file-browser/GenericFileBrowser.svelte
@@ -12,6 +12,15 @@
restoreFromBackup?: (backupId: string, path: string) => Promise<unknown>;
backupHasPath?: (backupId: string, path: string) => Promise<boolean>;
}
+
+ // Sorts file entries in place: directories first, then alphabetically by name.
+ export function sortFileEntries(files: FileEntry[]): FileEntry[] {
+ return files.sort((a, b) => {
+ if (a.isDirectory && !b.isDirectory) return -1;
+ if (!a.isDirectory && b.isDirectory) return 1;
+ return a.name.localeCompare(b.name);
+ });
+ }
</script>
<script lang="ts">
@@ -71,11 +80,7 @@
try {
const result = await provider.list(path);
// Sort: directories first, then alphabetically
- files = result.sort((a, b) => {
- if (a.isDirectory && !b.isDirectory) return -1;
- if (!a.isDirectory && b.isDirectory) return 1;
- return a.name.localeCompare(b.name);
- });
+ files = sortFileEntries(result);
currentPath = path;
} catch (e: any) {
error = e.message || m.common_failed();
diff --git a/frontend/src/lib/components/file-browser/index.ts b/frontend/src/lib/components/file-browser/index.ts
index f676e369d..529c4f78d 100644
--- a/frontend/src/lib/components/file-browser/index.ts
+++ b/frontend/src/lib/components/file-browser/index.ts
@@ -7,6 +7,7 @@ import CreateFolderDialog from './CreateFolderDialog.svelte';
import VolumeBrowser from './VolumeBrowser.svelte';
export type { FileProvider } from './GenericFileBrowser.svelte';
+export { sortFileEntries } from './GenericFileBrowser.svelte';
export {
Root,
diff --git a/frontend/src/lib/components/file-browser/row-actions-menu.svelte b/frontend/src/lib/components/file-browser/row-actions-menu.svelte
new file mode 100644
index 000000000..8cf2bbd02
--- /dev/null
+++ b/frontend/src/lib/components/file-browser/row-actions-menu.svelte
@@ -0,0 +1,36 @@
+<script lang="ts">
+ import type { Snippet } from 'svelte';
+ import * as DropdownMenu from '$lib/components/ui/dropdown-menu';
+ import { ArcaneButton } from '$lib/components/arcane-button';
+ import { EllipsisIcon } from '$lib/icons';
+
+ let {
+ openMenuLabel,
+ children
+ }: {
+ openMenuLabel: string;
+ children: Snippet;
+ } = $props();
+</script>
+
+<DropdownMenu.Root>
+ <DropdownMenu.Trigger>
+ {#snippet child({ props })}
+ <ArcaneButton
+ {...props}
+ action="base"
+ tone="ghost"
+ size="icon"
+ class="relative size-8 p-0"
+ icon={EllipsisIcon}
+ showLabel={false}
+ customLabel={openMenuLabel}
+ />
+ {/snippet}
+ </DropdownMenu.Trigger>
+ <DropdownMenu.Content align="end">
+ <DropdownMenu.Group>
+ {@render children()}
+ </DropdownMenu.Group>
+ </DropdownMenu.Content>
+</DropdownMenu.Root>
diff --git a/frontend/src/lib/components/form/repo-tag-fields.svelte b/frontend/src/lib/components/form/repo-tag-fields.svelte
new file mode 100644
index 000000000..a80747d02
--- /dev/null
+++ b/frontend/src/lib/components/form/repo-tag-fields.svelte
@@ -0,0 +1,15 @@
+<script lang="ts">
+ import FormInput from '$lib/components/form/form-input.svelte';
+ import { m } from '$lib/paraglide/messages';
+ import type { FormInput as FormInputType } from '$lib/utils/settings';
+
+ interface Props {
+ repository: FormInputType<string | boolean | number | Date | undefined>;
+ tag: FormInputType<string | boolean | number | Date | undefined>;
+ }
+
+ let { repository = $bindable(), tag = $bindable() }: Props = $props();
+</script>
+
+<FormInput label={m.images_tag_repository()} placeholder={m.images_tag_repository_placeholder()} bind:input={repository} />
+<FormInput label={m.images_tag()} placeholder={m.images_tag_latest()} bind:input={tag} />
diff --git a/frontend/src/lib/components/form/select-with-label.svelte b/frontend/src/lib/components/form/select-with-label.svelte
index e6febe59b..10414f578 100644
--- a/frontend/src/lib/components/form/select-with-label.svelte
+++ b/frontend/src/lib/components/form/select-with-label.svelte
@@ -14,6 +14,9 @@
placeholder = m.common_select_option(),
options = [],
groupLabel,
+ hideLabel = false,
+ triggerClass = 'w-full',
+ triggerSize = 'default',
onValueChange
}: {
id: string;
@@ -26,24 +29,46 @@
placeholder?: string;
options: { label: string; value: string; description?: string }[];
groupLabel?: string;
+ hideLabel?: boolean;
+ triggerClass?: string;
+ triggerSize?: 'sm' | 'default';
onValueChange?: (value: string) => void;
} = $props();
const selectedLabel = $derived(options.find((o) => o.value === value)?.label ?? placeholder);
</script>
+{#snippet optionItems()}
+ {#each options as option (option.value)}
+ <Select.Item value={option.value}>
+ <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}
+{/snippet}
+
<div class="space-y-2">
- <div>
- <Label for={id} class="text-sm font-medium">
+ {#if hideLabel}
+ <Label for={id} class="sr-only">
{label}
</Label>
- {#if description}
- <p class="text-muted-foreground mt-0.5 text-xs">{description}</p>
- {/if}
- </div>
+ {:else}
+ <div>
+ <Label for={id} class="text-sm font-medium">
+ {label}
+ </Label>
+ {#if description}
+ <p class="text-muted-foreground mt-0.5 text-xs">{description}</p>
+ {/if}
+ </div>
+ {/if}
<Select.Root type="single" bind:value {name} {disabled} onValueChange={(v) => onValueChange?.(v)}>
- <Select.Trigger class="w-full {error ? 'border-destructive' : ''}" {id}>
+ <Select.Trigger size={triggerSize} class="{triggerClass} {error ? 'border-destructive' : ''}" {id}>
<span>{selectedLabel}</span>
</Select.Trigger>
@@ -51,28 +76,10 @@
{#if groupLabel}
<Select.Group>
<Select.Label>{groupLabel}</Select.Label>
- {#each options as option (option.value)}
- <Select.Item value={option.value}>
- <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}
+ {@render optionItems()}
</Select.Group>
{:else}
- {#each options as option (option.value)}
- <Select.Item value={option.value}>
- <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}
+ {@render optionItems()}
{/if}
</Select.Content>
</Select.Root>
diff --git a/frontend/src/lib/components/image-update-item.svelte b/frontend/src/lib/components/image-update-item.svelte
index 3b3aec630..445bbc3d6 100644
--- a/frontend/src/lib/components/image-update-item.svelte
+++ b/frontend/src/lib/components/image-update-item.svelte
@@ -10,6 +10,7 @@
import { ArrowRightIcon, RefreshIcon, AlertIcon, VerifiedCheckIcon, ApiKeyIcon, CircleArrowUpIcon, BoxIcon } from '$lib/icons';
import { createQuery } from '@tanstack/svelte-query';
import UpdateStatusPopover from '$lib/components/update-status-popover.svelte';
+ import UpdateStatusBanner from '$lib/components/update-status-banner.svelte';
import { activityToastOptions, extractActivityId } from '$lib/utils/activity-toast';
import UncheckedRingIcon from '$lib/components/unchecked-ring-icon.svelte';
@@ -341,39 +342,44 @@
{@render recheckButton()}
{/snippet}
-{#snippet digestUpdateState()}
- <div class="bg-linear-to-br from-blue-50 to-cyan-50/30 p-4 dark:from-blue-950/20 dark:to-cyan-950/10">
- <div class="flex items-start gap-3">
- {@render iconCircle(CircleArrowUpIcon, 'from-blue-500', 'to-cyan-500', 'shadow-blue-500/25')}
- <div class="flex-1">
- <div class="text-sm font-semibold text-blue-950 dark:text-blue-100">{m.image_update_digest_title()}</div>
- <div class="text-xs text-blue-900/80 dark:text-blue-300/80">{m.image_update_digest_desc()}</div>
- {@render authBadgeDisplay()}
- </div>
- </div>
- </div>
+{#snippet updateDetails(latestLabel: string, latestBg: string, latestText: string, boxBg: string, boxText: string)}
<div class="bg-transparent p-4">
<div class="space-y-3">
<div class="space-y-2 text-xs">
{@render versionDisplay(m.image_update_current_label(), currentVersion, 'bg-muted', '')}
{#if latestVersion}
- {@render versionDisplay(
- m.image_update_latest_digest_label(),
- latestVersion,
- 'bg-blue-100 dark:bg-blue-900/30',
- 'text-blue-800 dark:text-blue-300'
- )}
+ {@render versionDisplay(latestLabel, latestVersion, latestBg, latestText)}
{/if}
</div>
{#if updatePriority}
- <div class="rounded-lg bg-blue-50 p-3 dark:bg-blue-950/30">
- <div class="text-center text-xs leading-relaxed font-medium text-blue-800 dark:text-blue-300">
+ <div class="rounded-lg {boxBg} p-3">
+ <div class="text-center text-xs leading-relaxed font-medium {boxText}">
{updatePriority.description}
</div>
</div>
{/if}
</div>
</div>
+{/snippet}
+
+{#snippet digestUpdateState()}
+ <div class="bg-linear-to-br from-blue-50 to-cyan-50/30 p-4 dark:from-blue-950/20 dark:to-cyan-950/10">
+ <div class="flex items-start gap-3">
+ {@render iconCircle(CircleArrowUpIcon, 'from-blue-500', 'to-cyan-500', 'shadow-blue-500/25')}
+ <div class="flex-1">
+ <div class="text-sm font-semibold text-blue-950 dark:text-blue-100">{m.image_update_digest_title()}</div>
+ <div class="text-xs text-blue-900/80 dark:text-blue-300/80">{m.image_update_digest_desc()}</div>
+ {@render authBadgeDisplay()}
+ </div>
+ </div>
+ </div>
+ {@render updateDetails(
+ m.image_update_latest_digest_label(),
+ 'bg-blue-100 dark:bg-blue-900/30',
+ 'text-blue-800 dark:text-blue-300',
+ 'bg-blue-50 dark:bg-blue-950/30',
+ 'text-blue-800 dark:text-blue-300'
+ )}
{@render recheckButton()}
{/snippet}
@@ -388,28 +394,13 @@
</div>
</div>
</div>
- <div class="bg-transparent p-4">
- <div class="space-y-3">
- <div class="space-y-2 text-xs">
- {@render versionDisplay(m.image_update_current_label(), currentVersion, 'bg-muted', '')}
- {#if latestVersion}
- {@render versionDisplay(
- m.image_update_latest_label(),
- latestVersion,
- 'bg-amber-100 dark:bg-amber-900/30',
- 'text-amber-800 dark:text-amber-300'
- )}
- {/if}
- </div>
- {#if updatePriority}
- <div class="rounded-lg bg-amber-50 p-3 dark:bg-amber-950/30">
- <div class="text-center text-xs leading-relaxed font-medium text-amber-800 dark:text-amber-300">
- {updatePriority.description}
- </div>
- </div>
- {/if}
- </div>
- </div>
+ {@render updateDetails(
+ m.image_update_latest_label(),
+ 'bg-amber-100 dark:bg-amber-900/30',
+ 'text-amber-800 dark:text-amber-300',
+ 'bg-amber-50 dark:bg-amber-950/30',
+ 'text-amber-800 dark:text-amber-300'
+ )}
{@render recheckButton()}
{/snippet}
@@ -426,15 +417,17 @@
{/snippet}
{#snippet loadingState()}
- <div class="bg-linear-to-br from-blue-50 to-cyan-50/30 p-4 dark:from-blue-950/20 dark:to-cyan-950/10">
- <div class="flex items-center gap-3">
- {@render iconCircle(Spinner, 'from-blue-500', 'to-cyan-500', 'shadow-blue-500/25')}
- <div>
- <div class="text-sm font-semibold text-blue-950 dark:text-blue-100">{m.image_update_checking_title()}</div>
- <div class="text-xs text-blue-900/80 dark:text-blue-300/80">{m.image_update_querying_registry()}</div>
- </div>
- </div>
- </div>
+ <UpdateStatusBanner
+ icon={Spinner}
+ wrapperClass="bg-linear-to-br from-blue-50 to-cyan-50/30 p-4 dark:from-blue-950/20 dark:to-cyan-950/10"
+ gradientFrom="from-blue-500"
+ gradientTo="to-cyan-500"
+ shadowColor="shadow-blue-500/25"
+ titleClass="text-blue-950 dark:text-blue-100"
+ descriptionClass="text-blue-900/80 dark:text-blue-300/80"
+ title={m.image_update_checking_title()}
+ description={m.image_update_querying_registry()}
+ />
{/snippet}
{#snippet unknownState()}
diff --git a/frontend/src/lib/components/key-value-grid-card.svelte b/frontend/src/lib/components/key-value-grid-card.svelte
new file mode 100644
index 000000000..076a5006d
--- /dev/null
+++ b/frontend/src/lib/components/key-value-grid-card.svelte
@@ -0,0 +1,30 @@
+<script lang="ts">
+ import * as Card from '$lib/components/ui/card';
+ import { KeyValueCard, KeyValueGrid } from '$lib/components/resource-detail';
+ import { m } from '$lib/paraglide/messages';
+
+ interface Props {
+ icon: any;
+ title: string;
+ description: string;
+ entries: [string, string][];
+ }
+
+ let { icon, title, description, entries }: Props = $props();
+</script>
+
+<Card.Root>
+ <Card.Header {icon}>
+ <div class="flex flex-col space-y-1.5">
+ <Card.Title>{title}</Card.Title>
+ <Card.Description>{description}</Card.Description>
+ </div>
+ </Card.Header>
+ <Card.Content class="p-4">
+ <KeyValueGrid>
+ {#each entries as [key, value] (key)}
+ <KeyValueCard label={key} valueTitle={m.common_click_to_select()}>{value}</KeyValueCard>
+ {/each}
+ </KeyValueGrid>
+ </Card.Content>
+</Card.Root>
diff --git a/frontend/src/lib/components/locale-picker.svelte b/frontend/src/lib/components/locale-picker.svelte
index 85199aedd..67ed81487 100644
--- a/frontend/src/lib/components/locale-picker.svelte
+++ b/frontend/src/lib/components/locale-picker.svelte
@@ -77,52 +77,38 @@
}
</script>
+{#snippet localeSelect(triggerClass: string, ariaLabel?: string, contentClass?: string, itemClass?: string)}
+ <Select.Root
+ type="single"
+ value={currentLocale}
+ onValueChange={(v) => updateLocale(v as Locale)}
+ open={isOpen}
+ onOpenChange={(open) => {
+ isOpen = open;
+ onOpenChange?.(open);
+ }}
+ >
+ <Select.Trigger {id} class={triggerClass} aria-label={ariaLabel}>
+ <span class="truncate">{locales[currentLocale]}</span>
+ </Select.Trigger>
+ <Select.Content class={contentClass}>
+ {#each Object.entries(locales) as [value, label] (value)}
+ <Select.Item class={itemClass} {value}>{label}</Select.Item>
+ {/each}
+ </Select.Content>
+ </Select.Root>
+{/snippet}
+
<div class={`locale-picker ${className}`}>
{#if inline}
- <Select.Root
- type="single"
- value={currentLocale}
- onValueChange={(v) => updateLocale(v as Locale)}
- open={isOpen}
- onOpenChange={(open) => {
- isOpen = open;
- onOpenChange?.(open);
- }}
- >
- <Select.Trigger {id} class="h-9 w-32 text-sm font-medium">
- <span class="truncate">{locales[currentLocale]}</span>
- </Select.Trigger>
- <Select.Content class="max-w-70 min-w-40">
- {#each Object.entries(locales) as [value, label] (value)}
- <Select.Item class="text-sm" {value}>{label}</Select.Item>
- {/each}
- </Select.Content>
- </Select.Root>
+ {@render localeSelect('h-9 w-32 text-sm font-medium', undefined, 'max-w-70 min-w-40', 'text-sm')}
{:else}
<div class="px-3 py-2">
<div class="grid gap-2">
<Label for={id} class="text-sm leading-none font-medium">
{m.language()}
</Label>
- <Select.Root
- type="single"
- value={currentLocale}
- onValueChange={(v) => updateLocale(v as Locale)}
- open={isOpen}
- onOpenChange={(open) => {
- isOpen = open;
- onOpenChange?.(open);
- }}
- >
- <Select.Trigger {id} class="w-full" aria-label={m.common_select_locale()}>
- <span class="truncate">{locales[currentLocale]}</span>
- </Select.Trigger>
- <Select.Content>
- {#each Object.entries(locales) as [value, label] (value)}
- <Select.Item {value}>{label}</Select.Item>
- {/each}
- </Select.Content>
- </Select.Root>
+ {@render localeSelect('w-full', m.common_select_locale())}
</div>
</div>
{/if}
diff --git a/frontend/src/lib/components/logs/log-controls.svelte b/frontend/src/lib/components/logs/log-controls.svelte
index b2d2d65bf..d3d9d810d 100644
--- a/frontend/src/lib/components/logs/log-controls.svelte
+++ b/frontend/src/lib/components/logs/log-controls.svelte
@@ -77,197 +77,117 @@
const selectedLabel = $derived(tailOptions.find((o) => o.value === selectedTail)?.label ?? m.log_tail_100_lines());
</script>
-{#if mobileLayout !== 'none'}
- <div class="lg:hidden">
- {#if mobileLayout === 'full'}
- <div class="flex items-center justify-end gap-1">
- {#if isStreaming}
- <ArcaneButton
- action="stop"
- tone="ghost"
- size="icon"
- class="text-muted-foreground hover:text-foreground size-8 shrink-0"
- onclick={onStop}
- aria-label={m.common_stop()}
- />
- {:else}
- <ArcaneButton
- action="start"
- tone="ghost"
- size="icon"
- class="text-muted-foreground hover:text-foreground size-8 shrink-0"
- onclick={onStart}
- aria-label={m.common_start()}
- {disabled}
- />
- {/if}
+{#snippet mobileActionButtons()}
+ {#if isStreaming}
+ <ArcaneButton
+ action="stop"
+ tone="ghost"
+ size="icon"
+ class="text-muted-foreground hover:text-foreground size-8 shrink-0"
+ onclick={onStop}
+ aria-label={m.common_stop()}
+ />
+ {:else}
+ <ArcaneButton
+ action="start"
+ tone="ghost"
+ size="icon"
+ class="text-muted-foreground hover:text-foreground size-8 shrink-0"
+ onclick={onStart}
+ aria-label={m.common_start()}
+ {disabled}
+ />
+ {/if}
+ <ArcaneButton
+ action="refresh"
+ tone="ghost"
+ size="icon"
+ class="text-muted-foreground hover:text-foreground size-8 shrink-0"
+ onclick={onRefresh}
+ aria-label={m.log_refresh_aria_label()}
+ />
+{/snippet}
+
+{#snippet mobileMenu()}
+ <DropdownMenu.Root>
+ <DropdownMenu.Trigger>
+ {#snippet child({ props })}
<ArcaneButton
- action="refresh"
+ {...props}
+ action="base"
tone="ghost"
size="icon"
class="text-muted-foreground hover:text-foreground size-8 shrink-0"
- onclick={onRefresh}
- aria-label={m.log_refresh_aria_label()}
- />
+ aria-label={m.common_open_menu()}
+ >
+ <span class="sr-only">{m.common_open_menu()}</span>
+ <EllipsisIcon class="size-4" />
+ </ArcaneButton>
+ {/snippet}
+ </DropdownMenu.Trigger>
- <DropdownMenu.Root>
- <DropdownMenu.Trigger>
- {#snippet child({ props })}
- <ArcaneButton
- {...props}
- action="base"
- tone="ghost"
- size="icon"
- class="text-muted-foreground hover:text-foreground size-8 shrink-0"
- aria-label={m.common_open_menu()}
- >
- <span class="sr-only">{m.common_open_menu()}</span>
- <EllipsisIcon class="size-4" />
- </ArcaneButton>
- {/snippet}
- </DropdownMenu.Trigger>
+ <DropdownMenu.Content align="end" class="w-72">
+ <DropdownMenu.Label>{selectedLabel}</DropdownMenu.Label>
+ <DropdownMenu.RadioGroup value={selectedTail} onValueChange={(value) => (selectedTail = value)}>
+ {#each tailOptions as option (option.value)}
+ <DropdownMenu.RadioItem value={option.value} disabled={isStreaming}>{option.label}</DropdownMenu.RadioItem>
+ {/each}
+ </DropdownMenu.RadioGroup>
- <DropdownMenu.Content align="end" class="w-72">
- <DropdownMenu.Label>{selectedLabel}</DropdownMenu.Label>
- <DropdownMenu.RadioGroup value={selectedTail} onValueChange={(value) => (selectedTail = value)}>
- {#each tailOptions as option (option.value)}
- <DropdownMenu.RadioItem value={option.value} disabled={isStreaming}>{option.label}</DropdownMenu.RadioItem>
- {/each}
- </DropdownMenu.RadioGroup>
+ <DropdownMenu.Separator />
- <DropdownMenu.Separator />
+ <DropdownMenu.CheckboxItem
+ checked={autoScroll}
+ onCheckedChange={(checked) => {
+ autoScroll = checked === true;
+ }}
+ >
+ <div class="flex flex-col gap-0.5">
+ <span class="font-medium">{m.common_autoscroll()}</span>
+ <span class="text-muted-foreground text-xs">{m.log_auto_scroll_tooltip()}</span>
+ </div>
+ </DropdownMenu.CheckboxItem>
+ <DropdownMenu.CheckboxItem
+ checked={autoStartLogs}
+ onCheckedChange={(checked) => {
+ autoStartLogs = checked === true;
+ }}
+ >
+ <div class="flex flex-col gap-0.5">
+ <span class="font-medium">{m.auto_start()}</span>
+ <span class="text-muted-foreground text-xs">{m.log_auto_start_tooltip()}</span>
+ </div>
+ </DropdownMenu.CheckboxItem>
+ <DropdownMenu.CheckboxItem
+ checked={showParsedJson}
+ onCheckedChange={(checked) => {
+ showParsedJson = checked === true;
+ }}
+ >
+ <div class="flex flex-col gap-0.5">
+ <span class="font-medium">{showParsedJson ? m.common_parsed() : m.common_raw()}</span>
+ <span class="text-muted-foreground text-xs">{m.log_parsed_mode_tooltip()}</span>
+ </div>
+ </DropdownMenu.CheckboxItem>
+ </DropdownMenu.Content>
+ </DropdownMenu.Root>
+{/snippet}
- <DropdownMenu.CheckboxItem
- checked={autoScroll}
- onCheckedChange={(checked) => {
- autoScroll = checked === true;
- }}
- >
- <div class="flex flex-col gap-0.5">
- <span class="font-medium">{m.common_autoscroll()}</span>
- <span class="text-muted-foreground text-xs">{m.log_auto_scroll_tooltip()}</span>
- </div>
- </DropdownMenu.CheckboxItem>
- <DropdownMenu.CheckboxItem
- checked={autoStartLogs}
- onCheckedChange={(checked) => {
- autoStartLogs = checked === true;
- }}
- >
- <div class="flex flex-col gap-0.5">
- <span class="font-medium">{m.auto_start()}</span>
- <span class="text-muted-foreground text-xs">{m.log_auto_start_tooltip()}</span>
- </div>
- </DropdownMenu.CheckboxItem>
- <DropdownMenu.CheckboxItem
- checked={showParsedJson}
- onCheckedChange={(checked) => {
- showParsedJson = checked === true;
- }}
- >
- <div class="flex flex-col gap-0.5">
- <span class="font-medium">{showParsedJson ? m.common_parsed() : m.common_raw()}</span>
- <span class="text-muted-foreground text-xs">{m.log_parsed_mode_tooltip()}</span>
- </div>
- </DropdownMenu.CheckboxItem>
- </DropdownMenu.Content>
- </DropdownMenu.Root>
+{#if mobileLayout !== 'none'}
+ <div class="lg:hidden">
+ {#if mobileLayout === 'full'}
+ <div class="flex items-center justify-end gap-1">
+ {@render mobileActionButtons()}
+
+ {@render mobileMenu()}
</div>
{:else if mobileLayout === 'actions-only'}
<div class="flex items-center justify-end gap-1">
- {#if isStreaming}
- <ArcaneButton
- action="stop"
- tone="ghost"
- size="icon"
- class="text-muted-foreground hover:text-foreground size-8 shrink-0"
- onclick={onStop}
- aria-label={m.common_stop()}
- />
- {:else}
- <ArcaneButton
- action="start"
- tone="ghost"
- size="icon"
- class="text-muted-foreground hover:text-foreground size-8 shrink-0"
- onclick={onStart}
- aria-label={m.common_start()}
- {disabled}
- />
- {/if}
- <ArcaneButton
- action="refresh"
- tone="ghost"
- size="icon"
- class="text-muted-foreground hover:text-foreground size-8 shrink-0"
- onclick={onRefresh}
- aria-label={m.log_refresh_aria_label()}
- />
+ {@render mobileActionButtons()}
</div>
{:else if mobileLayout === 'menu-only'}
<div class="flex items-center justify-end">
- <DropdownMenu.Root>
- <DropdownMenu.Trigger>
- {#snippet child({ props })}
- <ArcaneButton
- {...props}
- action="base"
- tone="ghost"
- size="icon"
- class="text-muted-foreground hover:text-foreground size-8 shrink-0"
- aria-label={m.common_open_menu()}
- >
- <span class="sr-only">{m.common_open_menu()}</span>
- <EllipsisIcon class="size-4" />
- </ArcaneButton>
- {/snippet}
- </DropdownMenu.Trigger>
-
- <DropdownMenu.Content align="end" class="w-72">
- <DropdownMenu.Label>{selectedLabel}</DropdownMenu.Label>
- <DropdownMenu.RadioGroup value={selectedTail} onValueChange={(value) => (selectedTail = value)}>
- {#each tailOptions as option (option.value)}
- <DropdownMenu.RadioItem value={option.value} disabled={isStreaming}>{option.label}</DropdownMenu.RadioItem>
- {/each}
- </DropdownMenu.RadioGroup>
-
- <DropdownMenu.Separator />
-
- <DropdownMenu.CheckboxItem
- checked={autoScroll}
- onCheckedChange={(checked) => {
- autoScroll = checked === true;
- }}
- >
- <div class="flex flex-col gap-0.5">
- <span class="font-medium">{m.common_autoscroll()}</span>
- <span class="text-muted-foreground text-xs">{m.log_auto_scroll_tooltip()}</span>
- </div>
- </DropdownMenu.CheckboxItem>
- <DropdownMenu.CheckboxItem
- checked={autoStartLogs}
- onCheckedChange={(checked) => {
- autoStartLogs = checked === true;
- }}
- >
- <div class="flex flex-col gap-0.5">
- <span class="font-medium">{m.auto_start()}</span>
- <span class="text-muted-foreground text-xs">{m.log_auto_start_tooltip()}</span>
- </div>
- </DropdownMenu.CheckboxItem>
- <DropdownMenu.CheckboxItem
- checked={showParsedJson}
- onCheckedChange={(checked) => {
- showParsedJson = checked === true;
- }}
- >
- <div class="flex flex-col gap-0.5">
- <span class="font-medium">{showParsedJson ? m.common_parsed() : m.common_raw()}</span>
- <span class="text-muted-foreground text-xs">{m.log_parsed_mode_tooltip()}</span>
- </div>
- </DropdownMenu.CheckboxItem>
- </DropdownMenu.Content>
- </DropdownMenu.Root>
+ {@render mobileMenu()}
</div>
{/if}
</div>
diff --git a/frontend/src/lib/components/logs/log-panel-title.svelte b/frontend/src/lib/components/logs/log-panel-title.svelte
new file mode 100644
index 000000000..732f737a8
--- /dev/null
+++ b/frontend/src/lib/components/logs/log-panel-title.svelte
@@ -0,0 +1,23 @@
+<script lang="ts">
+ import * as Card from '$lib/components/ui/card';
+ import { m } from '$lib/paraglide/messages';
+
+ interface Props {
+ title: string;
+ live: boolean;
+ }
+
+ let { title, live }: Props = $props();
+</script>
+
+<div class="flex items-center gap-2">
+ <Card.Title>
+ <h2>{title}</h2>
+ </Card.Title>
+ {#if live}
+ <div class="flex items-center gap-2">
+ <div class="size-2 animate-pulse rounded-full bg-green-500"></div>
+ <span class="text-xs font-semibold text-green-600 sm:text-sm">{m.common_live()}</span>
+ </div>
+ {/if}
+</div>
diff --git a/frontend/src/lib/components/logs/structured-log-entry.svelte b/frontend/src/lib/components/logs/structured-log-entry.svelte
index 9d40b50c4..bf2a3f015 100644
--- a/frontend/src/lib/components/logs/structured-log-entry.svelte
+++ b/frontend/src/lib/components/logs/structured-log-entry.svelte
@@ -238,44 +238,48 @@
}
</script>
+{#snippet entrySummary(showOverflowCount: boolean)}
+ {#if extracted.level}
+ <span class="mt-1.5 size-2.5 shrink-0 rounded-full {getLevelDotClass(extracted.level)}"></span>
+ {/if}
+
+ <div class="min-w-0 flex-1">
+ <div class="flex flex-wrap items-center gap-x-4 gap-y-1">
+ {#if extracted.target}
+ <span class="truncate text-[11px] font-medium text-cyan-400" title={extracted.target}>
+ {extracted.target}
+ </span>
+ {/if}
+
+ {#if extracted.message}
+ <span class="min-w-0 text-gray-100">{extracted.message}</span>
+ {:else if !extracted.hasStructure}
+ <span class="min-w-0 text-gray-300">{safeStringify(data)}</span>
+ {/if}
+
+ {#each visibleSummaryFields as field (field.path)}
+ <span class="inline-flex max-w-full min-w-0 items-baseline gap-0.5 text-gray-300">
+ <span class="shrink-0 text-zinc-500">{field.label}=</span>
+ <span class="truncate font-semibold text-zinc-100" title={safeStringify(field.value)}>
+ {formatInlineValue(field.value)}
+ </span>
+ </span>
+ {/each}
+
+ {#if showOverflowCount && hiddenSummaryCount > 0}
+ <span class="text-[11px] font-medium text-zinc-500">+{hiddenSummaryCount}</span>
+ {/if}
+ </div>
+ </div>
+{/snippet}
+
<Collapsible.Root bind:open={showDetails}>
<div class="flex min-w-0 items-start gap-2">
{#if hasDetails}
<Collapsible.Trigger
class="focus-visible:border-ring focus-visible:ring-ring/50 flex min-w-0 flex-1 items-start gap-3 rounded-md border border-transparent px-1 py-0.5 text-left outline-none hover:bg-white/3 focus-visible:ring-[3px]"
>
- {#if extracted.level}
- <span class="mt-1.5 size-2.5 shrink-0 rounded-full {getLevelDotClass(extracted.level)}"></span>
- {/if}
-
- <div class="min-w-0 flex-1">
- <div class="flex flex-wrap items-center gap-x-4 gap-y-1">
- {#if extracted.target}
- <span class="truncate text-[11px] font-medium text-cyan-400" title={extracted.target}>
- {extracted.target}
- </span>
- {/if}
-
- {#if extracted.message}
- <span class="min-w-0 text-gray-100">{extracted.message}</span>
- {:else if !extracted.hasStructure}
- <span class="min-w-0 text-gray-300">{safeStringify(data)}</span>
- {/if}
-
- {#each visibleSummaryFields as field (field.path)}
- <span class="inline-flex max-w-full min-w-0 items-baseline gap-0.5 text-gray-300">
- <span class="shrink-0 text-zinc-500">{field.label}=</span>
- <span class="truncate font-semibold text-zinc-100" title={safeStringify(field.value)}>
- {formatInlineValue(field.value)}
- </span>
- </span>
- {/each}
-
- {#if hiddenSummaryCount > 0}
- <span class="text-[11px] font-medium text-zinc-500">+{hiddenSummaryCount}</span>
- {/if}
- </div>
- </div>
+ {@render entrySummary(true)}
{#if showDetails}
<ArrowDownIcon class="mt-0.5 size-4 shrink-0 text-zinc-500" />
@@ -285,34 +289,7 @@
</Collapsible.Trigger>
{:else}
<div class="flex min-w-0 flex-1 items-start gap-3 px-1 py-0.5">
- {#if extracted.level}
- <span class="mt-1.5 size-2.5 shrink-0 rounded-full {getLevelDotClass(extracted.level)}"></span>
- {/if}
-
- <div class="min-w-0 flex-1">
- <div class="flex flex-wrap items-center gap-x-4 gap-y-1">
- {#if extracted.target}
- <span class="truncate text-[11px] font-medium text-cyan-400" title={extracted.target}>
- {extracted.target}
- </span>
- {/if}
-
- {#if extracted.message}
- <span class="min-w-0 text-gray-100">{extracted.message}</span>
- {:else if !extracted.hasStructure}
- <span class="min-w-0 text-gray-300">{safeStringify(data)}</span>
- {/if}
-
- {#each visibleSummaryFields as field (field.path)}
- <span class="inline-flex max-w-full min-w-0 items-baseline gap-0.5 text-gray-300">
- <span class="shrink-0 text-zinc-500">{field.label}=</span>
- <span class="truncate font-semibold text-zinc-100" title={safeStringify(field.value)}>
- {formatInlineValue(field.value)}
- </span>
- </span>
- {/each}
- </div>
- </div>
+ {@render entrySummary(false)}
</div>
{/if}
diff --git a/frontend/src/lib/components/mobile-nav/mobile-nav-sheet.svelte b/frontend/src/lib/components/mobile-nav/mobile-nav-sheet.svelte
index 473dd2894..96c27d460 100644
--- a/frontend/src/lib/components/mobile-nav/mobile-nav-sheet.svelte
+++ b/frontend/src/lib/components/mobile-nav/mobile-nav-sheet.svelte
@@ -11,6 +11,7 @@
import * as Drawer from '$lib/components/ui/drawer/index.js';
import UpdateCenterDialog from '$lib/components/dialogs/update-center-dialog.svelte';
import { useUpgradeCheck } from '$lib/hooks/use-upgrade-check.svelte';
+ import UpdateAvailableBanner from '$lib/components/sidebar/update-available-banner.svelte';
import type { AppVersionInformation } from '$lib/types/settings';
import type { PermissionsManifest, User } from '$lib/types/auth';
@@ -66,6 +67,62 @@
}
</script>
+{#snippet navLink(item: NavigationItem, focusStyles: boolean)}
+ {@const IconComponent = item.icon}
+ <a
+ href={item.url}
+ onclick={handleItemClick}
+ class={cn(
+ 'flex items-center gap-3 rounded-2xl px-4 py-3 text-sm font-medium transition-all duration-200 ease-out',
+ focusStyles &&
+ 'focus-visible:ring-muted-foreground/50 hover:scale-[1.01] focus-visible:ring-1 focus-visible:ring-offset-1 focus-visible:ring-offset-transparent',
+ isActiveItem(item) ? 'bg-muted text-foreground hover:bg-muted/70 shadow-sm' : 'text-foreground hover:bg-muted/50'
+ )}
+ aria-current={focusStyles && isActiveItem(item) ? 'page' : undefined}
+ >
+ <IconComponent size={20} />
+ <span>{item.title}</span>
+ </a>
+{/snippet}
+
+{#snippet subLinks(subItems: NavigationItem[])}
+ <div class="ml-6 space-y-1">
+ {#each subItems as subItem (subItem.url)}
+ {@const SubIconComponent = subItem.icon}
+ <a
+ href={subItem.url}
+ onclick={handleItemClick}
+ class={cn(
+ 'flex items-center gap-3 rounded-xl px-4 py-2 text-sm transition-all duration-200 ease-out',
+ 'focus-visible:ring-muted-foreground/50 hover:scale-[1.01] focus-visible:ring-1 focus-visible:ring-offset-1 focus-visible:ring-offset-transparent',
+ isActiveItem(subItem)
+ ? 'bg-muted/70 text-foreground shadow-sm'
+ : 'text-muted-foreground hover:text-foreground hover:bg-muted/40'
+ )}
+ aria-current={isActiveItem(subItem) ? 'page' : undefined}
+ >
+ <SubIconComponent size={16} />
+ <span>{subItem.title}</span>
+ </a>
+ {/each}
+ </div>
+{/snippet}
+
+{#snippet navItems(sectionItems: NavigationItem[], focusStyles: boolean)}
+ <div class="space-y-2">
+ {#each sectionItems as item (item.url)}
+ {#if item.items}
+ <div class="space-y-2">
+ {@render navLink(item, focusStyles)}
+ {@render subLinks(item.items)}
+ </div>
+ {:else}
+ {@render navLink(item, focusStyles)}
+ {/if}
+ {/each}
+ </div>
+{/snippet}
+
<Drawer.Root {open} onOpenChange={(nextOpen) => (open = nextOpen)} shouldScaleBackground direction="bottom" modal={true}>
<Drawer.Overlay class="fixed inset-0 z-[var(--arcane-z-overlay)] bg-black/40 backdrop-blur-xl" />
<Drawer.Content
@@ -88,134 +145,14 @@
<h4 class="text-muted-foreground/70 mb-4 px-3 text-[11px] font-semibold tracking-widest uppercase">
{m.sidebar_management()}
</h4>
- <div class="space-y-2">
- {#each managementItems as item (item.url)}
- {#if item.items}
- {@const IconComponent = item.icon}
- <div class="space-y-2">
- <a
- href={item.url}
- onclick={handleItemClick}
- class={cn(
- 'flex items-center gap-3 rounded-2xl px-4 py-3 text-sm font-medium transition-all duration-200 ease-out',
- 'focus-visible:ring-muted-foreground/50 hover:scale-[1.01] focus-visible:ring-1 focus-visible:ring-offset-1 focus-visible:ring-offset-transparent',
- isActiveItem(item)
- ? 'bg-muted text-foreground hover:bg-muted/70 shadow-sm'
- : 'text-foreground hover:bg-muted/50'
- )}
- aria-current={isActiveItem(item) ? 'page' : undefined}
- >
- <IconComponent size={20} />
- <span>{item.title}</span>
- </a>
- <div class="ml-6 space-y-1">
- {#each item.items as subItem (subItem.url)}
- {@const SubIconComponent = subItem.icon}
- <a
- href={subItem.url}
- onclick={handleItemClick}
- class={cn(
- 'flex items-center gap-3 rounded-xl px-4 py-2 text-sm transition-all duration-200 ease-out',
- 'focus-visible:ring-muted-foreground/50 hover:scale-[1.01] focus-visible:ring-1 focus-visible:ring-offset-1 focus-visible:ring-offset-transparent',
- isActiveItem(subItem)
- ? 'bg-muted/70 text-foreground shadow-sm'
- : 'text-muted-foreground hover:text-foreground hover:bg-muted/40'
- )}
- aria-current={isActiveItem(subItem) ? 'page' : undefined}
- >
- <SubIconComponent size={16} />
- <span>{subItem.title}</span>
- </a>
- {/each}
- </div>
- </div>
- {:else}
- {@const IconComponent = item.icon}
- <a
- href={item.url}
- onclick={handleItemClick}
- class={cn(
- 'flex items-center gap-3 rounded-2xl px-4 py-3 text-sm font-medium transition-all duration-200 ease-out',
- 'focus-visible:ring-muted-foreground/50 hover:scale-[1.01] focus-visible:ring-1 focus-visible:ring-offset-1 focus-visible:ring-offset-transparent',
- isActiveItem(item)
- ? 'bg-muted text-foreground hover:bg-muted/70 shadow-sm'
- : 'text-foreground hover:bg-muted/50'
- )}
- aria-current={isActiveItem(item) ? 'page' : undefined}
- >
- <IconComponent size={20} />
- <span>{item.title}</span>
- </a>
- {/if}
- {/each}
- </div>
+ {@render navItems(managementItems, true)}
</section>
<section>
<h4 class="text-muted-foreground/70 mb-4 px-3 text-[11px] font-semibold tracking-widest uppercase">
{m.sidebar_resources()}
</h4>
- <div class="space-y-2">
- {#each resourceItems as item (item.url)}
- {#if item.items}
- {@const IconComponent = item.icon}
- <div class="space-y-2">
- <a
- href={item.url}
- onclick={handleItemClick}
- class={cn(
- 'flex items-center gap-3 rounded-2xl px-4 py-3 text-sm font-medium transition-all duration-200 ease-out',
- 'focus-visible:ring-muted-foreground/50 hover:scale-[1.01] focus-visible:ring-1 focus-visible:ring-offset-1 focus-visible:ring-offset-transparent',
- isActiveItem(item)
- ? 'bg-muted text-foreground hover:bg-muted/70 shadow-sm'
- : 'text-foreground hover:bg-muted/50'
- )}
- aria-current={isActiveItem(item) ? 'page' : undefined}
- >
- <IconComponent size={20} />
- <span>{item.title}</span>
- </a>
- <div class="ml-6 space-y-1">
- {#each item.items as subItem (subItem.url)}
- {@const SubIconComponent = subItem.icon}
- <a
- href={subItem.url}
- onclick={handleItemClick}
- class={cn(
- 'flex items-center gap-3 rounded-xl px-4 py-2 text-sm transition-all duration-200 ease-out',
- 'focus-visible:ring-muted-foreground/50 hover:scale-[1.01] focus-visible:ring-1 focus-visible:ring-offset-1 focus-visible:ring-offset-transparent',
- isActiveItem(subItem)
- ? 'bg-muted/70 text-foreground shadow-sm'
- : 'text-muted-foreground hover:text-foreground hover:bg-muted/40'
- )}
- aria-current={isActiveItem(subItem) ? 'page' : undefined}
- >
- <SubIconComponent size={16} />
- <span>{subItem.title}</span>
- </a>
- {/each}
- </div>
- </div>
- {:else}
- {@const IconComponent = item.icon}
- <a
- href={item.url}
- onclick={handleItemClick}
- class={cn(
- 'flex items-center gap-3 rounded-2xl px-4 py-3 text-sm font-medium transition-all duration-200 ease-out',
- 'focus-visible:ring-muted-foreground/50 hover:scale-[1.01] focus-visible:ring-1 focus-visible:ring-offset-1 focus-visible:ring-offset-transparent',
- isActiveItem(item)
- ? 'bg-muted text-foreground hover:bg-muted/70 shadow-sm'
- : 'text-foreground hover:bg-muted/50'
- )}
- aria-current={isActiveItem(item) ? 'page' : undefined}
- >
- <IconComponent size={20} />
- <span>{item.title}</span>
- </a>
- {/if}
- {/each}
- </div>
+ {@render navItems(resourceItems, true)}
</section>
{#if swarmItems.length > 0}
@@ -225,22 +162,7 @@
</h4>
<div class="space-y-2">
{#each swarmItems as item (item.url)}
- {@const IconComponent = item.icon}
- <a
- href={item.url}
- onclick={handleItemClick}
- class={cn(
- 'flex items-center gap-3 rounded-2xl px-4 py-3 text-sm font-medium transition-all duration-200 ease-out',
- 'focus-visible:ring-muted-foreground/50 hover:scale-[1.01] focus-visible:ring-1 focus-visible:ring-offset-1 focus-visible:ring-offset-transparent',
- isActiveItem(item)
- ? 'bg-muted text-foreground hover:bg-muted/70 shadow-sm'
- : 'text-foreground hover:bg-muted/50'
- )}
- aria-current={isActiveItem(item) ? 'page' : undefined}
- >
- <IconComponent size={20} />
- <span>{item.title}</span>
- </a>
+ {@render navLink(item, true)}
{/each}
</div>
</section>
@@ -251,63 +173,7 @@
<h4 class="text-muted-foreground/70 mb-4 px-3 text-[11px] font-semibold tracking-widest uppercase">
{m.sidebar_administration()}
</h4>
- <div class="space-y-2">
- {#each settingsItems as item (item.url)}
- {#if item.items}
- {@const IconComponent = item.icon}
- <div class="space-y-2">
- <a
- href={item.url}
- onclick={handleItemClick}
- class={cn(
- 'flex items-center gap-3 rounded-2xl px-4 py-3 text-sm font-medium transition-all duration-200 ease-out',
- isActiveItem(item)
- ? 'bg-muted text-foreground hover:bg-muted/70 shadow-sm'
- : 'text-foreground hover:bg-muted/50'
- )}
- >
- <IconComponent size={20} />
- <span>{item.title}</span>
- </a>
- <div class="ml-6 space-y-1">
- {#each item.items as subItem (subItem.url)}
- {@const SubIconComponent = subItem.icon}
- <a
- href={subItem.url}
- onclick={handleItemClick}
- class={cn(
- 'flex items-center gap-3 rounded-xl px-4 py-2 text-sm transition-all duration-200 ease-out',
- 'focus-visible:ring-muted-foreground/50 hover:scale-[1.01] focus-visible:ring-1 focus-visible:ring-offset-1 focus-visible:ring-offset-transparent',
- isActiveItem(subItem)
- ? 'bg-muted/70 text-foreground shadow-sm'
- : 'text-muted-foreground hover:text-foreground hover:bg-muted/40'
- )}
- aria-current={isActiveItem(subItem) ? 'page' : undefined}
- >
- <SubIconComponent size={16} />
- <span>{subItem.title}</span>
- </a>
- {/each}
- </div>
- </div>
- {:else}
- {@const IconComponent = item.icon}
- <a
- href={item.url}
- onclick={handleItemClick}
- class={cn(
- 'flex items-center gap-3 rounded-2xl px-4 py-3 text-sm font-medium transition-all duration-200 ease-out',
- isActiveItem(item)
- ? 'bg-muted text-foreground hover:bg-muted/70 shadow-sm'
- : 'text-foreground hover:bg-muted/50'
- )}
- >
- <IconComponent size={20} />
- <span>{item.title}</span>
- </a>
- {/if}
- {/each}
- </div>
+ {@render navItems(settingsItems, false)}
</section>
{/if}
</div>
@@ -322,25 +188,13 @@
</p>
</div>
{#if upgradeCheck.shouldShowBanner}
- <button
- type="button"
- onclick={upgradeCheck.openDialog}
+ <UpdateAvailableBanner
+ class="mt-3 rounded-xl px-3 py-2.5"
+ label={m.sidebar_update_available()}
+ versionChip={upgradeCheck.versionChip}
disabled={upgradeCheck.upgrading || upgradeCheck.checkingUpgrade}
- class="group hover:bg-muted/50 focus-visible:ring-primary/40 mt-3 flex w-full items-center gap-2.5 rounded-xl px-3 py-2.5 text-left transition-colors focus-visible:ring-2 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-60"
- >
- <span class="relative flex size-2 shrink-0 items-center justify-center">
- <span class="absolute inline-flex size-2 animate-ping rounded-full bg-blue-500 opacity-60"></span>
- <span class="relative inline-flex size-1.5 rounded-full bg-blue-500"></span>
- </span>
- <span class="text-foreground flex-1 text-sm font-medium">
- {m.sidebar_update_available()}
- </span>
- {#if upgradeCheck.versionChip}
- <span class="bg-muted text-muted-foreground rounded-md px-1.5 py-0.5 font-mono text-[11px]">
- {upgradeCheck.versionChip}
- </span>
- {/if}
- </button>
+ onclick={upgradeCheck.openDialog}
+ />
{/if}
{/if}
</div>
diff --git a/frontend/src/lib/components/network-card-header.svelte b/frontend/src/lib/components/network-card-header.svelte
new file mode 100644
index 000000000..9ada6250e
--- /dev/null
+++ b/frontend/src/lib/components/network-card-header.svelte
@@ -0,0 +1,25 @@
+<script lang="ts">
+ import { NetworksIcon } from '$lib/icons';
+ import type { Snippet } from 'svelte';
+
+ interface Props {
+ name: string;
+ children?: Snippet;
+ }
+
+ let { name, children }: Props = $props();
+</script>
+
+<div class="border-border mb-4 flex items-center gap-3 border-b pb-4">
+ <div class="rounded-lg bg-blue-500/10 p-2">
+ <NetworksIcon class="size-5 text-blue-500" />
+ </div>
+ <div class="min-w-0 flex-1">
+ <div class="text-foreground text-base font-semibold break-all">
+ {name}
+ </div>
+ {#if children}
+ {@render children()}
+ {/if}
+ </div>
+</div>
diff --git a/frontend/src/lib/components/oidc-status-panel.svelte b/frontend/src/lib/components/oidc-status-panel.svelte
new file mode 100644
index 000000000..56ab89369
--- /dev/null
+++ b/frontend/src/lib/components/oidc-status-panel.svelte
@@ -0,0 +1,43 @@
+<script lang="ts">
+ import type { Snippet } from 'svelte';
+ import { Spinner } from '$lib/components/ui/spinner/index.js';
+ import { m } from '$lib/paraglide/messages';
+
+ interface Props {
+ busy: boolean;
+ busyTitle: string;
+ busyDescription: string;
+ error: string;
+ children?: Snippet;
+ }
+
+ let { busy, busyTitle, busyDescription, error, children }: Props = $props();
+</script>
+
+<div class="bg-background flex min-h-screen items-center justify-center">
+ <div class="w-full max-w-md space-y-8">
+ <div class="flex flex-col items-center text-center">
+ {#if busy}
+ <Spinner class="text-primary size-12" />
+ <h2 class="mt-6 text-2xl font-semibold">{busyTitle}</h2>
+ <p class="text-muted-foreground mt-2 text-sm">{busyDescription}</p>
+ {:else if error}
+ <div class="text-destructive flex flex-col items-center">
+ <svg class="h-12 w-12" fill="none" viewBox="0 0 24 24" stroke="currentColor">
+ <path
+ stroke-linecap="round"
+ stroke-linejoin="round"
+ stroke-width="2"
+ d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.732-.833-2.5 0L3.341 16.5c-.77.833.192 2.5 1.732 2.5z"
+ />
+ </svg>
+ <h2 class="mt-6 text-2xl font-semibold">{m.auth_authentication_error_title()}</h2>
+ <p class="mt-2 text-sm">{error}</p>
+ <p class="text-muted-foreground mt-4 text-xs">{m.auth_redirecting_to_login()}</p>
+ </div>
+ {:else}
+ {@render children?.()}
+ {/if}
+ </div>
+ </div>
+</div>
diff --git a/frontend/src/lib/components/project-update-item.svelte b/frontend/src/lib/components/project-update-item.svelte
index e7a916dbf..793e21db8 100644
--- a/frontend/src/lib/components/project-update-item.svelte
+++ b/frontend/src/lib/components/project-update-item.svelte
@@ -3,6 +3,7 @@
import { getProjectUpdateStatus, getProjectUpdateText } from '$lib/utils/docker';
import { m } from '$lib/paraglide/messages';
import UpdateStatusPopover from '$lib/components/update-status-popover.svelte';
+ import UpdateStatusBanner from '$lib/components/update-status-banner.svelte';
import { Spinner } from '$lib/components/ui/spinner/index.js';
import { AlertIcon, CircleArrowUpIcon, ClockIcon, ImagesIcon, RefreshIcon, VerifiedCheckIcon } from '$lib/icons';
import type { Component } from 'svelte';
@@ -204,15 +205,17 @@
{#snippet content()}
<div class="overflow-hidden rounded-xl">
{#if checking}
- <div class="bg-linear-to-br from-blue-50 to-cyan-50/30 p-4 dark:from-blue-950/20 dark:to-cyan-950/10">
- <div class="flex items-center gap-3">
- {@render iconCircle(Spinner, 'from-blue-500', 'to-cyan-500', 'shadow-blue-500/25')}
- <div>
- <div class="text-sm font-semibold text-blue-950 dark:text-blue-100">{m.image_update_checking_title()}</div>
- <div class="text-xs text-blue-900/80 dark:text-blue-300/80">{m.image_update_querying_registry()}</div>
- </div>
- </div>
- </div>
+ <UpdateStatusBanner
+ icon={Spinner}
+ wrapperClass="bg-linear-to-br from-blue-50 to-cyan-50/30 p-4 dark:from-blue-950/20 dark:to-cyan-950/10"
+ gradientFrom="from-blue-500"
+ gradientTo="to-cyan-500"
+ shadowColor="shadow-blue-500/25"
+ titleClass="text-blue-950 dark:text-blue-100"
+ descriptionClass="text-blue-900/80 dark:text-blue-300/80"
+ title={m.image_update_checking_title()}
+ description={m.image_update_querying_registry()}
+ />
{:else}
<div class="p-4 {stateMeta.headerClass}">
<div class="flex items-start gap-3">
diff --git a/frontend/src/lib/components/property-item.svelte b/frontend/src/lib/components/property-item.svelte
new file mode 100644
index 000000000..9a124a0bf
--- /dev/null
+++ b/frontend/src/lib/components/property-item.svelte
@@ -0,0 +1,55 @@
+<script lang="ts">
+ import type { Snippet } from 'svelte';
+ import { m } from '$lib/paraglide/messages';
+
+ const colorClasses = {
+ gray: { bg: 'bg-gray-500/10', text: 'text-gray-500' },
+ blue: { bg: 'bg-blue-500/10', text: 'text-blue-500' },
+ orange: { bg: 'bg-orange-500/10', text: 'text-orange-500' },
+ purple: { bg: 'bg-purple-500/10', text: 'text-purple-500' },
+ green: { bg: 'bg-green-500/10', text: 'text-green-500' },
+ yellow: { bg: 'bg-yellow-500/10', text: 'text-yellow-500' },
+ red: { bg: 'bg-red-500/10', text: 'text-red-500' },
+ indigo: { bg: 'bg-indigo-500/10', text: 'text-indigo-500' },
+ cyan: { bg: 'bg-cyan-500/10', text: 'text-cyan-500' },
+ pink: { bg: 'bg-pink-500/10', text: 'text-pink-500' },
+ amber: { bg: 'bg-amber-500/10', text: 'text-amber-500' },
+ teal: { bg: 'bg-teal-500/10', text: 'text-teal-500' }
+ } as const;
+
+ interface Props {
+ icon: any;
+ color: keyof typeof colorClasses;
+ label: string;
+ value?: string;
+ valueClass?: string;
+ class?: string;
+ children?: Snippet;
+ }
+
+ let {
+ icon: Icon,
+ color,
+ label,
+ value,
+ valueClass = 'mt-1 cursor-pointer text-sm font-semibold select-all sm:text-base',
+ class: className = 'flex items-start gap-3',
+ children
+ }: Props = $props();
+</script>
+
+<div class={className}>
+ <div class="flex size-10 shrink-0 items-center justify-center rounded-full {colorClasses[color].bg} p-2">
+ <Icon class="size-5 {colorClasses[color].text}" />
+ </div>
+ <div class="min-w-0 flex-1">
+ <p class="text-muted-foreground text-sm font-medium">{label}</p>
+ {#if children}
+ {@render children()}
+ {:else}
+ <p class={valueClass} title={m.common_click_to_select()}>
+ {value}
+ </p>
+ {/if}
+ </div>
+</div>
diff --git a/frontend/src/lib/components/resource-error-page.svelte b/frontend/src/lib/components/resource-error-page.svelte
new file mode 100644
index 000000000..8b008361a
--- /dev/null
+++ b/frontend/src/lib/components/resource-error-page.svelte
@@ -0,0 +1,40 @@
+<script lang="ts">
+ import { page } from '$app/state';
+ import { goto } from '$app/navigation';
+ import * as Empty from '$lib/components/ui/empty/index.js';
+ import { ArcaneButton } from '$lib/components/arcane-button/index.js';
+ import { AlertIcon } from '$lib/icons';
+ import { m } from '$lib/paraglide/messages';
+
+ interface Props {
+ fallbackTitle: string;
+ backLabel: string;
+ backHref: string;
+ }
+
+ let { fallbackTitle, backLabel, backHref }: Props = $props();
+
+ const status = $derived(page.status ?? 500);
+ const message = $derived(page.error?.message ?? m.error_generic());
+</script>
+
+<div class="flex h-full flex-1 flex-col items-center justify-center p-8">
+ <Empty.Root>
+ <Empty.Header>
+ <Empty.Media variant="icon">
+ <AlertIcon class="text-destructive size-16" aria-hidden="true" />
+ </Empty.Media>
+ <Empty.Title>
+ {status === 404 ? m.error_not_found() : fallbackTitle}
+ </Empty.Title>
+ <Empty.Description>
+ {message}
+ </Empty.Description>
+ </Empty.Header>
+ <Empty.Content>
+ <div class="flex flex-col items-center gap-3">
+ <ArcaneButton action="base" customLabel={backLabel} onclick={() => goto(backHref)} />
+ </div>
+ </Empty.Content>
+ </Empty.Root>
+</div>
diff --git a/frontend/src/lib/components/resource-not-found.svelte b/frontend/src/lib/components/resource-not-found.svelte
new file mode 100644
index 000000000..425d43d86
--- /dev/null
+++ b/frontend/src/lib/components/resource-not-found.svelte
@@ -0,0 +1,38 @@
+<script lang="ts">
+ import { ArcaneButton } from '$lib/components/arcane-button/index.js';
+ import { AlertIcon, ArrowLeftIcon } from '$lib/icons';
+ import { m } from '$lib/paraglide/messages';
+
+ let {
+ resource,
+ resourceListTitle,
+ backHref,
+ onRetry
+ }: {
+ resource: string;
+ resourceListTitle: string;
+ backHref: string;
+ onRetry: () => void;
+ } = $props();
+</script>
+
+<div class="flex min-h-screen items-center justify-center">
+ <div class="text-center">
+ <div class="bg-muted/50 mb-6 inline-flex rounded-full p-6">
+ <AlertIcon class="text-muted-foreground size-10" />
+ </div>
+ <h2 class="mb-3 text-2xl font-medium">{m.common_not_found_title({ resource })}</h2>
+ <p class="text-muted-foreground mb-8 max-w-md text-center">
+ {m.common_not_found_description({ resource: resource.toLowerCase() })}
+ </p>
+ <div class="flex justify-center gap-4">
+ <ArcaneButton action="base" href={backHref}>
+ <ArrowLeftIcon class="size-4" />
+ {m.common_back_to({ resource: resourceListTitle })}
+ </ArcaneButton>
+ <ArcaneButton action="refresh" onclick={onRetry}>
+ {m.common_retry()}
+ </ArcaneButton>
+ </div>
+ </div>
+</div>
diff --git a/frontend/src/lib/components/settings/settings-row.svelte b/frontend/src/lib/components/settings/settings-row.svelte
index e72072356..24a8d6b63 100644
--- a/frontend/src/lib/components/settings/settings-row.svelte
+++ b/frontend/src/lib/components/settings/settings-row.svelte
@@ -16,42 +16,33 @@
let { label, description, helpText, labelExtra, children, contentClass, layout = 'stacked' }: Props = $props();
</script>
+{#snippet labelBlock(wrapperClass: string)}
+ <div class={wrapperClass}>
+ <Label class="text-sm font-medium">{label}</Label>
+ {#if description}
+ <p class="text-muted-foreground mt-0.5 text-xs">{description}</p>
+ {/if}
+ {#if typeof helpText === 'function'}
+ {@render helpText()}
+ {:else if helpText}
+ <p class="text-muted-foreground mt-1 text-xs">{helpText}</p>
+ {/if}
+ {#if labelExtra}
+ {@render labelExtra()}
+ {/if}
+ </div>
+{/snippet}
+
{#if layout === 'inline'}
<div class="flex items-start justify-between gap-6">
- <div class="min-w-0 flex-1">
- <Label class="text-sm font-medium">{label}</Label>
- {#if description}
- <p class="text-muted-foreground mt-0.5 text-xs">{description}</p>
- {/if}
- {#if typeof helpText === 'function'}
- {@render helpText()}
- {:else if helpText}
- <p class="text-muted-foreground mt-1 text-xs">{helpText}</p>
- {/if}
- {#if labelExtra}
- {@render labelExtra()}
- {/if}
- </div>
+ {@render labelBlock('min-w-0 flex-1')}
<div class={cn('shrink-0', contentClass)}>
{@render children()}
</div>
</div>
{:else}
<div class="space-y-2">
- <div>
- <Label class="text-sm font-medium">{label}</Label>
- {#if description}
- <p class="text-muted-foreground mt-0.5 text-xs">{description}</p>
- {/if}
- {#if typeof helpText === 'function'}
- {@render helpText()}
- {:else if helpText}
- <p class="text-muted-foreground mt-1 text-xs">{helpText}</p>
- {/if}
- {#if labelExtra}
- {@render labelExtra()}
- {/if}
- </div>
+ {@render labelBlock('')}
<div class={cn('pt-1', contentClass)}>
{@render children()}
</div>
diff --git a/frontend/src/lib/components/settings/trivy-security-settings.svelte b/frontend/src/lib/components/settings/trivy-security-settings.svelte
index 4cbcef52e..9b14624b4 100644
--- a/frontend/src/lib/components/settings/trivy-security-settings.svelte
+++ b/frontend/src/lib/components/settings/trivy-security-settings.svelte
@@ -11,23 +11,25 @@
import { toast } from 'svelte-sonner';
import { networkService } from '$lib/services/network-service';
import type { SearchPaginationSortRequest } from '$lib/types/shared';
+ import type { Settings } from '$lib/types/settings';
import type { Readable } from 'svelte/store';
- type TrivySecurityFormValues = {
- trivyImage: string;
- trivyNetwork: string;
- trivySecurityOpts: string;
- trivyPrivileged: boolean;
- trivyPreserveCacheOnVolumePrune: boolean;
- trivyResourceLimitsEnabled: boolean;
- trivyCpuLimit: number;
- trivyMemoryLimitMb: number;
- trivyConcurrentScanContainers: number;
- trivyServerEnabled: boolean;
- trivyServerUrl: string;
- trivyServerToken: string;
- trivyIgnoreUnfixed: boolean;
- };
+ type TrivySecurityFormValues = Pick<
+ Settings,
+ | 'trivyImage'
+ | 'trivyNetwork'
+ | 'trivySecurityOpts'
+ | 'trivyPrivileged'
+ | 'trivyPreserveCacheOnVolumePrune'
+ | 'trivyResourceLimitsEnabled'
+ | 'trivyCpuLimit'
+ | 'trivyMemoryLimitMb'
+ | 'trivyConcurrentScanContainers'
+ | 'trivyServerEnabled'
+ | 'trivyServerUrl'
+ | 'trivyServerToken'
+ | 'trivyIgnoreUnfixed'
+ >;
type FormField<T> = {
value: T;
diff --git a/frontend/src/lib/components/sheets/add-template-registry-sheet.svelte b/frontend/src/lib/components/sheets/add-template-registry-sheet.svelte
index c9a0fd697..188186e06 100644
--- a/frontend/src/lib/components/sheets/add-template-registry-sheet.svelte
+++ b/frontend/src/lib/components/sheets/add-template-registry-sheet.svelte
@@ -1,6 +1,6 @@
<script lang="ts">
import * as ResponsiveDialog from '$lib/components/ui/responsive-dialog/index.js';
- import { ArcaneButton } from '$lib/components/arcane-button/index.js';
+ import SheetFooterActions from '$lib/components/sheets/sheet-footer-actions.svelte';
import FormInput from '$lib/components/form/form-input.svelte';
import SwitchWithLabel from '$lib/components/form/labeled-switch.svelte';
import { z } from 'zod/v4';
@@ -105,24 +105,13 @@
{/snippet}
{#snippet footer()}
- <div class="flex w-full flex-row gap-2">
- <ArcaneButton
- action="cancel"
- tone="outline"
- type="button"
- class="flex-1"
- onclick={() => (open = false)}
- disabled={isLoading || isValidating}
- />
- <ArcaneButton
- action="create"
- type="submit"
- class="flex-1"
- disabled={isLoading || isValidating}
- loading={isLoading || isValidating}
- onclick={handleSubmit}
- customLabel={m.templates_add_registry_button()}
- />
- </div>
+ <SheetFooterActions
+ bind:open
+ cancelDisabled={isLoading || isValidating}
+ submitDisabled={isLoading || isValidating}
+ submitLoading={isLoading || isValidating}
+ onSubmit={handleSubmit}
+ submitLabel={m.templates_add_registry_button()}
+ />
{/snippet}
</ResponsiveDialog.Root>
diff --git a/frontend/src/lib/components/sheets/api-key-form-sheet.svelte b/frontend/src/lib/components/sheets/api-key-form-sheet.svelte
index 4d9cb9e00..bc03ecab8 100644
--- a/frontend/src/lib/components/sheets/api-key-form-sheet.svelte
+++ b/frontend/src/lib/components/sheets/api-key-form-sheet.svelte
@@ -1,6 +1,6 @@
<script lang="ts">
import * as ResponsiveDialog from '$lib/components/ui/responsive-dialog/index.js';
- import { ArcaneButton } from '$lib/components/arcane-button/index.js';
+ import SheetFooterActions from '$lib/components/sheets/sheet-footer-actions.svelte';
import FormInput from '$lib/components/form/form-input.svelte';
import PermissionPicker from '$lib/components/role-editor/permission-picker.svelte';
import type { ApiKey } from '$lib/types/auth';
@@ -164,26 +164,15 @@
{/snippet}
{#snippet footer()}
- <div class="flex w-full flex-row gap-2">
- <ArcaneButton
- action="cancel"
- tone="outline"
- type="button"
- class="flex-1"
- onclick={() => (open = false)}
- disabled={isLoading}
- />
- {#if !isReadOnlyApiKey}
- <ArcaneButton
- action={isEditMode ? 'save' : 'create'}
- type="submit"
- class="flex-1"
- disabled={isLoading}
- loading={isLoading}
- onclick={handleSubmit}
- customLabel={isEditMode ? m.api_key_save_changes() : m.api_key_create_button()}
- />
- {/if}
- </div>
+ <SheetFooterActions
+ bind:open
+ cancelDisabled={isLoading}
+ showSubmit={!isReadOnlyApiKey}
+ submitAction={isEditMode ? 'save' : 'create'}
+ submitDisabled={isLoading}
+ submitLoading={isLoading}
+ onSubmit={handleSubmit}
+ submitLabel={isEditMode ? m.api_key_save_changes() : m.api_key_create_button()}
+ />
{/snippet}
</ResponsiveDialog.Root>
diff --git a/frontend/src/lib/components/sheets/container-registry-sheet.svelte b/frontend/src/lib/components/sheets/container-registry-sheet.svelte
index 25c873954..6362ac865 100644
--- a/frontend/src/lib/components/sheets/container-registry-sheet.svelte
+++ b/frontend/src/lib/components/sheets/container-registry-sheet.svelte
@@ -1,6 +1,6 @@
<script lang="ts">
import * as ResponsiveDialog from '$lib/components/ui/responsive-dialog/index.js';
- import { ArcaneButton } from '$lib/components/arcane-button/index.js';
+ import SheetFooterActions from '$lib/components/sheets/sheet-footer-actions.svelte';
import FormInput from '$lib/components/form/form-input.svelte';
import SwitchWithLabel from '$lib/components/form/labeled-switch.svelte';
import SelectWithLabel from '$lib/components/form/select-with-label.svelte';
@@ -191,29 +191,19 @@
bind:checked={$inputs.insecure.value}
/>
{/if}
+ <!-- fallow-ignore-next-line code-duplication per-sheet footer wrapper ({#snippet footer} -> shared SheetFooterActions); ResponsiveDialog requires a footer snippet in each sheet -->
</form>
{/snippet}
{#snippet footer()}
- <div class="flex w-full flex-row gap-2">
- <ArcaneButton
- action="cancel"
- tone="outline"
- type="button"
- class="flex-1"
- onclick={() => (open = false)}
- disabled={isLoading}
- />
-
- <ArcaneButton
- action={isEditMode ? 'save' : 'create'}
- type="submit"
- class="flex-1"
- disabled={isLoading}
- loading={isLoading}
- onclick={handleSubmit}
- customLabel={isEditMode ? m.registries_save_changes() : m.common_add_button({ resource: m.resource_registry_cap() })}
- />
- </div>
+ <SheetFooterActions
+ bind:open
+ cancelDisabled={isLoading}
+ submitAction={isEditMode ? 'save' : 'create'}
+ submitDisabled={isLoading}
+ submitLoading={isLoading}
+ onSubmit={handleSubmit}
+ submitLabel={isEditMode ? m.registries_save_changes() : m.common_add_button({ resource: m.resource_registry_cap() })}
+ />
{/snippet}
</ResponsiveDialog.Root>
diff --git a/frontend/src/lib/components/sheets/create-network-sheet.svelte b/frontend/src/lib/components/sheets/create-network-sheet.svelte
index a31e65409..664313ff5 100644
--- a/frontend/src/lib/components/sheets/create-network-sheet.svelte
+++ b/frontend/src/lib/components/sheets/create-network-sheet.svelte
@@ -1,6 +1,7 @@
<script lang="ts">
import * as ResponsiveDialog from '$lib/components/ui/responsive-dialog/index.js';
import { ArcaneButton } from '$lib/components/arcane-button/index.js';
+ import SheetFooterActions from '$lib/components/sheets/sheet-footer-actions.svelte';
import * as Accordion from '$lib/components/ui/accordion/index.js';
import { Checkbox } from '$lib/components/ui/checkbox/index.js';
import { Label } from '$lib/components/ui/label/index.js';
@@ -299,6 +300,7 @@
</div>
</div>
{/if}
+ <!-- fallow-ignore-next-line code-duplication network vs volume sheet share only structural closing tags + the already-shared SheetFooterActions footer; form bodies differ -->
</div>
</Accordion.Content>
</Accordion.Item>
@@ -307,24 +309,13 @@
{/snippet}
{#snippet footer()}
- <div class="flex w-full flex-row gap-2">
- <ArcaneButton
- action="cancel"
- tone="outline"
- type="button"
- class="flex-1"
- onclick={() => (open = false)}
- disabled={isLoading}
- />
- <ArcaneButton
- action="create"
- type="submit"
- class="flex-1"
- disabled={isLoading}
- loading={isLoading}
- onclick={handleSubmit}
- customLabel={m.common_create_button({ resource: m.resource_network_cap() })}
- />
- </div>
+ <SheetFooterActions
+ bind:open
+ cancelDisabled={isLoading}
+ submitDisabled={isLoading}
+ submitLoading={isLoading}
+ onSubmit={handleSubmit}
+ submitLabel={m.common_create_button({ resource: m.resource_network_cap() })}
+ />
{/snippet}
</ResponsiveDialog.Root>
diff --git a/frontend/src/lib/components/sheets/create-volume-sheet.svelte b/frontend/src/lib/components/sheets/create-volume-sheet.svelte
index 06ee4e97d..e76237678 100644
--- a/frontend/src/lib/components/sheets/create-volume-sheet.svelte
+++ b/frontend/src/lib/components/sheets/create-volume-sheet.svelte
@@ -1,6 +1,6 @@
<script lang="ts">
import * as ResponsiveDialog from '$lib/components/ui/responsive-dialog/index.js';
- import { ArcaneButton } from '$lib/components/arcane-button/index.js';
+ import SheetFooterActions from '$lib/components/sheets/sheet-footer-actions.svelte';
import FormInput from '$lib/components/form/form-input.svelte';
import * as Accordion from '$lib/components/ui/accordion/index.js';
import type { VolumeCreateRequest } from '$lib/types/docker';
@@ -131,24 +131,13 @@
{/snippet}
{#snippet footer()}
- <div class="flex w-full flex-row gap-2">
- <ArcaneButton
- action="cancel"
- tone="outline"
- type="button"
- class="flex-1"
- onclick={() => (open = false)}
- disabled={isLoading}
- />
- <ArcaneButton
- action="create"
- type="submit"
- class="flex-1"
- disabled={isLoading}
- loading={isLoading}
- onclick={handleSubmit}
- customLabel={m.common_create_button({ resource: m.resource_volume_cap() })}
- />
- </div>
+ <SheetFooterActions
+ bind:open
+ cancelDisabled={isLoading}
+ submitDisabled={isLoading}
+ submitLoading={isLoading}
+ onSubmit={handleSubmit}
+ submitLabel={m.common_create_button({ resource: m.resource_volume_cap() })}
+ />
{/snippet}
</ResponsiveDialog.Root>
diff --git a/frontend/src/lib/components/sheets/federated-credential-form-sheet.svelte b/frontend/src/lib/components/sheets/federated-credential-form-sheet.svelte
index 332f37e77..8578a22f1 100644
--- a/frontend/src/lib/components/sheets/federated-credential-form-sheet.svelte
+++ b/frontend/src/lib/components/sheets/federated-credential-form-sheet.svelte
@@ -2,7 +2,8 @@
import * as ResponsiveDialog from '$lib/components/ui/responsive-dialog/index.js';
import * as Select from '$lib/components/ui/select';
import * as Alert from '$lib/components/ui/alert';
- import { ArcaneButton } from '$lib/components/arcane-button/index.js';
+ import SheetFooterActions from '$lib/components/sheets/sheet-footer-actions.svelte';
+ import RoleScopeSelects from '$lib/components/sheets/role-scope-selects.svelte';
import FormInput from '$lib/components/form/form-input.svelte';
import { Label } from '$lib/components/ui/label';
import { Switch } from '$lib/components/ui/switch/index.js';
@@ -215,46 +216,20 @@
</Alert.Description>
</Alert.Root>
{/if}
- <div class="grid grid-cols-1 gap-4 sm:grid-cols-2">
- <div class="space-y-2">
- <Label for="federated-role" class="mb-0">{m.common_role()}</Label>
- <Select.Root type="single" bind:value={$inputs.roleId.value} disabled={isLoading}>
- <Select.Trigger id="federated-role" class="w-full {$inputs.roleId.error ? 'border-destructive' : ''}">
- <span>{roleSelectedLabel($inputs.roleId.value)}</span>
- </Select.Trigger>
- <Select.Content>
- {#each roles as role (role.id)}
- <Select.Item value={role.id} label={role.name}>
- <div class="flex flex-col items-start gap-0.5">
- <span class="font-medium">{role.name}</span>
- {#if role.description}
- <span class="text-muted-foreground text-xs">{role.description}</span>
- {/if}
- </div>
- </Select.Item>
- {/each}
- </Select.Content>
- </Select.Root>
- {#if $inputs.roleId.error}
- <p class="text-destructive text-xs font-medium">{$inputs.roleId.error}</p>
- {/if}
- </div>
- <div class="space-y-2">
- <Label for="federated-env" class="mb-0">{m.common_scope()}</Label>
- <Select.Root type="single" bind:value={$inputs.environmentId.value} disabled={isLoading}>
- <Select.Trigger id="federated-env" class="w-full">
- <span>{envSelectedLabel($inputs.environmentId.value)}</span>
- </Select.Trigger>
- <Select.Content>
- {#each envOptions as option (option.id)}
- <Select.Item value={option.id} label={option.name}>
- {option.name}
- </Select.Item>
- {/each}
- </Select.Content>
- </Select.Root>
- </div>
- </div>
+ <RoleScopeSelects
+ idPrefix="federated"
+ roleLabel={m.common_role()}
+ scopeLabel={m.common_scope()}
+ {roles}
+ {envOptions}
+ bind:roleValue={$inputs.roleId.value}
+ bind:environmentValue={$inputs.environmentId.value}
+ roleError={$inputs.roleId.error}
+ {roleSelectedLabel}
+ {envSelectedLabel}
+ disabled={isLoading}
+ class="grid grid-cols-1 gap-4 sm:grid-cols-2"
+ />
<div class="grid grid-cols-1 gap-4 sm:grid-cols-2">
<FormInput
label={m.federated_credential_ttl_label()}
@@ -281,29 +256,20 @@
{m.federated_credential_enabled_description()}
</p>
</div>
+ <!-- fallow-ignore-next-line code-duplication per-sheet footer wrapper ({#snippet footer} -> shared SheetFooterActions); ResponsiveDialog requires a footer snippet in each sheet -->
</div>
</form>
{/snippet}
{#snippet footer()}
- <div class="flex w-full flex-row gap-2">
- <ArcaneButton
- action="cancel"
- tone="outline"
- type="button"
- class="flex-1"
- onclick={() => (open = false)}
- disabled={isLoading}
- />
- <ArcaneButton
- action={isEditMode ? 'save' : 'create'}
- type="submit"
- class="flex-1"
- disabled={isLoading}
- loading={isLoading}
- onclick={handleSubmit}
- customLabel={isEditMode ? m.common_save() : m.common_create()}
- />
- </div>
+ <SheetFooterActions
+ bind:open
+ cancelDisabled={isLoading}
+ submitAction={isEditMode ? 'save' : 'create'}
+ submitDisabled={isLoading}
+ submitLoading={isLoading}
+ onSubmit={handleSubmit}
+ submitLabel={isEditMode ? m.common_save() : m.common_create()}
+ />
{/snippet}
</ResponsiveDialog.Root>
diff --git a/frontend/src/lib/components/sheets/git-repository-sheet.svelte b/frontend/src/lib/components/sheets/git-repository-sheet.svelte
index 516a1b7c1..bc321f78c 100644
--- a/frontend/src/lib/components/sheets/git-repository-sheet.svelte
+++ b/frontend/src/lib/components/sheets/git-repository-sheet.svelte
@@ -1,6 +1,6 @@
<script lang="ts">
import * as ResponsiveDialog from '$lib/components/ui/responsive-dialog/index.js';
- import { ArcaneButton } from '$lib/components/arcane-button/index.js';
+ import SheetFooterActions from '$lib/components/sheets/sheet-footer-actions.svelte';
import FormInput from '$lib/components/form/form-input.svelte';
import SwitchWithLabel from '$lib/components/form/labeled-switch.svelte';
import * as Select from '$lib/components/ui/select/index.js';
@@ -252,25 +252,14 @@
{/snippet}
{#snippet footer()}
- <div class="flex w-full flex-row gap-2">
- <ArcaneButton
- action="cancel"
- tone="outline"
- type="button"
- class="flex-1"
- onclick={() => (open = false)}
- disabled={isLoading}
- />
-
- <ArcaneButton
- action={isEditMode ? 'save' : 'create'}
- type="submit"
- form="git-repository-form"
- class="flex-1"
- disabled={isLoading}
- loading={isLoading}
- customLabel={isEditMode ? m.common_save_changes() : m.common_add_button({ resource: m.resource_repository_cap() })}
- />
- </div>
+ <SheetFooterActions
+ bind:open
+ cancelDisabled={isLoading}
+ submitAction={isEditMode ? 'save' : 'create'}
+ submitForm="git-repository-form"
+ submitDisabled={isLoading}
+ submitLoading={isLoading}
+ submitLabel={isEditMode ? m.common_save_changes() : m.common_add_button({ resource: m.resource_repository_cap() })}
+ />
{/snippet}
</ResponsiveDialog.Root>
diff --git a/frontend/src/lib/components/sheets/image-pull-sheet.svelte b/frontend/src/lib/components/sheets/image-pull-sheet.svelte
index 7d7f7dd93..e522542ca 100644
--- a/frontend/src/lib/components/sheets/image-pull-sheet.svelte
+++ b/frontend/src/lib/components/sheets/image-pull-sheet.svelte
@@ -1,6 +1,6 @@
<script lang="ts">
import * as ResponsiveDialog from '$lib/components/ui/responsive-dialog/index.js';
- import { ArcaneButton } from '$lib/components/arcane-button/index.js';
+ import SheetFooterActions from '$lib/components/sheets/sheet-footer-actions.svelte';
import FormInput from '$lib/components/form/form-input.svelte';
import { z } from 'zod/v4';
import { createForm, preventDefault } from '$lib/utils/settings';
@@ -105,9 +105,6 @@
{/snippet}
{#snippet footer()}
- <div class="flex w-full flex-row gap-2">
- <ArcaneButton action="cancel" tone="outline" type="button" class="flex-1" onclick={() => (open = false)} />
- <ArcaneButton action="pull" type="submit" class="flex-1" onclick={handleSubmit} disabled={isPulling} />
- </div>
+ <SheetFooterActions bind:open submitAction="pull" onSubmit={handleSubmit} submitDisabled={isPulling} />
{/snippet}
</ResponsiveDialog.Root>
diff --git a/frontend/src/lib/components/sheets/new-environment-sheet.svelte b/frontend/src/lib/components/sheets/new-environment-sheet.svelte
index 3d37276e0..65c8bbd1c 100644
--- a/frontend/src/lib/components/sheets/new-environment-sheet.svelte
+++ b/frontend/src/lib/components/sheets/new-environment-sheet.svelte
@@ -8,6 +8,7 @@
import UrlInput from '$lib/components/form/url-input.svelte';
import { Spinner } from '$lib/components/ui/spinner/index.js';
import { CopyButton } from '$lib/components/ui/copy-button';
+ import AgentCommandBlock from '$lib/components/agent-command-block.svelte';
import type { CreateEnvironmentDTO, DeploymentSnippetFile } from '$lib/types/environment';
import { z } from 'zod/v4';
import { createForm, preventDefault } from '$lib/utils/settings';
@@ -280,25 +281,12 @@
<Spinner class="size-6" />
</div>
{:else if createdEnvironment.dockerRun && createdEnvironment.dockerCompose}
- <div class="space-y-2">
- <div class="text-sm font-medium">{m.environments_docker_run_command()}</div>
- <div class="relative">
- <pre class="bg-muted overflow-x-auto rounded-md p-3 text-xs"><code>{createdEnvironment.dockerRun}</code></pre>
- <div class="absolute top-2 right-2">
- <CopyButton text={createdEnvironment.dockerRun} size="icon" class="size-7" />
- </div>
- </div>
- </div>
-
- <div class="space-y-2">
- <div class="text-sm font-medium">{m.environments_docker_compose()}</div>
- <div class="relative">
- <pre class="bg-muted overflow-x-auto rounded-md p-3 text-xs"><code>{createdEnvironment.dockerCompose}</code></pre>
- <div class="absolute top-2 right-2">
- <CopyButton text={createdEnvironment.dockerCompose} size="icon" class="size-7" />
- </div>
- </div>
- </div>
+ <AgentCommandBlock
+ dockerRunLabel={m.environments_docker_run_command()}
+ dockerRun={createdEnvironment.dockerRun}
+ dockerComposeLabel={m.environments_docker_compose()}
+ dockerCompose={createdEnvironment.dockerCompose}
+ />
{/if}
<ArcaneButton action="base" class="w-full" onclick={handleDone} customLabel={m.common_done()} />
diff --git a/frontend/src/lib/components/sheets/oidc-mapping-form-sheet.svelte b/frontend/src/lib/components/sheets/oidc-mapping-form-sheet.svelte
index 31d6109ce..9c20de12c 100644
--- a/frontend/src/lib/components/sheets/oidc-mapping-form-sheet.svelte
+++ b/frontend/src/lib/components/sheets/oidc-mapping-form-sheet.svelte
@@ -1,9 +1,8 @@
<script lang="ts">
import * as ResponsiveDialog from '$lib/components/ui/responsive-dialog/index.js';
- import * as Select from '$lib/components/ui/select';
- import { ArcaneButton } from '$lib/components/arcane-button/index.js';
+ import SheetFooterActions from '$lib/components/sheets/sheet-footer-actions.svelte';
+ import RoleScopeSelects from '$lib/components/sheets/role-scope-selects.svelte';
import FormInput from '$lib/components/form/form-input.svelte';
- import { Label } from '$lib/components/ui/label';
import type { OidcRoleMapping, Role } from '$lib/types/auth';
import type { Environment } from '$lib/types/environment';
import { z } from 'zod/v4';
@@ -74,67 +73,32 @@
bind:input={$inputs.claimValue}
/>
- <div class="space-y-2">
- <Label for="oidc-mapping-role" class="mb-0">{m.oidc_mappings_role_label()}</Label>
- <Select.Root type="single" bind:value={$inputs.roleId.value} disabled={isLoading}>
- <Select.Trigger id="oidc-mapping-role" class="w-full {$inputs.roleId.error ? 'border-destructive' : ''}">
- <span>{selectedLabel.role($inputs.roleId.value)}</span>
- </Select.Trigger>
- <Select.Content>
- {#each roles as role (role.id)}
- <Select.Item value={role.id} label={role.name}>
- <div class="flex flex-col items-start gap-0.5">
- <span class="font-medium">{role.name}</span>
- {#if role.description}
- <span class="text-muted-foreground text-xs">{role.description}</span>
- {/if}
- </div>
- </Select.Item>
- {/each}
- </Select.Content>
- </Select.Root>
- {#if $inputs.roleId.error}
- <p class="text-destructive text-xs font-medium">{$inputs.roleId.error}</p>
- {/if}
- </div>
-
- <div class="space-y-2">
- <Label for="oidc-mapping-env" class="mb-0">{m.oidc_mappings_scope_label()}</Label>
- <Select.Root type="single" bind:value={$inputs.environmentId.value} disabled={isLoading}>
- <Select.Trigger id="oidc-mapping-env" class="w-full">
- <span>{selectedLabel.environment($inputs.environmentId.value)}</span>
- </Select.Trigger>
- <Select.Content>
- {#each envOptions as option (option.id)}
- <Select.Item value={option.id} label={option.name}>
- {option.name}
- </Select.Item>
- {/each}
- </Select.Content>
- </Select.Root>
- </div>
+ <RoleScopeSelects
+ idPrefix="oidc-mapping"
+ roleLabel={m.oidc_mappings_role_label()}
+ scopeLabel={m.oidc_mappings_scope_label()}
+ {roles}
+ {envOptions}
+ bind:roleValue={$inputs.roleId.value}
+ bind:environmentValue={$inputs.environmentId.value}
+ roleError={$inputs.roleId.error}
+ roleSelectedLabel={selectedLabel.role}
+ envSelectedLabel={selectedLabel.environment}
+ disabled={isLoading}
+ />
+ <!-- fallow-ignore-next-line code-duplication per-sheet footer wrapper ({#snippet footer} -> shared SheetFooterActions); ResponsiveDialog requires a footer snippet in each sheet -->
</form>
{/snippet}
{#snippet footer()}
- <div class="flex w-full flex-row gap-2">
- <ArcaneButton
- action="cancel"
- tone="outline"
- type="button"
- class="flex-1"
- onclick={() => (open = false)}
- disabled={isLoading}
- />
- <ArcaneButton
- action={isEditMode ? 'save' : 'create'}
- type="submit"
- class="flex-1"
- disabled={isLoading}
- loading={isLoading}
- onclick={handleSubmit}
- customLabel={isEditMode ? m.common_save() : m.common_create()}
- />
- </div>
+ <SheetFooterActions
+ bind:open
+ cancelDisabled={isLoading}
+ submitAction={isEditMode ? 'save' : 'create'}
+ submitDisabled={isLoading}
+ submitLoading={isLoading}
+ onSubmit={handleSubmit}
+ submitLabel={isEditMode ? m.common_save() : m.common_create()}
+ />
{/snippet}
</ResponsiveDialog.Root>
diff --git a/frontend/src/lib/components/sheets/role-scope-selects.svelte b/frontend/src/lib/components/sheets/role-scope-selects.svelte
new file mode 100644
index 000000000..62ef5de00
--- /dev/null
+++ b/frontend/src/lib/components/sheets/role-scope-selects.svelte
@@ -0,0 +1,86 @@
+<script lang="ts">
+ import { Label } from '$lib/components/ui/label/index.js';
+ import * as Select from '$lib/components/ui/select/index.js';
+
+ interface RoleOption {
+ id: string;
+ name: string;
+ description?: string | null;
+ }
+
+ interface EnvOption {
+ id: string;
+ name: string;
+ }
+
+ interface Props {
+ idPrefix: string;
+ roleLabel: string;
+ scopeLabel: string;
+ roles: RoleOption[];
+ envOptions: EnvOption[];
+ roleValue?: string;
+ environmentValue?: string;
+ roleError?: string | null;
+ roleSelectedLabel: (value: string) => string;
+ envSelectedLabel: (value: string) => string;
+ disabled?: boolean;
+ class?: string;
+ }
+
+ let {
+ idPrefix,
+ roleLabel,
+ scopeLabel,
+ roles,
+ envOptions,
+ roleValue = $bindable(''),
+ environmentValue = $bindable(''),
+ roleError,
+ roleSelectedLabel,
+ envSelectedLabel,
+ disabled = false,
+ class: className = 'grid gap-4'
+ }: Props = $props();
+</script>
+
+<div class={className}>
+ <div class="space-y-2">
+ <Label for="{idPrefix}-role" class="mb-0">{roleLabel}</Label>
+ <Select.Root type="single" bind:value={roleValue} {disabled}>
+ <Select.Trigger id="{idPrefix}-role" class="w-full {roleError ? 'border-destructive' : ''}">
+ <span>{roleSelectedLabel(roleValue)}</span>
+ </Select.Trigger>
+ <Select.Content>
+ {#each roles as role (role.id)}
+ <Select.Item value={role.id} label={role.name}>
+ <div class="flex flex-col items-start gap-0.5">
+ <span class="font-medium">{role.name}</span>
+ {#if role.description}
+ <span class="text-muted-foreground text-xs">{role.description}</span>
+ {/if}
+ </div>
+ </Select.Item>
+ {/each}
+ </Select.Content>
+ </Select.Root>
+ {#if roleError}
+ <p class="text-destructive text-xs font-medium">{roleError}</p>
+ {/if}
+ </div>
+ <div class="space-y-2">
+ <Label for="{idPrefix}-env" class="mb-0">{scopeLabel}</Label>
+ <Select.Root type="single" bind:value={environmentValue} {disabled}>
+ <Select.Trigger id="{idPrefix}-env" class="w-full">
+ <span>{envSelectedLabel(environmentValue)}</span>
+ </Select.Trigger>
+ <Select.Content>
+ {#each envOptions as option (option.id)}
+ <Select.Item value={option.id} label={option.name}>
+ {option.name}
+ </Select.Item>
+ {/each}
+ </Select.Content>
+ </Select.Root>
+ </div>
+</div>
diff --git a/frontend/src/lib/components/sheets/sheet-footer-actions.svelte b/frontend/src/lib/components/sheets/sheet-footer-actions.svelte
new file mode 100644
index 000000000..8948e9e45
--- /dev/null
+++ b/frontend/src/lib/components/sheets/sheet-footer-actions.svelte
@@ -0,0 +1,57 @@
+<script lang="ts">
+ import { ArcaneButton } from '$lib/components/arcane-button/index.js';
+ import type { Action, ArcaneButtonTone } from '$lib/components/arcane-button/variants';
+
+ interface Props {
+ open?: boolean;
+ onCancel?: () => void;
+ cancelDisabled?: boolean;
+ showSubmit?: boolean;
+ submitAction?: Action;
+ submitTone?: ArcaneButtonTone;
+ submitLabel?: string;
+ submitDisabled?: boolean;
+ submitLoading?: boolean;
+ submitForm?: string;
+ onSubmit?: (e: MouseEvent & { currentTarget: EventTarget & HTMLButtonElement }) => void;
+ }
+
+ let {
+ open = $bindable(),
+ onCancel,
+ cancelDisabled = false,
+ showSubmit = true,
+ submitAction = 'create',
+ submitTone,
+ submitLabel,
+ submitDisabled = false,
+ submitLoading = false,
+ submitForm,
+ onSubmit
+ }: Props = $props();
+
+ function handleCancel() {
+ if (onCancel) {
+ onCancel();
+ } else {
+ open = false;
+ }
+ }
+</script>
+
+<div class="flex w-full flex-row gap-2">
+ <ArcaneButton action="cancel" tone="outline" type="button" class="flex-1" onclick={handleCancel} disabled={cancelDisabled} />
+ {#if showSubmit}
+ <ArcaneButton
+ action={submitAction}
+ tone={submitTone}
+ type="submit"
+ form={submitForm}
+ class="flex-1"
+ disabled={submitDisabled}
+ loading={submitLoading}
+ onclick={onSubmit}
+ customLabel={submitLabel}
+ />
+ {/if}
+</div>
diff --git a/frontend/src/lib/components/sheets/user-form-sheet.svelte b/frontend/src/lib/components/sheets/user-form-sheet.svelte
index 41cce335a..652903e81 100644
--- a/frontend/src/lib/components/sheets/user-form-sheet.svelte
+++ b/frontend/src/lib/components/sheets/user-form-sheet.svelte
@@ -1,7 +1,7 @@
<script lang="ts">
import * as ResponsiveDialog from '$lib/components/ui/responsive-dialog/index.js';
import * as Alert from '$lib/components/ui/alert/index.js';
- import { ArcaneButton } from '$lib/components/arcane-button/index.js';
+ import SheetFooterActions from '$lib/components/sheets/sheet-footer-actions.svelte';
import FormInput from '$lib/components/form/form-input.svelte';
import RoleAssignmentsEditor from '$lib/components/forms/role-assignments-editor.svelte';
import type { User } from '$lib/types/auth';
@@ -196,28 +196,19 @@
{/if}
</div>
</IfPermitted>
+ <!-- fallow-ignore-next-line code-duplication per-sheet footer wrapper ({#snippet footer} -> shared SheetFooterActions); ResponsiveDialog requires a footer snippet in each sheet -->
</form>
{/snippet}
{#snippet footer()}
- <div class="flex w-full flex-row gap-2">
- <ArcaneButton
- action="cancel"
- tone="outline"
- type="button"
- class="flex-1"
- onclick={() => (open = false)}
- disabled={isLoading}
- />
- <ArcaneButton
- action={isEditMode ? 'save' : 'create'}
- type="submit"
- class="flex-1"
- disabled={isLoading}
- loading={isLoading}
- onclick={handleSubmit}
- customLabel={isEditMode ? m.users_save_changes() : m.common_create_button({ resource: m.resource_user_cap() })}
- />
- </div>
+ <SheetFooterActions
+ bind:open
+ cancelDisabled={isLoading}
+ submitAction={isEditMode ? 'save' : 'create'}
+ submitDisabled={isLoading}
+ submitLoading={isLoading}
+ onSubmit={handleSubmit}
+ submitLabel={isEditMode ? m.users_save_changes() : m.common_create_button({ resource: m.resource_user_cap() })}
+ />
{/snippet}
</ResponsiveDialog.Root>
diff --git a/frontend/src/lib/components/sheets/webhook-form-sheet.svelte b/frontend/src/lib/components/sheets/webhook-form-sheet.svelte
index 21c9ce43b..da167c7cb 100644
--- a/frontend/src/lib/components/sheets/webhook-form-sheet.svelte
+++ b/frontend/src/lib/components/sheets/webhook-form-sheet.svelte
@@ -1,6 +1,6 @@
<script lang="ts">
import * as ResponsiveDialog from '$lib/components/ui/responsive-dialog/index.js';
- import { ArcaneButton } from '$lib/components/arcane-button/index.js';
+ import SheetFooterActions from '$lib/components/sheets/sheet-footer-actions.svelte';
import FormInput from '$lib/components/form/form-input.svelte';
import SelectWithLabel from '$lib/components/form/select-with-label.svelte';
import type { WebhookActionType, WebhookTargetType, CreateWebhook } from '$lib/types/environment';
@@ -221,24 +221,13 @@
{/snippet}
{#snippet footer()}
- <div class="flex w-full flex-row gap-2">
- <ArcaneButton
- action="cancel"
- tone="outline"
- type="button"
- class="flex-1"
- onclick={() => (open = false)}
- disabled={isLoading}
- />
- <ArcaneButton
- action="create"
- type="submit"
- class="flex-1"
- disabled={isLoading || (selectedTargetType !== 'updater' && !selectedTargetId)}
- loading={isLoading}
- onclick={handleSubmit}
- customLabel={m.webhook_create_button()}
- />
- </div>
+ <SheetFooterActions
+ bind:open
+ cancelDisabled={isLoading}
+ submitDisabled={isLoading || (selectedTargetType !== 'updater' && !selectedTargetId)}
+ submitLoading={isLoading}
+ onSubmit={handleSubmit}
+ submitLabel={m.webhook_create_button()}
+ />
{/snippet}
</ResponsiveDialog.Root>
diff --git a/frontend/src/lib/components/sidebar/sidebar-itemgroup.svelte b/frontend/src/lib/components/sidebar/sidebar-itemgroup.svelte
index 075c0a201..825f651c2 100644
--- a/frontend/src/lib/components/sidebar/sidebar-itemgroup.svelte
+++ b/frontend/src/lib/components/sidebar/sidebar-itemgroup.svelte
@@ -4,6 +4,7 @@
import { page } from '$app/state';
import { useSidebar } from '$lib/components/ui/sidebar/context.svelte.js';
import type { ShortcutKey } from '$lib/utils/navigation';
+ import type { Snippet } from 'svelte';
import { ArrowRightIcon } from '$lib/icons';
import SidebarCollapsibleItem from './sidebar-collapsible-item.svelte';
import SidebarItemTooltipContent from './sidebar-item-tooltip-content.svelte';
@@ -74,6 +75,29 @@
const shortcutsEnabled = $derived($settingsStore?.keyboardShortcutsEnabled ?? true);
</script>
+{#snippet itemAnchor(entry: { title: string; url: string; icon?: typeof ArrowRightIcon }, props: Record<string, unknown>)}
+ {@const Icon = entry.icon}
+ <a href={entry.url} {...props}>
+ {#if entry.icon}
+ <Icon />
+ {/if}
+ <span>{entry.title}</span>
+ </a>
+{/snippet}
+
+{#snippet menuEntry(
+ entry: { title: string; url: string; icon?: typeof ArrowRightIcon; isActive: boolean },
+ tooltip: Snippet | undefined
+)}
+ <Sidebar.MenuItem>
+ <Sidebar.MenuButton isActive={entry.isActive} tooltipContent={tooltip}>
+ {#snippet child({ props })}
+ {@render itemAnchor(entry, props)}
+ {/snippet}
+ </Sidebar.MenuButton>
+ </Sidebar.MenuItem>
+{/snippet}
+
<Sidebar.Group class="p-1.5">
<Sidebar.GroupLabel class="h-7 px-1.5">{label}</Sidebar.GroupLabel>
<Sidebar.Menu class="gap-0.5">
@@ -90,37 +114,13 @@
onmouseenter={() => (hoveredGroup = item.url)}
onmouseleave={() => (hoveredGroup = null)}
>
- <Sidebar.MenuItem>
- <Sidebar.MenuButton isActive={item.isActive} {tooltipContent}>
- {#snippet child({ props })}
- {@const Icon = item.icon}
- <a href={item.url} {...props}>
- {#if item.icon}
- <Icon />
- {/if}
- <span>{item.title}</span>
- </a>
- {/snippet}
- </Sidebar.MenuButton>
- </Sidebar.MenuItem>
+ {@render menuEntry(item, tooltipContent)}
{#if groupExpanded}
{#each item.items ?? [] as subItem (subItem.url)}
{#snippet subItemTooltipContent()}
<SidebarItemTooltipContent title={subItem.title} shortcut={subItem.shortcut} includeTitle={true} />
{/snippet}
- <Sidebar.MenuItem>
- <Sidebar.MenuButton isActive={subItem.isActive} tooltipContent={subItemTooltipContent}>
- {#snippet child({ props })}
- {@const SubIcon = subItem.icon}
- <a href={subItem.url} {...props}>
- {#if subItem.icon}
- <SubIcon />
- {/if}
- <span>{subItem.title}</span>
- </a>
- {/snippet}
- </Sidebar.MenuButton>
- </Sidebar.MenuItem>
+ {@render menuEntry(subItem, subItemTooltipContent)}
{/each}
{/if}
</div>
@@ -136,13 +136,7 @@
<Sidebar.MenuSubItem>
<Sidebar.MenuSubButton isActive={subItem.isActive} size="md">
{#snippet child({ props })}
- {@const SubIcon = subItem.icon}
- <a href={subItem.url} {...props}>
- {#if subItem.icon}
- <SubIcon />
- {/if}
- <span>{subItem.title}</span>
- </a>
+ {@render itemAnchor(subItem, props)}
{/snippet}
</Sidebar.MenuSubButton>
</Sidebar.MenuSubItem>
@@ -165,22 +159,10 @@
{#snippet simpleItemTooltipContent()}
<SidebarItemTooltipContent title={item.title} shortcut={item.shortcut} includeTitle={includeTitleInTooltip} />
{/snippet}
- <Sidebar.MenuItem>
- <Sidebar.MenuButton
- isActive={item.isActive}
- tooltipContent={collapsed || (shortcutsEnabled && !!item.shortcut?.length) ? simpleItemTooltipContent : undefined}
- >
- {#snippet child({ props })}
- {@const Icon = item.icon}
- <a href={item.url} {...props}>
- {#if item.icon}
- <Icon />
- {/if}
- <span>{item.title}</span>
- </a>
- {/snippet}
- </Sidebar.MenuButton>
- </Sidebar.MenuItem>
+ {@render menuEntry(
+ item,
+ collapsed || (shortcutsEnabled && !!item.shortcut?.length) ? simpleItemTooltipContent : undefined
+ )}
{/if}
{/each}
</Sidebar.Menu>
diff --git a/frontend/src/lib/components/sidebar/sidebar-updatebanner.svelte b/frontend/src/lib/components/sidebar/sidebar-updatebanner.svelte
index 3400ebafe..911fdfa26 100644
--- a/frontend/src/lib/components/sidebar/sidebar-updatebanner.svelte
+++ b/frontend/src/lib/components/sidebar/sidebar-updatebanner.svelte
@@ -8,6 +8,7 @@
import UpdateCenterDialog from '$lib/components/dialogs/update-center-dialog.svelte';
import { DownloadIcon } from '$lib/icons';
import { useUpgradeCheck } from '$lib/hooks/use-upgrade-check.svelte';
+ import UpdateAvailableBanner from './update-available-banner.svelte';
let {
isCollapsed,
@@ -47,25 +48,13 @@
<Separator.Root class="mb-2 opacity-30" />
{#if !isCollapsed}
- <button
- type="button"
- onclick={upgradeCheck.openDialog}
+ <UpdateAvailableBanner
+ class="rounded-lg px-2.5 py-2"
+ label={m.sidebar_update_available()}
+ versionChip={upgradeCheck.versionChip}
disabled={upgradeCheck.upgrading || upgradeCheck.checkingUpgrade}
- class="group hover:bg-muted/50 focus-visible:ring-primary/40 flex w-full items-center gap-2.5 rounded-lg px-2.5 py-2 text-left transition-colors focus-visible:ring-2 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-60"
- >
- <span class="relative flex size-2 shrink-0 items-center justify-center">
- <span class="absolute inline-flex size-2 animate-ping rounded-full bg-blue-500 opacity-60"></span>
- <span class="relative inline-flex size-1.5 rounded-full bg-blue-500"></span>
- </span>
- <span class="text-foreground flex-1 text-sm font-medium">
- {m.sidebar_update_available()}
- </span>
- {#if upgradeCheck.versionChip}
- <span class="bg-muted text-muted-foreground rounded-md px-1.5 py-0.5 font-mono text-[11px]">
- {upgradeCheck.versionChip}
- </span>
- {/if}
- </button>
+ onclick={upgradeCheck.openDialog}
+ />
{:else}
<Tooltip.Root>
<Tooltip.Trigger>
diff --git a/frontend/src/lib/components/sidebar/update-available-banner.svelte b/frontend/src/lib/components/sidebar/update-available-banner.svelte
new file mode 100644
index 000000000..314b83ddc
--- /dev/null
+++ b/frontend/src/lib/components/sidebar/update-available-banner.svelte
@@ -0,0 +1,40 @@
+<script lang="ts">
+ import { cn } from '$lib/utils';
+
+ let {
+ label,
+ versionChip,
+ disabled = false,
+ class: className,
+ onclick
+ }: {
+ label: string;
+ versionChip?: string | null;
+ disabled?: boolean;
+ class?: string;
+ onclick?: () => void;
+ } = $props();
+</script>
+
+<button
+ type="button"
+ {onclick}
+ {disabled}
+ class={cn(
+ 'group hover:bg-muted/50 focus-visible:ring-primary/40 flex w-full items-center gap-2.5 text-left transition-colors focus-visible:ring-2 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-60',
+ className
+ )}
+>
+ <span class="relative flex size-2 shrink-0 items-center justify-center">
+ <span class="absolute inline-flex size-2 animate-ping rounded-full bg-blue-500 opacity-60"></span>
+ <span class="relative inline-flex size-1.5 rounded-full bg-blue-500"></span>
+ </span>
+ <span class="text-foreground flex-1 text-sm font-medium">
+ {label}
+ </span>
+ {#if versionChip}
+ <span class="bg-muted text-muted-foreground rounded-md px-1.5 py-0.5 font-mono text-[11px]">
+ {versionChip}
+ </span>
+ {/if}
+</button>
diff --git a/frontend/src/lib/components/ui/copy-button/copy-button.svelte b/frontend/src/lib/components/ui/copy-button/copy-button.svelte
index 597969cfe..3c2028b77 100644
--- a/frontend/src/lib/components/ui/copy-button/copy-button.svelte
+++ b/frontend/src/lib/components/ui/copy-button/copy-button.svelte
@@ -39,6 +39,17 @@
});
</script>
+{#snippet idleIcon()}
+ <div in:scale={{ duration: animationDuration, start: 0.85 }}>
+ {#if icon}
+ {@render icon()}
+ {:else}
+ <CopyIcon tabindex={-1} />
+ {/if}
+ <span class="sr-only">{m.common_copy()}</span>
+ </div>
+{/snippet}
+
{#if isSecure}
<ArcaneButton
bind:ref
@@ -66,14 +77,7 @@
<span class="sr-only">{m.common_copy_failed()}</span>
</div>
{:else}
- <div in:scale={{ duration: animationDuration, start: 0.85 }}>
- {#if icon}
- {@render icon()}
- {:else}
- <CopyIcon tabindex={-1} />
- {/if}
- <span class="sr-only">{m.common_copy()}</span>
- </div>
+ {@render idleIcon()}
{/if}
{@render children?.()}
</ArcaneButton>
@@ -91,14 +95,7 @@
name="copy"
disabled
>
- <div in:scale={{ duration: animationDuration, start: 0.85 }}>
- {#if icon}
- {@render icon()}
- {:else}
- <CopyIcon tabindex={-1} />
- {/if}
- <span class="sr-only">{m.common_copy()}</span>
- </div>
+ {@render idleIcon()}
{@render children?.()}
</ArcaneButton>
</Tooltip.Trigger>
diff --git a/frontend/src/lib/components/ui/form/form-field.svelte b/frontend/src/lib/components/ui/form/form-field.svelte
index 8891fb4b6..32c22109b 100644
--- a/frontend/src/lib/components/ui/form/form-field.svelte
+++ b/frontend/src/lib/components/ui/form/form-field.svelte
@@ -20,6 +20,7 @@
}: FormPrimitive.FieldProps<T, U> & WithoutChildren<WithElementRef<HTMLAttributes<HTMLDivElement>>> = $props();
</script>
+<!-- fallow-ignore-next-line code-duplication vendored shadcn-svelte; keep in sync with form-element-field upstream -->
<FormPrimitive.Field {form} {name}>
{#snippet children({ constraints, errors, tainted, value })}
<div bind:this={ref} class={cn('space-y-2', className)} {...restProps}>
diff --git a/frontend/src/lib/components/ui/image-cropper/image-cropper-action-button.svelte b/frontend/src/lib/components/ui/image-cropper/image-cropper-action-button.svelte
new file mode 100644
index 000000000..7411d27ab
--- /dev/null
+++ b/frontend/src/lib/components/ui/image-cropper/image-cropper-action-button.svelte
@@ -0,0 +1,44 @@
+<script lang="ts" module>
+ import type { Action, ArcaneButtonSize, ArcaneButtonTone } from '$lib/components/arcane-button';
+
+ export type ImageCropperActionButtonProps = {
+ ref?: HTMLElement | null;
+ action?: Action;
+ size?: ArcaneButtonSize;
+ tone?: ArcaneButtonTone;
+ customLabel?: string;
+ disabled?: boolean;
+ class?: string;
+ onclick?: (event: MouseEvent & { currentTarget: EventTarget & HTMLButtonElement }) => void;
+ };
+</script>
+
+<script lang="ts">
+ import { ArcaneButton } from '$lib/components/arcane-button';
+
+ let {
+ ref = $bindable(null),
+ action,
+ size,
+ tone,
+ customLabel,
+ disabled,
+ class: className = undefined,
+ onclick,
+ onAction
+ }: ImageCropperActionButtonProps & { action: Action; onAction: () => void } = $props();
+</script>
+
+<ArcaneButton
+ bind:ref
+ {action}
+ {size}
+ {tone}
+ {customLabel}
+ {disabled}
+ class={className}
+ onclick={(event: MouseEvent & { currentTarget: EventTarget & HTMLButtonElement }) => {
+ onclick?.(event);
+ onAction();
+ }}
+/>
diff --git a/frontend/src/lib/components/ui/image-cropper/image-cropper-cancel.svelte b/frontend/src/lib/components/ui/image-cropper/image-cropper-cancel.svelte
index c2e8eec6c..c49a1cbcb 100644
--- a/frontend/src/lib/components/ui/image-cropper/image-cropper-cancel.svelte
+++ b/frontend/src/lib/components/ui/image-cropper/image-cropper-cancel.svelte
@@ -1,18 +1,7 @@
<script lang="ts">
- import { ArcaneButton, type Action, type ArcaneButtonSize, type ArcaneButtonTone } from '$lib/components/arcane-button';
import { m } from '$lib/paraglide/messages';
import { useImageCropperCancel } from './image-cropper-state.svelte.js';
-
- type CancelButtonProps = {
- ref?: HTMLElement | null;
- action?: Action;
- size?: ArcaneButtonSize;
- tone?: ArcaneButtonTone;
- customLabel?: string;
- disabled?: boolean;
- class?: string;
- onclick?: (event: MouseEvent & { currentTarget: EventTarget & HTMLButtonElement }) => void;
- };
+ import ActionButton, { type ImageCropperActionButtonProps } from './image-cropper-action-button.svelte';
let {
ref = $bindable(null),
@@ -23,12 +12,12 @@
tone = undefined,
class: className = undefined,
onclick
- }: CancelButtonProps = $props();
+ }: ImageCropperActionButtonProps = $props();
const cancelState = useImageCropperCancel();
</script>
-<ArcaneButton
+<ActionButton
bind:ref
{action}
{size}
@@ -36,8 +25,6 @@
{customLabel}
{disabled}
class={className}
- onclick={(event: MouseEvent & { currentTarget: EventTarget & HTMLButtonElement }) => {
- onclick?.(event);
- cancelState.onclick();
- }}
+ {onclick}
+ onAction={() => cancelState.onclick()}
/>
diff --git a/frontend/src/lib/components/ui/image-cropper/image-cropper-crop.svelte b/frontend/src/lib/components/ui/image-cropper/image-cropper-crop.svelte
index fd5a526ac..8efedbd07 100644
--- a/frontend/src/lib/components/ui/image-cropper/image-cropper-crop.svelte
+++ b/frontend/src/lib/components/ui/image-cropper/image-cropper-crop.svelte
@@ -1,18 +1,7 @@
<script lang="ts">
- import { ArcaneButton, type Action, type ArcaneButtonSize, type ArcaneButtonTone } from '$lib/components/arcane-button';
import { m } from '$lib/paraglide/messages';
import { useImageCropperCrop } from './image-cropper-state.svelte.js';
-
- type CropButtonProps = {
- ref?: HTMLElement | null;
- action?: Action;
- size?: ArcaneButtonSize;
- tone?: ArcaneButtonTone;
- customLabel?: string;
- disabled?: boolean;
- class?: string;
- onclick?: (event: MouseEvent & { currentTarget: EventTarget & HTMLButtonElement }) => void;
- };
+ import ActionButton, { type ImageCropperActionButtonProps } from './image-cropper-action-button.svelte';
let {
ref = $bindable(null),
@@ -23,12 +12,12 @@
tone = undefined,
class: className = undefined,
onclick
- }: CropButtonProps = $props();
+ }: ImageCropperActionButtonProps = $props();
const cropState = useImageCropperCrop();
</script>
-<ArcaneButton
+<ActionButton
bind:ref
{action}
{size}
@@ -36,8 +25,6 @@
{customLabel}
{disabled}
class={className}
- onclick={(event: MouseEvent & { currentTarget: EventTarget & HTMLButtonElement }) => {
- onclick?.(event);
- cropState.onclick();
- }}
+ {onclick}
+ onAction={() => cropState.onclick()}
/>
diff --git a/frontend/src/lib/components/ui/sidebar/sidebar-group-action.svelte b/frontend/src/lib/components/ui/sidebar/sidebar-group-action.svelte
index 929993ee1..268d996b9 100644
--- a/frontend/src/lib/components/ui/sidebar/sidebar-group-action.svelte
+++ b/frontend/src/lib/components/ui/sidebar/sidebar-group-action.svelte
@@ -27,6 +27,7 @@
});
</script>
+<!-- fallow-ignore-next-line code-duplication vendored shadcn-svelte; keep in sync with sidebar-menu-action / sidebar-menu-button upstream -->
{#if child}
{@render child({ props: mergedProps })}
{:else}
diff --git a/frontend/src/lib/components/ui/sidebar/sidebar-menu-action.svelte b/frontend/src/lib/components/ui/sidebar/sidebar-menu-action.svelte
index 191073b7b..2f51c9cd6 100644
--- a/frontend/src/lib/components/ui/sidebar/sidebar-menu-action.svelte
+++ b/frontend/src/lib/components/ui/sidebar/sidebar-menu-action.svelte
@@ -39,6 +39,7 @@
});
</script>
+<!-- fallow-ignore-next-line code-duplication vendored shadcn-svelte; keep in sync with sidebar-menu-button / sidebar-group-action upstream -->
{#if child}
{@render child({ props: mergedProps })}
{:else}
diff --git a/frontend/src/lib/components/update-status-banner.svelte b/frontend/src/lib/components/update-status-banner.svelte
new file mode 100644
index 000000000..5dbc90bca
--- /dev/null
+++ b/frontend/src/lib/components/update-status-banner.svelte
@@ -0,0 +1,41 @@
+<script lang="ts">
+ import type { Component } from 'svelte';
+
+ interface Props {
+ icon: Component;
+ wrapperClass: string;
+ gradientFrom: string;
+ gradientTo: string;
+ shadowColor: string;
+ titleClass: string;
+ descriptionClass: string;
+ title: string;
+ description: string;
+ }
+
+ let {
+ icon: Icon,
+ wrapperClass,
+ gradientFrom,
+ gradientTo,
+ shadowColor,
+ titleClass,
+ descriptionClass,
+ title,
+ description
+ }: Props = $props();
+</script>
+
+<div class={wrapperClass}>
+ <div class="flex items-center gap-3">
+ <div
+ class="flex h-10 w-10 items-center justify-center rounded-full bg-linear-to-br {gradientFrom} {gradientTo} shadow-lg {shadowColor}"
+ >
+ <Icon class="size-5 text-white" />
+ </div>
+ <div>
+ <div class="text-sm font-semibold {titleClass}">{title}</div>
+ <div class="text-xs {descriptionClass}">{description}</div>
+ </div>
+ </div>
+</div>
diff --git a/frontend/src/lib/components/vulnerability/cve-cell.svelte b/frontend/src/lib/components/vulnerability/cve-cell.svelte
new file mode 100644
index 000000000..33203ed88
--- /dev/null
+++ b/frontend/src/lib/components/vulnerability/cve-cell.svelte
@@ -0,0 +1,12 @@
+<script lang="ts">
+ let { vulnerabilityId }: { vulnerabilityId: string } = $props();
+</script>
+
+<a
+ href="https://nvd.nist.gov/vuln/detail/{vulnerabilityId}"
+ target="_blank"
+ rel="noopener noreferrer"
+ class="font-mono text-xs text-blue-600 hover:underline dark:text-blue-400"
+>
+ {vulnerabilityId}
+</a>
diff --git a/frontend/src/lib/components/vulnerability/fixed-cell.svelte b/frontend/src/lib/components/vulnerability/fixed-cell.svelte
new file mode 100644
index 000000000..531c9408b
--- /dev/null
+++ b/frontend/src/lib/components/vulnerability/fixed-cell.svelte
@@ -0,0 +1,7 @@
+<script lang="ts">
+ import { m } from '$lib/paraglide/messages';
+
+ let { fixedVersion }: { fixedVersion: string | null | undefined } = $props();
+</script>
+
+<span class="font-mono text-xs">{fixedVersion || m.vuln_no_fix()}</span>
diff --git a/frontend/src/lib/components/vulnerability/mono-cell.svelte b/frontend/src/lib/components/vulnerability/mono-cell.svelte
new file mode 100644
index 000000000..7b7d1a5c5
--- /dev/null
+++ b/frontend/src/lib/components/vulnerability/mono-cell.svelte
@@ -0,0 +1,5 @@
+<script lang="ts">
+ let { value }: { value: string } = $props();
+</script>
+
+<span class="font-mono text-xs">{value}</span>
diff --git a/frontend/src/lib/components/vulnerability/severity-badge.svelte b/frontend/src/lib/components/vulnerability/severity-badge.svelte
new file mode 100644
index 000000000..c2e1eddf3
--- /dev/null
+++ b/frontend/src/lib/components/vulnerability/severity-badge.svelte
@@ -0,0 +1,18 @@
+<script lang="ts">
+ import StatusBadge from '$lib/components/badges/status-badge.svelte';
+ import { m } from '$lib/paraglide/messages';
+
+ let { severity }: { severity: string | null | undefined } = $props();
+</script>
+
+{#if severity === 'CRITICAL'}
+ <StatusBadge text={m.vuln_severity_critical()} variant="red" size="sm" />
+{:else if severity === 'HIGH'}
+ <StatusBadge text={m.vuln_severity_high()} variant="orange" size="sm" />
+{:else if severity === 'MEDIUM'}
+ <StatusBadge text={m.vuln_severity_medium()} variant="amber" size="sm" />
+{:else if severity === 'LOW'}
+ <StatusBadge text={m.vuln_severity_low()} variant="lime" size="sm" />
+{:else}
+ <StatusBadge text={m.vuln_severity_unknown()} variant="gray" size="sm" />
+{/if}
diff --git a/frontend/src/lib/components/vulnerability/vulnerability-scan-panel.svelte b/frontend/src/lib/components/vulnerability/vulnerability-scan-panel.svelte
index 213f4a313..12166529c 100644
--- a/frontend/src/lib/components/vulnerability/vulnerability-scan-panel.svelte
+++ b/frontend/src/lib/components/vulnerability/vulnerability-scan-panel.svelte
@@ -1,10 +1,13 @@
<script lang="ts">
import ArcaneTable from '$lib/components/arcane-table/arcane-table.svelte';
import UniversalMobileCard from '$lib/components/arcane-table/cards/universal-mobile-card.svelte';
+ import CveCell from '$lib/components/vulnerability/cve-cell.svelte';
+ import MonoCell from '$lib/components/vulnerability/mono-cell.svelte';
+ import FixedCell from '$lib/components/vulnerability/fixed-cell.svelte';
+ import SeverityBadge from '$lib/components/vulnerability/severity-badge.svelte';
import { ArcaneButton } from '$lib/components/arcane-button';
import { queryKeys } from '$lib/query/query-keys';
import { Spinner } from '$lib/components/ui/spinner';
- import StatusBadge from '$lib/components/badges/status-badge.svelte';
import { m } from '$lib/paraglide/messages';
import { vulnerabilityService } from '$lib/services/vulnerability-service.js';
import type { ColumnSpec } from '$lib/components/arcane-table/arcane-table.types.svelte';
@@ -56,12 +59,13 @@
}
});
+ // fallow-ignore-next-line code-duplication parallel vulnerability views over different row types; cell logic already shared via components
const columns = $derived([
- { accessorKey: 'vulnerabilityId', title: 'CVE', cell: CveCell },
+ { accessorKey: 'vulnerabilityId', title: 'CVE', cell: CveCol },
{ accessorKey: 'pkgName', title: m.vuln_package(), cell: PackageCell },
{ id: 'vulnSeverity', accessorKey: 'severity', title: m.events_col_severity(), sortable: true, cell: SeverityCell },
{ accessorKey: 'installedVersion', title: m.vuln_installed_version(), cell: InstalledCell },
- { accessorKey: 'fixedVersion', title: m.vuln_fixed_version(), cell: FixedCell }
+ { accessorKey: 'fixedVersion', title: m.vuln_fixed_version(), cell: FixedCol }
] satisfies ColumnSpec<VulnerabilityRow>[]);
const mobileFields = [
@@ -225,41 +229,27 @@
});
</script>
-{#snippet CveCell({ item }: { item: VulnerabilityRow })}
- <a
- href="https://nvd.nist.gov/vuln/detail/{item.vulnerabilityId}"
- target="_blank"
- rel="noopener noreferrer"
- class="font-mono text-xs text-blue-600 hover:underline dark:text-blue-400"
- >
- {item.vulnerabilityId}
- </a>
+<!-- fallow-ignore-next-line code-duplication parallel vulnerability views over different row types; cell logic already shared via components -->
+{#snippet CveCol({ item }: { item: VulnerabilityRow })}
+ <CveCell vulnerabilityId={item.vulnerabilityId} />
{/snippet}
{#snippet PackageCell({ item }: { item: VulnerabilityRow })}
- <span class="font-mono text-xs">{item['pkgName']}</span>
+ <!-- fallow-ignore-next-line code-duplication parallel vulnerability views over different row types; cell logic already shared via components -->
+ <MonoCell value={item['pkgName']} />
{/snippet}
{#snippet SeverityCell({ item }: { item: VulnerabilityRow })}
- {#if item.severity === 'CRITICAL'}
- <StatusBadge text={m.vuln_severity_critical()} variant="red" size="sm" />
- {:else if item.severity === 'HIGH'}
- <StatusBadge text={m.vuln_severity_high()} variant="orange" size="sm" />
- {:else if item.severity === 'MEDIUM'}
- <StatusBadge text={m.vuln_severity_medium()} variant="amber" size="sm" />
- {:else if item.severity === 'LOW'}
- <StatusBadge text={m.vuln_severity_low()} variant="lime" size="sm" />
- {:else}
- <StatusBadge text={m.vuln_severity_unknown()} variant="gray" size="sm" />
- {/if}
+ <SeverityBadge severity={item.severity} />
{/snippet}
{#snippet InstalledCell({ item }: { item: VulnerabilityRow })}
- <span class="font-mono text-xs">{item['installedVersion']}</span>
+ <MonoCell value={item['installedVersion']} />
{/snippet}
-{#snippet FixedCell({ item }: { item: VulnerabilityRow })}
- <span class="font-mono text-xs">{item['fixedVersion'] || m.vuln_no_fix()}</span>
+{#snippet FixedCol({ item }: { item: VulnerabilityRow })}
+ <!-- fallow-ignore-next-line code-duplication parallel vulnerability views over different row types; cell logic already shared via components -->
+ <FixedCell fixedVersion={item['fixedVersion']} />
{/snippet}
{#snippet VulnerabilityMobileCard({
@@ -304,6 +294,15 @@
/>
{/snippet}
+{#snippet ScanMetaChips()}
+ <div class="text-muted-foreground mt-4 flex flex-wrap gap-2 text-xs">
+ <span class="bg-muted/50 rounded-full px-2 py-1">{scanDurationLabel}</span>
+ {#if scan?.scannerVersion}
+ <span class="bg-muted/50 rounded-full px-2 py-1">Trivy {scan.scannerVersion}</span>
+ {/if}
+ </div>
+{/snippet}
+
{#if isWorking}
<div class="flex items-center justify-center py-8">
<Spinner class="size-8" />
@@ -323,12 +322,7 @@
<p class="text-sm text-emerald-300/80">{m.vuln_no_vulnerabilities()}</p>
</div>
</div>
- <div class="text-muted-foreground mt-4 flex flex-wrap gap-2 text-xs">
- <span class="bg-muted/50 rounded-full px-2 py-1">{scanDurationLabel}</span>
- {#if scan?.scannerVersion}
- <span class="bg-muted/50 rounded-full px-2 py-1">Trivy {scan.scannerVersion}</span>
- {/if}
- </div>
+ {@render ScanMetaChips()}
</div>
{:else}
<div class="grid gap-4 xl:grid-cols-[minmax(0,1.2fr)_minmax(0,1fr)]">
@@ -357,12 +351,7 @@
</div>
{/each}
</div>
- <div class="text-muted-foreground mt-4 flex flex-wrap gap-2 text-xs">
- <span class="bg-muted/50 rounded-full px-2 py-1">{scanDurationLabel}</span>
- {#if scan?.scannerVersion}
- <span class="bg-muted/50 rounded-full px-2 py-1">Trivy {scan.scannerVersion}</span>
- {/if}
- </div>
+ {@render ScanMetaChips()}
</div>
<div class="grid gap-3 sm:grid-cols-2">
diff --git a/frontend/src/lib/layouts/resource-detail-layout.svelte b/frontend/src/lib/layouts/resource-detail-layout.svelte
index b77885159..2e18d8f50 100644
--- a/frontend/src/lib/layouts/resource-detail-layout.svelte
+++ b/frontend/src/lib/layouts/resource-detail-layout.svelte
@@ -43,6 +43,16 @@
const secondaryActions = $derived(actions.slice(1));
</script>
+{#snippet ActionMenuContent(items: DetailAction[], minWidthClass: string)}
+ <DropdownMenu.Content align="end" class={minWidthClass}>
+ {#each items as act (act.id)}
+ <DropdownMenu.Item onclick={act.onclick} disabled={act.disabled || act.loading}>
+ {act.loading ? act.loadingLabel || act.label : act.label}
+ </DropdownMenu.Item>
+ {/each}
+ </DropdownMenu.Content>
+{/snippet}
+
{#if showFloatingHeader}
<div
class="animate-in fade-in slide-in-from-top-2 fixed top-4 left-1/2 z-[var(--arcane-z-page-floating)] w-[calc(100%-2rem)] max-w-fit -translate-x-1/2 px-2 duration-200 sm:w-auto sm:px-0"
@@ -81,13 +91,7 @@
</ArcaneButton>
{/snippet}
</DropdownMenu.Trigger>
- <DropdownMenu.Content align="end" class="min-w-[140px]">
- {#each secondaryActions as act (act.id)}
- <DropdownMenu.Item onclick={act.onclick} disabled={act.disabled || act.loading}>
- {act.loading ? act.loadingLabel || act.label : act.label}
- </DropdownMenu.Item>
- {/each}
- </DropdownMenu.Content>
+ {@render ActionMenuContent(secondaryActions, 'min-w-[140px]')}
</DropdownMenu.Root>
{/if}
</div>
@@ -126,13 +130,7 @@
</ArcaneButton>
{/snippet}
</DropdownMenu.Trigger>
- <DropdownMenu.Content align="end" class="min-w-[160px]">
- {#each actions as act (act.id)}
- <DropdownMenu.Item onclick={act.onclick} disabled={act.disabled || act.loading}>
- {act.loading ? act.loadingLabel || act.label : act.label}
- </DropdownMenu.Item>
- {/each}
- </DropdownMenu.Content>
+ {@render ActionMenuContent(actions, 'min-w-[160px]')}
</DropdownMenu.Root>
{/if}
</div>
diff --git a/frontend/src/lib/layouts/settings-page-layout.svelte b/frontend/src/lib/layouts/settings-page-layout.svelte
index f5be72048..d1d4517bc 100644
--- a/frontend/src/lib/layouts/settings-page-layout.svelte
+++ b/frontend/src/lib/layouts/settings-page-layout.svelte
@@ -47,6 +47,20 @@
}>('settingsFormState');
</script>
+{#snippet ActionButtonList(buttons: SettingsActionButton[])}
+ {#each buttons as button}
+ <ArcaneButton
+ action={button.action}
+ customLabel={button.label}
+ loadingLabel={button.loadingLabel}
+ loading={button.loading}
+ disabled={button.disabled}
+ onclick={button.onclick}
+ size="sm"
+ />
+ {/each}
+{/snippet}
+
<div class={cn('px-2 py-4 pb-5 sm:px-6 sm:py-6 sm:pb-10 lg:px-8', className)}>
<div class="border-border/50 border-b pb-4 sm:pb-6">
<div class="flex items-center justify-between gap-4">
@@ -126,31 +140,11 @@
{#if pageType === 'management' && actionButtons.length > 0}
<div class="hidden items-center gap-2 sm:flex">
- {#each actionButtons as button}
- <ArcaneButton
- action={button.action}
- customLabel={button.label}
- loadingLabel={button.loadingLabel}
- loading={button.loading}
- disabled={button.disabled}
- onclick={button.onclick}
- size="sm"
- />
- {/each}
+ {@render ActionButtonList(actionButtons)}
</div>
<div class="flex items-center gap-2 sm:hidden">
- {#each mobileVisibleButtons as button}
- <ArcaneButton
- action={button.action}
- customLabel={button.label}
- loadingLabel={button.loadingLabel}
- loading={button.loading}
- disabled={button.disabled}
- onclick={button.onclick}
- size="sm"
- />
- {/each}
+ {@render ActionButtonList(mobileVisibleButtons)}
{#if mobileDropdownButtons.length > 0}
<DropdownMenu.Root>
diff --git a/frontend/src/lib/services/api-service.ts b/frontend/src/lib/services/api-service.ts
index bf94eae30..380091fb7 100644
--- a/frontend/src/lib/services/api-service.ts
+++ b/frontend/src/lib/services/api-service.ts
@@ -406,6 +406,12 @@ abstract class BaseAPIService {
upgradeInProgressInternal = value;
}
+ protected postFile<T = any>(url: string, file: File, params?: SearchParamsOption): Promise<T> {
+ const formData = new FormData();
+ formData.append('file', file);
+ return this.handleResponse<T>(this.api.post(url, formData, params !== undefined ? { params } : undefined));
+ }
+
protected async handleResponse<T>(promise: Promise<APIResponse>): Promise<T> {
const response = await promise;
const payload = response.data;
diff --git a/frontend/src/lib/services/project-service.ts b/frontend/src/lib/services/project-service.ts
index 2dd41a39e..fdc2cefbe 100644
--- a/frontend/src/lib/services/project-service.ts
+++ b/frontend/src/lib/services/project-service.ts
@@ -40,22 +40,9 @@ class ProjectService extends BaseAPIService {
const onLine = typeof onLineOrOptions === 'function' ? onLineOrOptions : undefined;
const options = typeof onLineOrOptions === 'function' ? maybeOptions : onLineOrOptions;
- const res = await fetch(url, {
- method: 'POST',
- headers: {
- 'Content-Type': 'application/json'
- },
- body: JSON.stringify(options ?? {})
- });
- const status = String(res.status);
- if (!res.ok || !res.body) {
- throw new Error(m.progress_deploy_failed_to_start({ status }));
- }
-
- await this.readProjectStream(res.body, onLine, (obj) => {
- if (obj?.error) {
- throw new Error(typeof obj.error === 'string' ? obj.error : obj.error?.message || m.progress_deploy_failed());
- }
+ await this.postProjectStream(url, options ?? {}, onLine, {
+ startFailed: (status) => m.progress_deploy_failed_to_start({ status }),
+ streamFailed: () => m.progress_deploy_failed()
});
// The deploy stream doesn't return the project object; fetch fresh details.
@@ -120,6 +107,30 @@ class ProjectService extends BaseAPIService {
await readNdjsonStream(body, onMessage, onLine);
}
+ private async postProjectStream(
+ url: string,
+ body: unknown,
+ onLine: ((data: any) => void) | undefined,
+ messages: { startFailed: (status: string) => string; streamFailed: () => string }
+ ): Promise<void> {
+ const res = await fetch(url, {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json'
+ },
+ body: JSON.stringify(body)
+ });
+ if (!res.ok || !res.body) {
+ throw new Error(messages.startFailed(String(res.status)));
+ }
+
+ await this.readProjectStream(res.body, onLine, (obj) => {
+ if (obj?.error) {
+ throw new Error(typeof obj.error === 'string' ? obj.error : obj.error?.message || messages.streamFailed());
+ }
+ });
+ }
+
async getProjectFile(projectId: string, relativePath: string): Promise<IncludeFile> {
const envId = await this.resolveEnvironmentId();
return this.getProjectFileForEnvironment(envId, projectId, relativePath);
@@ -233,21 +244,9 @@ class ProjectService extends BaseAPIService {
const envId = await environmentStore.getCurrentEnvironmentId();
const url = `/api/environments/${envId}/projects/${projectId}/build`;
- const res = await fetch(url, {
- method: 'POST',
- headers: {
- 'Content-Type': 'application/json'
- },
- body: JSON.stringify(options || {})
- });
- if (!res.ok || !res.body) {
- throw new Error(`Failed to start project build (${res.status})`);
- }
-
- await this.readProjectStream(res.body, onLine, (obj) => {
- if (obj?.error) {
- throw new Error(typeof obj.error === 'string' ? obj.error : obj.error?.message || m.build_failed());
- }
+ await this.postProjectStream(url, options || {}, onLine, {
+ startFailed: (status) => `Failed to start project build (${status})`,
+ streamFailed: () => m.build_failed()
});
}
diff --git a/frontend/src/lib/services/volume-backup-service.ts b/frontend/src/lib/services/volume-backup-service.ts
index f3ad251a7..54a73c726 100644
--- a/frontend/src/lib/services/volume-backup-service.ts
+++ b/frontend/src/lib/services/volume-backup-service.ts
@@ -70,9 +70,7 @@ class VolumeBackupService extends BaseAPIService {
async uploadAndRestore(volumeName: string, file: File): Promise<any> {
const envId = await environmentStore.getCurrentEnvironmentId();
- const formData = new FormData();
- formData.append('file', file);
- return this.handleResponse(this.api.post(`/environments/${envId}/volumes/${volumeName}/backups/upload`, formData));
+ return this.postFile(`/environments/${envId}/volumes/${volumeName}/backups/upload`, file);
}
}
diff --git a/frontend/src/lib/services/volume-browser-service.ts b/frontend/src/lib/services/volume-browser-service.ts
index 828f7ee0d..bed17f9c1 100644
--- a/frontend/src/lib/services/volume-browser-service.ts
+++ b/frontend/src/lib/services/volume-browser-service.ts
@@ -32,13 +32,7 @@ class VolumeBrowserService extends BaseAPIService {
async uploadFile(volumeName: string, path: string, file: File): Promise<any> {
const envId = await environmentStore.getCurrentEnvironmentId();
- const formData = new FormData();
- formData.append('file', file);
- return this.handleResponse(
- this.api.post(`/environments/${envId}/volumes/${volumeName}/browse/upload`, formData, {
- params: { path }
- })
- );
+ return this.postFile(`/environments/${envId}/volumes/${volumeName}/browse/upload`, file, { path });
}
async createDirectory(volumeName: string, path: string): Promise<any> {
diff --git a/frontend/src/lib/stores/activity.store.svelte.ts b/frontend/src/lib/stores/activity.store.svelte.ts
index 6389f7afa..5db1248e1 100644
--- a/frontend/src/lib/stores/activity.store.svelte.ts
+++ b/frontend/src/lib/stores/activity.store.svelte.ts
@@ -1,6 +1,11 @@
-import { browser } from '$app/env';
import { activityService } from '$lib/services/activity-service';
-import { environmentStore, LOCAL_DOCKER_ENVIRONMENT_ID } from '$lib/stores/environment.store.svelte';
+import { LOCAL_DOCKER_ENVIRONMENT_ID } from '$lib/stores/environment.store.svelte';
+import {
+ createEnvironmentStreamStore,
+ environmentDisplayName,
+ streamErrorMessage,
+ type StreamEnvStateBase
+} from '$lib/stores/environment-stream.svelte';
import type {
Activity,
ActivityClearHistorySummary,
@@ -15,16 +20,9 @@ import type { Environment } from '$lib/types/environment';
const ACTIVITY_LIST_LIMIT = 50;
const ACTIVITY_DETAIL_LIMIT = 500;
-const MAX_RECONNECT_DELAY = 15_000;
-const MAX_RECONNECT_ATTEMPTS = 20;
-type ActivityEnvironmentState = {
- id: string;
- name: string;
+type ActivityEnvironmentState = StreamEnvStateBase & {
activities: Activity[];
- loading: boolean;
- streamError: boolean;
- errorMessage?: string;
};
function sortActivitiesInternal(items: Activity[]): Activity[] {
@@ -60,25 +58,8 @@ function sourceEnvironmentIdInternal(activity: Activity | null | undefined): str
return activity?.sourceEnvironmentId || activity?.environmentId || LOCAL_DOCKER_ENVIRONMENT_ID;
}
-function environmentNameInternal(
- environment: Pick<Environment, 'id' | 'name'> | ActivityEnvironmentState | null | undefined
-): string {
- if (!environment) {
- return 'Local';
- }
- return environment.name || environment.id;
-}
-
-function errorMessageInternal(error: unknown): string | undefined {
- if (error instanceof Error && error.message.trim()) {
- return error.message;
- }
- return undefined;
-}
-
function createActivityStore() {
let _activities = $state<Activity[]>([]);
- let _environmentStates = $state<Record<string, ActivityEnvironmentState>>({});
let _environmentActivities = $state<Record<string, Activity[]>>({});
let _details = $state<Record<string, ActivityDetail>>({});
let _expandedActivityIds = $state<Record<string, boolean>>({});
@@ -89,105 +70,97 @@ function createActivityStore() {
let _open = $state(false);
let _currentEnvironmentId = $state(LOCAL_DOCKER_ENVIRONMENT_ID);
- let started = false;
- let unsubscribeEnvironment: (() => void) | null = null;
- // A single aggregated stream carries every environment's events; per-env
- // connections would exhaust the browser's 6-per-origin HTTP/1.1 limit.
- let streamAbortController: AbortController | null = null;
- let reconnectTimer: ReturnType<typeof setTimeout> | null = null;
- let reconnectAttempt = 0;
- let streamGeneration = 0;
- let _streamConnected = $state(false);
- let _streamFailed = $state(false);
-
- function createEnvironmentStateInternal(environment: Pick<Environment, 'id' | 'name'>): ActivityEnvironmentState {
- return {
- id: environment.id || LOCAL_DOCKER_ENVIRONMENT_ID,
- name: environmentNameInternal(environment),
- activities: [],
- loading: true,
- streamError: false
- };
- }
-
- function environmentStateInternal(environmentId: string): ActivityEnvironmentState | undefined {
- return _environmentStates[environmentId];
- }
-
- function updateEnvironmentStateInternal(
- environmentId: string,
- updater: (state: ActivityEnvironmentState) => ActivityEnvironmentState
- ) {
- const current =
- _environmentStates[environmentId] ?? createEnvironmentStateInternal({ id: environmentId, name: environmentId });
- _environmentStates = {
- ..._environmentStates,
- [environmentId]: updater(current)
- };
- }
-
- function setEnvironmentErrorInternal(environmentId: string, error: unknown) {
- updateEnvironmentStateInternal(environmentId, (state) => ({
- ...state,
- loading: false,
- streamError: true,
- errorMessage: errorMessageInternal(error)
- }));
- }
-
- function clearEnvironmentErrorInternal(environmentId: string) {
- updateEnvironmentStateInternal(environmentId, (state) => ({
- ...state,
- streamError: false,
- errorMessage: undefined
- }));
- }
-
- // A fresh stream re-emits error events for environments that are still
- // failing, so stale per-environment errors are cleared on every (re)connect.
- function clearAllEnvironmentErrorsInternal() {
- for (const environmentId of Object.keys(_environmentStates)) {
- if (environmentStateInternal(environmentId)?.streamError) {
- clearEnvironmentErrorInternal(environmentId);
+ const core = createEnvironmentStreamStore<ActivityEnvironmentState, ActivityStreamEvent>({
+ label: 'Activity',
+ createEnvironmentState(environment: Pick<Environment, 'id' | 'name'>): ActivityEnvironmentState {
+ return {
+ id: environment.id || LOCAL_DOCKER_ENVIRONMENT_ID,
+ name: environmentDisplayName(environment),
+ activities: [],
+ loading: true,
+ streamError: false
+ };
+ },
+ openStream: (signal) => activityService.openActivityStream(signal, ACTIVITY_LIST_LIMIT),
+ // REST-fetch history on start so the panel isn't stuck loading if the
+ // stream is slow or drops before delivering its first snapshot.
+ refreshOnStart: true,
+ applyEvent(environmentId, event) {
+ switch (event.type) {
+ case 'snapshot':
+ replaceEnvironmentSnapshotInternal(environmentId, event.activities ?? []);
+ break;
+ case 'activity':
+ if (event.activity) {
+ mergeActivityInternal(normalizeActivityInternal(event.activity, environmentId));
+ }
+ break;
+ case 'message':
+ if (event.message) {
+ mergeMessageInternal(event.message);
+ }
+ break;
+ case 'error':
+ core.setEnvironmentError(environmentId, new Error(event.error || 'Activity stream error'));
+ break;
}
+ },
+ async fetchSnapshot(environmentId, generation) {
+ core.updateEnvironmentState(environmentId, (state) => ({
+ ...state,
+ loading: true
+ }));
+ try {
+ const result = await activityService.getActivities(
+ { pagination: { page: 1, limit: ACTIVITY_LIST_LIMIT } },
+ environmentId
+ );
+ // The environment can be removed while the fetch is in-flight; don't resurrect it.
+ if (!core.isCurrentGeneration(generation) || !core.environmentState(environmentId)) {
+ return;
+ }
+ replaceEnvironmentSnapshotInternal(environmentId, result.data ?? []);
+ } catch (error) {
+ if (core.isCurrentGeneration(generation) && core.environmentState(environmentId)) {
+ console.warn('Failed to refresh activities:', error);
+ core.setEnvironmentError(environmentId, error);
+ }
+ }
+ },
+ onEnvironmentRemoved(environmentId) {
+ const nextActivities = { ..._environmentActivities };
+ delete nextActivities[environmentId];
+ _environmentActivities = nextActivities;
+ rebuildActivitiesInternal();
+ },
+ onEnvironmentRenamed(environmentId, name) {
+ const existing = core.environmentState(environmentId);
+ const updatedActivities = (_environmentActivities[environmentId] ?? existing?.activities ?? []).map((activity) =>
+ activity.sourceEnvironmentName
+ ? activity
+ : {
+ ...activity,
+ sourceEnvironmentName: name
+ }
+ );
+ _environmentActivities = {
+ ..._environmentActivities,
+ [environmentId]: updatedActivities
+ };
+ core.updateEnvironmentState(environmentId, (state) => ({
+ ...state,
+ name,
+ activities: updatedActivities
+ }));
+ rebuildActivitiesInternal();
+ },
+ onSelectedEnvironment(environment) {
+ _currentEnvironmentId = environment?.id ?? LOCAL_DOCKER_ENVIRONMENT_ID;
}
- }
-
- function nextGenerationInternal(): number {
- streamGeneration += 1;
- return streamGeneration;
- }
-
- function isCurrentGenerationInternal(generation: number): boolean {
- return streamGeneration === generation;
- }
-
- function clearReconnectTimerInternal() {
- if (reconnectTimer) {
- clearTimeout(reconnectTimer);
- reconnectTimer = null;
- }
- }
-
- function abortStreamInternal() {
- clearReconnectTimerInternal();
- streamAbortController?.abort();
- streamAbortController = null;
- _streamConnected = false;
- }
-
- function removeEnvironmentInternal(environmentId: string) {
- const nextStates = { ..._environmentStates };
- delete nextStates[environmentId];
- _environmentStates = nextStates;
- const nextActivities = { ..._environmentActivities };
- delete nextActivities[environmentId];
- _environmentActivities = nextActivities;
- rebuildActivitiesInternal();
- }
+ });
function normalizeActivityInternal(activity: Activity, environmentId: string): Activity {
- const state = environmentStateInternal(environmentId);
+ const state = core.environmentState(environmentId);
return {
...activity,
sourceEnvironmentId: activity.sourceEnvironmentId || environmentId,
@@ -198,7 +171,7 @@ function createActivityStore() {
function replaceEnvironmentSnapshotInternal(environmentId: string, activities: Activity[]) {
// Snapshots can still arrive (stream or in-flight REST) after the
// environment was removed locally; don't resurrect it.
- if (!environmentStateInternal(environmentId)) {
+ if (!core.environmentState(environmentId)) {
return;
}
const normalizedActivities = sortActivitiesInternal(
@@ -208,7 +181,7 @@ function createActivityStore() {
..._environmentActivities,
[environmentId]: normalizedActivities
};
- updateEnvironmentStateInternal(environmentId, (state) => ({
+ core.updateEnvironmentState(environmentId, (state) => ({
...state,
activities: normalizedActivities,
loading: false,
@@ -234,7 +207,7 @@ function createActivityStore() {
function mergeActivityInternal(activity: Activity) {
const environmentId = sourceEnvironmentIdInternal(activity);
const normalized = normalizeActivityInternal(activity, environmentId);
- const currentActivities = _environmentActivities[environmentId] ?? environmentStateInternal(environmentId)?.activities ?? [];
+ const currentActivities = _environmentActivities[environmentId] ?? core.environmentState(environmentId)?.activities ?? [];
const index = currentActivities.findIndex((item) => item.id === normalized.id);
const activities = sortActivitiesInternal(
index >= 0
@@ -245,7 +218,7 @@ function createActivityStore() {
..._environmentActivities,
[environmentId]: activities
};
- updateEnvironmentStateInternal(environmentId, (state) => {
+ core.updateEnvironmentState(environmentId, (state) => {
return {
...state,
activities,
@@ -284,224 +257,6 @@ function createActivityStore() {
};
}
- function applyStreamEventInternal(environmentId: string, event: ActivityStreamEvent) {
- // The aggregated stream can keep delivering events for an environment
- // for a short while after it was removed locally; don't resurrect it.
- if (event.type !== 'heartbeat' && !environmentStateInternal(environmentId)) {
- return;
- }
- switch (event.type) {
- case 'snapshot':
- replaceEnvironmentSnapshotInternal(environmentId, event.activities ?? []);
- break;
- case 'activity':
- if (event.activity) {
- mergeActivityInternal(normalizeActivityInternal(event.activity, environmentId));
- }
- break;
- case 'message':
- if (event.message) {
- mergeMessageInternal(event.message);
- }
- break;
- case 'heartbeat':
- _streamConnected = true;
- break;
- case 'error':
- setEnvironmentErrorInternal(environmentId, new Error(event.error || 'Activity stream error'));
- break;
- }
- }
-
- async function refreshEnvironmentInternal(environmentId: string, generation = streamGeneration) {
- updateEnvironmentStateInternal(environmentId, (state) => ({
- ...state,
- loading: true
- }));
- try {
- const result = await activityService.getActivities({ pagination: { page: 1, limit: ACTIVITY_LIST_LIMIT } }, environmentId);
- // The environment can be removed while the fetch is in-flight; don't resurrect it.
- if (!isCurrentGenerationInternal(generation) || !environmentStateInternal(environmentId)) {
- return;
- }
- replaceEnvironmentSnapshotInternal(environmentId, result.data ?? []);
- } catch (error) {
- if (isCurrentGenerationInternal(generation) && environmentStateInternal(environmentId)) {
- console.warn('Failed to refresh activities:', error);
- setEnvironmentErrorInternal(environmentId, error);
- }
- }
- }
-
- async function refreshInternal() {
- reconcileEnvironmentsInternal();
- await Promise.all(Object.keys(_environmentStates).map((environmentId) => refreshEnvironmentInternal(environmentId)));
- }
-
- async function connectStreamInternal(generation: number) {
- if (!browser || !isCurrentGenerationInternal(generation)) {
- return;
- }
-
- const controller = new AbortController();
- streamAbortController = controller;
- try {
- const response = await activityService.openActivityStream(controller.signal, ACTIVITY_LIST_LIMIT);
- if (!isCurrentGenerationInternal(generation) || !response.body) {
- if (streamAbortController === controller) {
- streamAbortController = null;
- }
- return;
- }
-
- _streamConnected = true;
- _streamFailed = false;
- reconnectAttempt = 0;
- clearAllEnvironmentErrorsInternal();
- await readJSONLinesInternal(response.body, generation);
- } catch (error) {
- if (!controller.signal.aborted && isCurrentGenerationInternal(generation)) {
- console.warn('Activity stream disconnected:', error);
- }
- } finally {
- if (streamAbortController === controller) {
- streamAbortController = null;
- }
- if (isCurrentGenerationInternal(generation)) {
- _streamConnected = false;
- if (!controller.signal.aborted) {
- scheduleReconnectInternal(generation);
- }
- }
- }
- }
-
- async function readJSONLinesInternal(stream: ReadableStream<Uint8Array>, generation: number) {
- const reader = stream.getReader();
- const decoder = new TextDecoder();
- let buffer = '';
-
- try {
- while (isCurrentGenerationInternal(generation)) {
- const { done, value } = await reader.read();
- if (done) {
- break;
- }
-
- buffer += decoder.decode(value, { stream: true });
- const lines = buffer.split('\n');
- buffer = lines.pop() ?? '';
- for (const line of lines) {
- handleStreamLineInternal(line);
- }
- }
-
- buffer += decoder.decode();
- if (buffer.trim()) {
- handleStreamLineInternal(buffer);
- }
- } finally {
- reader.releaseLock();
- }
- }
-
- function handleStreamLineInternal(line: string) {
- const trimmed = line.trim();
- if (!trimmed) {
- return;
- }
-
- try {
- const event = JSON.parse(trimmed) as ActivityStreamEvent;
- applyStreamEventInternal(event.environmentId || LOCAL_DOCKER_ENVIRONMENT_ID, event);
- } catch (error) {
- console.warn('Failed to parse activity stream line:', error);
- }
- }
-
- function scheduleReconnectInternal(generation: number) {
- if (!browser || !started || !isCurrentGenerationInternal(generation)) {
- return;
- }
-
- if (reconnectAttempt >= MAX_RECONNECT_ATTEMPTS) {
- _streamFailed = true;
- return;
- }
-
- clearReconnectTimerInternal();
- const delay = Math.min(1000 * 2 ** reconnectAttempt, MAX_RECONNECT_DELAY);
- reconnectAttempt += 1;
- reconnectTimer = setTimeout(() => {
- void connectStreamInternal(generation);
- }, delay);
- }
-
- function reconcileEnvironmentsInternal() {
- if (!browser || !started) {
- return;
- }
-
- // Track only enabled environments — they are the ones the aggregated
- // stream serves; a disabled environment would never leave "loading".
- const available = environmentStore.available.filter((environment) => environment.enabled);
- const environments =
- available.length > 0
- ? available
- : [
- {
- id: environmentStore.selected?.id ?? LOCAL_DOCKER_ENVIRONMENT_ID,
- name: environmentStore.selected?.name ?? 'Local'
- }
- ];
- const targetIds = new Set(environments.map((environment) => environment.id || LOCAL_DOCKER_ENVIRONMENT_ID));
-
- for (const environmentId of Object.keys(_environmentStates)) {
- if (!targetIds.has(environmentId)) {
- removeEnvironmentInternal(environmentId);
- }
- }
-
- for (const environment of environments) {
- const environmentId = environment.id || LOCAL_DOCKER_ENVIRONMENT_ID;
- const existing = environmentStateInternal(environmentId);
- if (!existing) {
- _environmentStates = {
- ..._environmentStates,
- [environmentId]: createEnvironmentStateInternal(environment)
- };
- // An already-open aggregated stream only picks new environments
- // up on its server-side reconcile tick; fetch once so the first
- // snapshot doesn't take up to that interval to appear.
- if (streamAbortController) {
- void refreshEnvironmentInternal(environmentId);
- }
- continue;
- }
-
- if (existing.name !== environmentNameInternal(environment)) {
- const updatedActivities = (_environmentActivities[environmentId] ?? existing.activities).map((activity) =>
- activity.sourceEnvironmentName
- ? activity
- : {
- ...activity,
- sourceEnvironmentName: environmentNameInternal(environment)
- }
- );
- _environmentActivities = {
- ..._environmentActivities,
- [environmentId]: updatedActivities
- };
- updateEnvironmentStateInternal(environmentId, (state) => ({
- ...state,
- name: environmentNameInternal(environment),
- activities: updatedActivities
- }));
- rebuildActivitiesInternal();
- }
- }
- }
-
function activityEnvironmentIdInternal(activityId: string): string {
const activity = _details[activityId]?.activity ?? _activities.find((item) => item.id === activityId) ?? null;
return sourceEnvironmentIdInternal(activity) || _currentEnvironmentId || LOCAL_DOCKER_ENVIRONMENT_ID;
@@ -564,7 +319,7 @@ function createActivityStore() {
}
function environmentFailuresInternal(): ActivityEnvironmentFailure[] {
- return Object.values(_environmentStates)
+ return Object.values(core.environmentStates)
.filter((state) => state.streamError)
.map((state) => ({
environmentId: state.id,
@@ -590,13 +345,13 @@ function createActivityStore() {
return _open;
},
get loading(): boolean {
- return Object.values(_environmentStates).some((state) => state.loading);
+ return Object.values(core.environmentStates).some((state) => state.loading);
},
get connected(): boolean {
- return _streamConnected;
+ return core.streamConnected;
},
get streamError(): boolean {
- return _streamFailed || Object.values(_environmentStates).some((state) => state.streamError);
+ return core.streamFailed || Object.values(core.environmentStates).some((state) => state.streamError);
},
get environmentFailures(): ActivityEnvironmentFailure[] {
return environmentFailuresInternal();
@@ -626,30 +381,9 @@ function createActivityStore() {
getActivity(activityId: string): Activity | null {
return _details[activityId]?.activity ?? _activities.find((item) => item.id === activityId) ?? null;
},
- start: async () => {
- if (!browser || started) {
- return;
- }
-
- started = true;
- await environmentStore.ready;
- _currentEnvironmentId = environmentStore.selected?.id ?? LOCAL_DOCKER_ENVIRONMENT_ID;
- reconcileEnvironmentsInternal();
- void connectStreamInternal(nextGenerationInternal());
- unsubscribeEnvironment = environmentStore.subscribeSelected((environment) => {
- _currentEnvironmentId = environment?.id ?? LOCAL_DOCKER_ENVIRONMENT_ID;
- reconcileEnvironmentsInternal();
- });
- },
- stop: () => {
- started = false;
- unsubscribeEnvironment?.();
- unsubscribeEnvironment = null;
- nextGenerationInternal();
- abortStreamInternal();
- reconnectAttempt = 0;
- },
- refresh: () => refreshInternal(),
+ start: () => core.start(),
+ stop: () => core.stop(),
+ refresh: () => core.refresh(),
cancelActivity: async (activityId: string) => {
if (!activityId || _cancellingIds[activityId]) {
return;
@@ -666,12 +400,12 @@ function createActivityStore() {
}
},
clearHistory: async (): Promise<ActivityClearHistorySummary> => {
- reconcileEnvironmentsInternal();
+ core.reconcileEnvironments();
let deleted = 0;
let succeeded = 0;
const failed: ActivityEnvironmentFailure[] = [];
- const states = Object.values(_environmentStates);
+ const states = Object.values(core.environmentStates);
await Promise.all(
states.map(async (state) => {
try {
@@ -682,7 +416,7 @@ function createActivityStore() {
failed.push({
environmentId: state.id,
environmentName: state.name,
- message: errorMessageInternal(error)
+ message: streamErrorMessage(error)
});
}
})
@@ -692,7 +426,7 @@ function createActivityStore() {
_expandedActivityIds = {};
_detailLoadingIds = {};
_detailErrorIds = {};
- await refreshInternal();
+ await core.refresh();
return {
deleted,
@@ -721,13 +455,7 @@ function createActivityStore() {
_details = nextDetails;
void loadDetailInternal(activityId);
},
- retryStream: () => {
- _streamFailed = false;
- reconnectAttempt = 0;
- clearAllEnvironmentErrorsInternal();
- abortStreamInternal();
- void connectStreamInternal(nextGenerationInternal());
- },
+ retryStream: () => core.retryStream(),
setActivityExpanded,
toggleActivity
};
diff --git a/frontend/src/lib/stores/dashboard.store.svelte.ts b/frontend/src/lib/stores/dashboard.store.svelte.ts
index 975f39d2d..86f83271a 100644
--- a/frontend/src/lib/stores/dashboard.store.svelte.ts
+++ b/frontend/src/lib/stores/dashboard.store.svelte.ts
@@ -1,149 +1,83 @@
import { browser } from '$app/env';
import { dashboardService } from '$lib/services/dashboard-service';
-import { environmentStore, LOCAL_DOCKER_ENVIRONMENT_ID } from '$lib/stores/environment.store.svelte';
+import { LOCAL_DOCKER_ENVIRONMENT_ID } from '$lib/stores/environment.store.svelte';
+import {
+ createEnvironmentStreamStore,
+ environmentDisplayName,
+ type StreamEnvStateBase
+} from '$lib/stores/environment-stream.svelte';
import type { DashboardSnapshot, DashboardStreamErrorCode, DashboardStreamEvent } from '$lib/types/shared';
import type { Environment } from '$lib/types/environment';
-const MAX_RECONNECT_DELAY = 15_000;
-const MAX_RECONNECT_ATTEMPTS = 20;
-
-type DashboardEnvironmentState = {
- id: string;
- name: string;
+type DashboardEnvironmentState = StreamEnvStateBase & {
snapshot: DashboardSnapshot | null;
// hasLoaded flips on the first-ever snapshot and never back: later errors
// keep showing the last-known data instead of skeletons or zeros.
hasLoaded: boolean;
- loading: boolean;
- streamError: boolean;
- errorMessage?: string;
errorCode?: DashboardStreamErrorCode;
};
-function environmentNameInternal(environment: Pick<Environment, 'id' | 'name'> | null | undefined): string {
- if (!environment) {
- return 'Local';
- }
- return environment.name || environment.id;
-}
-
-function errorMessageInternal(error: unknown): string | undefined {
- if (error instanceof Error && error.message.trim()) {
- return error.message;
- }
- return undefined;
-}
-
function createDashboardStore() {
- let _environmentStates = $state<Record<string, DashboardEnvironmentState>>({});
-
let started = false;
let debugAllGood = false;
- let unsubscribeEnvironment: (() => void) | null = null;
- // A single aggregated stream carries every environment's snapshots; per-env
- // pollers would multiply requests and break against agents on older versions
- // without a per-environment error story.
- let streamAbortController: AbortController | null = null;
- let reconnectTimer: ReturnType<typeof setTimeout> | null = null;
- let reconnectAttempt = 0;
- let streamGeneration = 0;
- let _streamConnected = $state(false);
- let _streamFailed = $state(false);
- function createEnvironmentStateInternal(environment: Pick<Environment, 'id' | 'name'>): DashboardEnvironmentState {
- return {
- id: environment.id || LOCAL_DOCKER_ENVIRONMENT_ID,
- name: environmentNameInternal(environment),
- snapshot: null,
- hasLoaded: false,
- loading: true,
- streamError: false
- };
- }
-
- function environmentStateInternal(environmentId: string): DashboardEnvironmentState | undefined {
- return _environmentStates[environmentId];
- }
-
- function updateEnvironmentStateInternal(
- environmentId: string,
- updater: (state: DashboardEnvironmentState) => DashboardEnvironmentState
- ) {
- const current =
- _environmentStates[environmentId] ?? createEnvironmentStateInternal({ id: environmentId, name: environmentId });
- _environmentStates = {
- ..._environmentStates,
- [environmentId]: updater(current)
- };
- }
-
- function setEnvironmentErrorInternal(environmentId: string, error: unknown, errorCode?: DashboardStreamErrorCode) {
- // Errors only flag the state; snapshot and hasLoaded are left untouched
- // so the card keeps rendering the last-known values.
- updateEnvironmentStateInternal(environmentId, (state) => ({
- ...state,
- loading: false,
- streamError: true,
- errorMessage: errorMessageInternal(error),
- errorCode
- }));
- }
-
- function clearEnvironmentErrorInternal(environmentId: string) {
- updateEnvironmentStateInternal(environmentId, (state) => ({
- ...state,
- streamError: false,
- errorMessage: undefined,
- errorCode: undefined
- }));
- }
-
- // A fresh stream re-emits error events for environments that are still
- // failing, so stale per-environment errors are cleared on every (re)connect.
- function clearAllEnvironmentErrorsInternal() {
- for (const environmentId of Object.keys(_environmentStates)) {
- if (environmentStateInternal(environmentId)?.streamError) {
- clearEnvironmentErrorInternal(environmentId);
+ const core = createEnvironmentStreamStore<DashboardEnvironmentState, DashboardStreamEvent>({
+ label: 'Dashboard',
+ refreshOnStart: true,
+ clearErrorExtra: { errorCode: undefined },
+ createEnvironmentState(environment: Pick<Environment, 'id' | 'name'>): DashboardEnvironmentState {
+ return {
+ id: environment.id || LOCAL_DOCKER_ENVIRONMENT_ID,
+ name: environmentDisplayName(environment),
+ snapshot: null,
+ hasLoaded: false,
+ loading: true,
+ streamError: false
+ };
+ },
+ openStream: (signal) => dashboardService.openDashboardStream(signal, debugAllGood),
+ applyEvent(environmentId, event) {
+ switch (event.type) {
+ case 'snapshot':
+ if (event.snapshot) {
+ replaceEnvironmentSnapshotInternal(environmentId, event.snapshot);
+ }
+ break;
+ case 'pending':
+ // The server confirms this environment is covered; the first
+ // snapshot or error for it will follow.
+ break;
+ case 'error':
+ core.setEnvironmentError(environmentId, new Error(event.error || 'Dashboard stream error'), {
+ errorCode: event.errorCode
+ });
+ break;
+ }
+ },
+ async fetchSnapshot(environmentId, generation) {
+ try {
+ const snapshot = await dashboardService.getDashboardForEnvironment(environmentId, { debugAllGood });
+ // The environment can be removed while the fetch is in-flight; don't resurrect it.
+ if (!core.isCurrentGeneration(generation) || !core.environmentState(environmentId)) {
+ return;
+ }
+ replaceEnvironmentSnapshotInternal(environmentId, snapshot);
+ } catch (error) {
+ if (core.isCurrentGeneration(generation) && core.environmentState(environmentId)) {
+ console.warn('Failed to refresh dashboard snapshot:', error);
+ core.setEnvironmentError(environmentId, error, { errorCode: undefined });
+ }
}
}
- }
-
- function nextGenerationInternal(): number {
- streamGeneration += 1;
- return streamGeneration;
- }
-
- function isCurrentGenerationInternal(generation: number): boolean {
- return streamGeneration === generation;
- }
-
- function clearReconnectTimerInternal() {
- if (reconnectTimer) {
- clearTimeout(reconnectTimer);
- reconnectTimer = null;
- }
- }
-
- function abortStreamInternal() {
- clearReconnectTimerInternal();
- streamAbortController?.abort();
- streamAbortController = null;
- _streamConnected = false;
- }
-
- function removeEnvironmentInternal(environmentId: string) {
- const nextStates = { ..._environmentStates };
- delete nextStates[environmentId];
- _environmentStates = nextStates;
- }
+ });
function replaceEnvironmentSnapshotInternal(environmentId: string, snapshot: DashboardSnapshot) {
// Snapshots can still arrive (stream or in-flight REST) after the
// environment was removed locally; don't resurrect it.
- if (!environmentStateInternal(environmentId)) {
+ if (!core.environmentState(environmentId)) {
return;
}
- updateEnvironmentStateInternal(environmentId, (state) => ({
+ core.updateEnvironmentState(environmentId, (state) => ({
...state,
snapshot,
hasLoaded: true,
@@ -154,216 +88,18 @@ function createDashboardStore() {
}));
}
- function applyStreamEventInternal(environmentId: string, event: DashboardStreamEvent) {
- // The aggregated stream can keep delivering events for an environment
- // for a short while after it was removed locally; don't resurrect it.
- if (event.type !== 'heartbeat' && !environmentStateInternal(environmentId)) {
- return;
- }
- switch (event.type) {
- case 'snapshot':
- if (event.snapshot) {
- replaceEnvironmentSnapshotInternal(environmentId, event.snapshot);
- }
- break;
- case 'pending':
- // The server confirms this environment is covered; the first
- // snapshot or error for it will follow.
- break;
- case 'heartbeat':
- _streamConnected = true;
- break;
- case 'error':
- setEnvironmentErrorInternal(environmentId, new Error(event.error || 'Dashboard stream error'), event.errorCode);
- break;
- }
- }
-
- async function refreshEnvironmentInternal(environmentId: string, generation = streamGeneration) {
- try {
- const snapshot = await dashboardService.getDashboardForEnvironment(environmentId, { debugAllGood });
- // The environment can be removed while the fetch is in-flight; don't resurrect it.
- if (!isCurrentGenerationInternal(generation) || !environmentStateInternal(environmentId)) {
- return;
- }
- replaceEnvironmentSnapshotInternal(environmentId, snapshot);
- } catch (error) {
- if (isCurrentGenerationInternal(generation) && environmentStateInternal(environmentId)) {
- console.warn('Failed to refresh dashboard snapshot:', error);
- setEnvironmentErrorInternal(environmentId, error);
- }
- }
- }
-
- async function refreshInternal(generation = streamGeneration) {
- reconcileEnvironmentsInternal();
- await Promise.all(
- Object.keys(_environmentStates).map((environmentId) => refreshEnvironmentInternal(environmentId, generation))
- );
- }
-
- async function connectStreamInternal(generation: number) {
- if (!browser || !isCurrentGenerationInternal(generation)) {
- return;
- }
-
- const controller = new AbortController();
- streamAbortController = controller;
- try {
- const response = await dashboardService.openDashboardStream(controller.signal, debugAllGood);
- if (!isCurrentGenerationInternal(generation) || !response.body) {
- if (streamAbortController === controller) {
- streamAbortController = null;
- }
- return;
- }
-
- _streamConnected = true;
- _streamFailed = false;
- reconnectAttempt = 0;
- clearAllEnvironmentErrorsInternal();
- await readJSONLinesInternal(response.body, generation);
- } catch (error) {
- if (!controller.signal.aborted && isCurrentGenerationInternal(generation)) {
- console.warn('Dashboard stream disconnected:', error);
- }
- } finally {
- if (streamAbortController === controller) {
- streamAbortController = null;
- }
- if (isCurrentGenerationInternal(generation)) {
- _streamConnected = false;
- if (!controller.signal.aborted) {
- scheduleReconnectInternal(generation);
- }
- }
- }
- }
-
- async function readJSONLinesInternal(stream: ReadableStream<Uint8Array>, generation: number) {
- const reader = stream.getReader();
- const decoder = new TextDecoder();
- let buffer = '';
-
- try {
- while (isCurrentGenerationInternal(generation)) {
- const { done, value } = await reader.read();
- if (done) {
- break;
- }
-
- buffer += decoder.decode(value, { stream: true });
- const lines = buffer.split('\n');
- buffer = lines.pop() ?? '';
- for (const line of lines) {
- handleStreamLineInternal(line);
- }
- }
-
- buffer += decoder.decode();
- if (buffer.trim()) {
- handleStreamLineInternal(buffer);
- }
- } finally {
- reader.releaseLock();
- }
- }
-
- function handleStreamLineInternal(line: string) {
- const trimmed = line.trim();
- if (!trimmed) {
- return;
- }
-
- try {
- const event = JSON.parse(trimmed) as DashboardStreamEvent;
- applyStreamEventInternal(event.environmentId || LOCAL_DOCKER_ENVIRONMENT_ID, event);
- } catch (error) {
- console.warn('Failed to parse dashboard stream line:', error);
- }
- }
-
- function scheduleReconnectInternal(generation: number) {
- if (!browser || !started || !isCurrentGenerationInternal(generation)) {
- return;
- }
-
- if (reconnectAttempt >= MAX_RECONNECT_ATTEMPTS) {
- _streamFailed = true;
- return;
- }
-
- clearReconnectTimerInternal();
- const delay = Math.min(1000 * 2 ** reconnectAttempt, MAX_RECONNECT_DELAY);
- reconnectAttempt += 1;
- reconnectTimer = setTimeout(() => {
- void connectStreamInternal(generation);
- }, delay);
- }
-
- function reconcileEnvironmentsInternal() {
- if (!browser || !started) {
- return;
- }
-
- // Track only enabled environments — they are the ones the aggregated
- // stream serves; a disabled environment would never leave "loading".
- const available = environmentStore.available.filter((environment) => environment.enabled);
- const environments =
- available.length > 0
- ? available
- : [
- {
- id: environmentStore.selected?.id ?? LOCAL_DOCKER_ENVIRONMENT_ID,
- name: environmentStore.selected?.name ?? 'Local'
- }
- ];
- const targetIds = new Set(environments.map((environment) => environment.id || LOCAL_DOCKER_ENVIRONMENT_ID));
-
- for (const environmentId of Object.keys(_environmentStates)) {
- if (!targetIds.has(environmentId)) {
- removeEnvironmentInternal(environmentId);
- }
- }
-
- for (const environment of environments) {
- const environmentId = environment.id || LOCAL_DOCKER_ENVIRONMENT_ID;
- const existing = environmentStateInternal(environmentId);
- if (!existing) {
- _environmentStates = {
- ..._environmentStates,
- [environmentId]: createEnvironmentStateInternal(environment)
- };
- // An already-open aggregated stream only picks new environments
- // up on its server-side reconcile tick; fetch once so the first
- // snapshot doesn't take up to that interval to appear.
- if (streamAbortController) {
- void refreshEnvironmentInternal(environmentId);
- }
- continue;
- }
-
- if (existing.name !== environmentNameInternal(environment)) {
- updateEnvironmentStateInternal(environmentId, (state) => ({
- ...state,
- name: environmentNameInternal(environment)
- }));
- }
- }
- }
-
return {
get connected(): boolean {
- return _streamConnected;
+ return core.streamConnected;
},
get streamFailed(): boolean {
- return _streamFailed;
+ return core.streamFailed;
},
getEnvironmentState(environmentId: string): DashboardEnvironmentState | null {
- return _environmentStates[environmentId] ?? null;
+ return core.environmentState(environmentId) ?? null;
},
isSnapshotLoading(environmentId: string): boolean {
- const state = _environmentStates[environmentId];
+ const state = core.environmentState(environmentId);
return Boolean(state && state.loading && !state.hasLoaded);
},
start: async (options?: { debugAllGood?: boolean }) => {
@@ -377,39 +113,20 @@ function createDashboardStore() {
}
// The flag is encoded in the stream URL; restart to apply it.
debugAllGood = nextDebugAllGood;
- abortStreamInternal();
- void connectStreamInternal(nextGenerationInternal());
+ core.restartStream();
return;
}
started = true;
debugAllGood = nextDebugAllGood;
- await environmentStore.ready;
- reconcileEnvironmentsInternal();
- const generation = nextGenerationInternal();
- void refreshInternal(generation);
- void connectStreamInternal(generation);
- unsubscribeEnvironment = environmentStore.subscribeSelected(() => {
- reconcileEnvironmentsInternal();
- });
+ await core.start();
},
stop: () => {
started = false;
- unsubscribeEnvironment?.();
- unsubscribeEnvironment = null;
- nextGenerationInternal();
- abortStreamInternal();
- reconnectAttempt = 0;
- _streamFailed = false;
+ core.stop({ resetStreamFailed: true });
},
- refresh: () => refreshInternal(),
- retryStream: () => {
- _streamFailed = false;
- reconnectAttempt = 0;
- clearAllEnvironmentErrorsInternal();
- abortStreamInternal();
- void connectStreamInternal(nextGenerationInternal());
- }
+ refresh: () => core.refresh(),
+ retryStream: () => core.retryStream()
};
}
diff --git a/frontend/src/lib/stores/environment-stream.svelte.ts b/frontend/src/lib/stores/environment-stream.svelte.ts
new file mode 100644
index 000000000..cc7d4f439
--- /dev/null
+++ b/frontend/src/lib/stores/environment-stream.svelte.ts
@@ -0,0 +1,397 @@
+import { browser } from '$app/env';
+import { environmentStore, LOCAL_DOCKER_ENVIRONMENT_ID } from '$lib/stores/environment.store.svelte';
+import type { Environment } from '$lib/types/environment';
+
+const MAX_RECONNECT_DELAY = 15_000;
+const MAX_RECONNECT_ATTEMPTS = 20;
+
+export type StreamEnvStateBase = {
+ id: string;
+ name: string;
+ loading: boolean;
+ streamError: boolean;
+ errorMessage?: string;
+};
+
+export type StreamEventBase = {
+ type: string;
+ environmentId?: string;
+};
+
+export function environmentDisplayName(environment: Pick<Environment, 'id' | 'name'> | null | undefined): string {
+ if (!environment) {
+ return 'Local';
+ }
+ return environment.name || environment.id;
+}
+
+export function streamErrorMessage(error: unknown): string | undefined {
+ if (error instanceof Error && error.message.trim()) {
+ return error.message;
+ }
+ return undefined;
+}
+
+export interface EnvStreamCoreConfig<TState extends StreamEnvStateBase, TEvent extends StreamEventBase> {
+ /** Used in console warnings, e.g. 'Dashboard' / 'Activity'. */
+ label: string;
+ createEnvironmentState(environment: Pick<Environment, 'id' | 'name'>): TState;
+ openStream(signal: AbortSignal): Promise<Response>;
+ /** Handles every event type except 'heartbeat' (core owns connection state). */
+ applyEvent(environmentId: string, event: TEvent): void;
+ /** Fully owns a per-environment REST refresh, including generation/removal guards via core helpers. */
+ fetchSnapshot(environmentId: string, generation: number): Promise<void>;
+ refreshOnStart?: boolean;
+ /** Extra cleanup when an environment disappears (core already dropped its state). */
+ onEnvironmentRemoved?(environmentId: string): void;
+ /** Replaces the default rename handling (which just updates state.name). */
+ onEnvironmentRenamed?(environmentId: string, name: string): void;
+ onSelectedEnvironment?(environment: Pick<Environment, 'id' | 'name'> | null | undefined): void;
+ /** Extra fields reset whenever a per-environment error is cleared (e.g. { errorCode: undefined }). */
+ clearErrorExtra?: Partial<TState>;
+}
+
+export function createEnvironmentStreamStore<TState extends StreamEnvStateBase, TEvent extends StreamEventBase>(
+ config: EnvStreamCoreConfig<TState, TEvent>
+) {
+ let _environmentStates = $state<Record<string, TState>>({});
+
+ let started = false;
+ let unsubscribeEnvironment: (() => void) | null = null;
+ // A single aggregated stream carries every environment's events; per-env
+ // connections would multiply requests and exhaust the browser's
+ // 6-per-origin HTTP/1.1 limit.
+ let streamAbortController: AbortController | null = null;
+ let reconnectTimer: ReturnType<typeof setTimeout> | null = null;
+ let reconnectAttempt = 0;
+ let streamGeneration = 0;
+ let _streamConnected = $state(false);
+ let _streamFailed = $state(false);
+
+ function environmentState(environmentId: string): TState | undefined {
+ return _environmentStates[environmentId];
+ }
+
+ function updateEnvironmentState(environmentId: string, updater: (state: TState) => TState) {
+ const current =
+ _environmentStates[environmentId] ?? config.createEnvironmentState({ id: environmentId, name: environmentId });
+ _environmentStates = {
+ ..._environmentStates,
+ [environmentId]: updater(current)
+ };
+ }
+
+ function setEnvironmentError(environmentId: string, error: unknown, extra?: Partial<TState>) {
+ // Errors only flag the state; domain data is left untouched so the UI
+ // keeps rendering the last-known values.
+ updateEnvironmentState(environmentId, (state) => ({
+ ...state,
+ loading: false,
+ streamError: true,
+ errorMessage: streamErrorMessage(error),
+ ...extra
+ }));
+ }
+
+ function clearEnvironmentError(environmentId: string) {
+ updateEnvironmentState(environmentId, (state) => ({
+ ...state,
+ streamError: false,
+ errorMessage: undefined,
+ ...config.clearErrorExtra
+ }));
+ }
+
+ // A fresh stream re-emits error events for environments that are still
+ // failing, so stale per-environment errors are cleared on every (re)connect.
+ function clearAllEnvironmentErrors() {
+ for (const environmentId of Object.keys(_environmentStates)) {
+ if (environmentState(environmentId)?.streamError) {
+ clearEnvironmentError(environmentId);
+ }
+ }
+ }
+
+ function nextGeneration(): number {
+ streamGeneration += 1;
+ return streamGeneration;
+ }
+
+ function isCurrentGeneration(generation: number): boolean {
+ return streamGeneration === generation;
+ }
+
+ function clearReconnectTimer() {
+ if (reconnectTimer) {
+ clearTimeout(reconnectTimer);
+ reconnectTimer = null;
+ }
+ }
+
+ function abortStream() {
+ clearReconnectTimer();
+ streamAbortController?.abort();
+ streamAbortController = null;
+ _streamConnected = false;
+ }
+
+ function removeEnvironment(environmentId: string) {
+ const nextStates = { ..._environmentStates };
+ delete nextStates[environmentId];
+ _environmentStates = nextStates;
+ config.onEnvironmentRemoved?.(environmentId);
+ }
+
+ async function refresh(generation = streamGeneration) {
+ reconcileEnvironments();
+ await Promise.all(Object.keys(_environmentStates).map((environmentId) => config.fetchSnapshot(environmentId, generation)));
+ }
+
+ async function connectStream(generation: number) {
+ if (!browser || !isCurrentGeneration(generation)) {
+ return;
+ }
+
+ const controller = new AbortController();
+ streamAbortController = controller;
+ try {
+ const response = await config.openStream(controller.signal);
+ if (!isCurrentGeneration(generation) || !response.body) {
+ if (streamAbortController === controller) {
+ streamAbortController = null;
+ }
+ return;
+ }
+
+ _streamConnected = true;
+ _streamFailed = false;
+ reconnectAttempt = 0;
+ clearAllEnvironmentErrors();
+ await readJSONLines(response.body, generation);
+ } catch (error) {
+ if (!controller.signal.aborted && isCurrentGeneration(generation)) {
+ console.warn(`${config.label} stream disconnected:`, error);
+ }
+ } finally {
+ if (streamAbortController === controller) {
+ streamAbortController = null;
+ }
+ if (isCurrentGeneration(generation)) {
+ _streamConnected = false;
+ if (!controller.signal.aborted) {
+ scheduleReconnect(generation);
+ }
+ }
+ }
+ }
+
+ async function readJSONLines(stream: ReadableStream<Uint8Array>, generation: number) {
+ const reader = stream.getReader();
+ const decoder = new TextDecoder();
+ let buffer = '';
+
+ try {
+ while (isCurrentGeneration(generation)) {
+ const { done, value } = await reader.read();
+ if (done) {
+ break;
+ }
+
+ buffer += decoder.decode(value, { stream: true });
+ const lines = buffer.split('\n');
+ buffer = lines.pop() ?? '';
+ for (const line of lines) {
+ handleStreamLine(line);
+ }
+ }
+
+ buffer += decoder.decode();
+ if (buffer.trim()) {
+ handleStreamLine(buffer);
+ }
+ } finally {
+ reader.releaseLock();
+ }
+ }
+
+ function handleStreamLine(line: string) {
+ const trimmed = line.trim();
+ if (!trimmed) {
+ return;
+ }
+
+ try {
+ const event = JSON.parse(trimmed) as TEvent;
+ const environmentId = event.environmentId || LOCAL_DOCKER_ENVIRONMENT_ID;
+ if (event.type === 'heartbeat') {
+ _streamConnected = true;
+ return;
+ }
+ // The aggregated stream can keep delivering events for an environment
+ // for a short while after it was removed locally; don't resurrect it.
+ if (!environmentState(environmentId)) {
+ return;
+ }
+ config.applyEvent(environmentId, event);
+ } catch (error) {
+ console.warn(`Failed to parse ${config.label.toLowerCase()} stream line:`, error);
+ }
+ }
+
+ function scheduleReconnect(generation: number) {
+ if (!browser || !started || !isCurrentGeneration(generation)) {
+ return;
+ }
+
+ if (reconnectAttempt >= MAX_RECONNECT_ATTEMPTS) {
+ _streamFailed = true;
+ return;
+ }
+
+ clearReconnectTimer();
+ const delay = Math.min(1000 * 2 ** reconnectAttempt, MAX_RECONNECT_DELAY);
+ reconnectAttempt += 1;
+ reconnectTimer = setTimeout(() => {
+ void connectStream(generation);
+ }, delay);
+ }
+
+ function reconcileEnvironments() {
+ if (!browser || !started) {
+ return;
+ }
+
+ // Track only enabled environments — they are the ones the aggregated
+ // stream serves; a disabled environment would never leave "loading".
+ const available = environmentStore.available.filter((environment) => environment.enabled);
+ const environments =
+ available.length > 0
+ ? available
+ : [
+ {
+ id: environmentStore.selected?.id ?? LOCAL_DOCKER_ENVIRONMENT_ID,
+ name: environmentStore.selected?.name ?? 'Local'
+ }
+ ];
+ const targetIds = new Set(environments.map((environment) => environment.id || LOCAL_DOCKER_ENVIRONMENT_ID));
+
+ for (const environmentId of Object.keys(_environmentStates)) {
+ if (!targetIds.has(environmentId)) {
+ removeEnvironment(environmentId);
+ }
+ }
+
+ for (const environment of environments) {
+ const environmentId = environment.id || LOCAL_DOCKER_ENVIRONMENT_ID;
+ const existing = environmentState(environmentId);
+ if (!existing) {
+ _environmentStates = {
+ ..._environmentStates,
+ [environmentId]: config.createEnvironmentState(environment)
+ };
+ // An already-open aggregated stream only picks new environments
+ // up on its server-side reconcile tick; fetch once so the first
+ // snapshot doesn't take up to that interval to appear.
+ if (streamAbortController) {
+ void config.fetchSnapshot(environmentId, streamGeneration);
+ }
+ continue;
+ }
+
+ if (existing.name !== environmentDisplayName(environment)) {
+ if (config.onEnvironmentRenamed) {
+ config.onEnvironmentRenamed(environmentId, environmentDisplayName(environment));
+ } else {
+ updateEnvironmentState(environmentId, (state) => ({
+ ...state,
+ name: environmentDisplayName(environment)
+ }));
+ }
+ }
+ }
+ }
+
+ return {
+ get environmentStates(): Record<string, TState> {
+ return _environmentStates;
+ },
+ set environmentStates(value: Record<string, TState>) {
+ _environmentStates = value;
+ },
+ get streamConnected(): boolean {
+ return _streamConnected;
+ },
+ set streamConnected(value: boolean) {
+ _streamConnected = value;
+ },
+ get streamFailed(): boolean {
+ return _streamFailed;
+ },
+ get generation(): number {
+ return streamGeneration;
+ },
+ get hasActiveStream(): boolean {
+ return streamAbortController !== null;
+ },
+ environmentState,
+ updateEnvironmentState,
+ setEnvironmentError,
+ clearEnvironmentError,
+ isCurrentGeneration,
+ reconcileEnvironments,
+ refresh,
+ async start() {
+ if (!browser || started) {
+ return;
+ }
+
+ started = true;
+ await environmentStore.ready;
+ config.onSelectedEnvironment?.(environmentStore.selected);
+ reconcileEnvironments();
+ const generation = nextGeneration();
+ if (config.refreshOnStart) {
+ void refresh(generation);
+ }
+ void connectStream(generation);
+ unsubscribeEnvironment = environmentStore.subscribeSelected((environment) => {
+ config.onSelectedEnvironment?.(environment);
+ reconcileEnvironments();
+ });
+ },
+ stop(options?: { resetStreamFailed?: boolean }) {
+ started = false;
+ unsubscribeEnvironment?.();
+ unsubscribeEnvironment = null;
+ nextGeneration();
+ abortStream();
+ reconnectAttempt = 0;
+ if (options?.resetStreamFailed) {
+ _streamFailed = false;
+ }
+ },
+ retryStream() {
+ _streamFailed = false;
+ reconnectAttempt = 0;
+ // Environments may have been added/removed while the stream was down;
+ // reconcile so the new stream's snapshots aren't dropped as unknown.
+ reconcileEnvironments();
+ clearAllEnvironmentErrors();
+ abortStream();
+ void connectStream(nextGeneration());
+ },
+ // Tear down and reopen the stream without touching existing environment
+ // data (e.g. when a flag encoded in the stream URL changes).
+ restartStream() {
+ // Same as retryStream: pick up environments added since the last
+ // reconcile so their first snapshots aren't discarded.
+ reconcileEnvironments();
+ abortStream();
+ void connectStream(nextGeneration());
+ }
+ };
+}
+
+export type EnvStreamCore<TState extends StreamEnvStateBase, TEvent extends StreamEventBase> = ReturnType<
+ typeof createEnvironmentStreamStore<TState, TEvent>
+>;
diff --git a/frontend/src/lib/utils/api.ts b/frontend/src/lib/utils/api.ts
index 990e0279a..4d6cfda92 100644
--- a/frontend/src/lib/utils/api.ts
+++ b/frontend/src/lib/utils/api.ts
@@ -70,6 +70,17 @@ export function extractApiErrorMessage(error: any): string {
}
}
+/**
+ * Shows a toast for a failed upgrade, avoiding double-wrapping when the extracted
+ * message is already the localized "upgrade failed" string. The localized message
+ * factory is passed in so this utility stays free of paraglide imports.
+ */
+export function toastUpgradeError(error: unknown, formatFailed: (args: { error: string }) => string): void {
+ const errorMessage = extractApiErrorMessage(error);
+ const wrappedPrefix = formatFailed({ error: '' });
+ toast.error(errorMessage.startsWith(wrappedPrefix) ? errorMessage : formatFailed({ error: errorMessage }));
+}
+
export async function handleApiResultWithCallbacks<T>({
result,
message,
diff --git a/frontend/src/lib/utils/compose-flow.ts b/frontend/src/lib/utils/compose-flow.ts
index a51bcdda7..693351718 100644
--- a/frontend/src/lib/utils/compose-flow.ts
+++ b/frontend/src/lib/utils/compose-flow.ts
@@ -39,6 +39,19 @@ export const dropdownContentClass =
'arcane-dd-content min-w-[220px] overflow-visible rounded-lg border border-primary/30 bg-background/95 ' +
'backdrop-blur supports-[backdrop-filter]:bg-background/80 ring-1 ring-inset ring-primary/20 shadow-sm p-1';
+// Shared file-tree ResizableSplit preset for the compose editor pages
+// (project detail + new project); size binding and persistKey stay per-page.
+export const composeTreeSplitProps = {
+ variant: 'flush',
+ firstClass: 'bg-muted/20 border-border flex min-h-0 flex-col border-b lg:border-r lg:border-b-0',
+ secondClass: 'flex min-h-0 flex-col',
+ minSize: 200,
+ maxSize: 480,
+ minSecondSize: 360,
+ defaultRatio: 0.22,
+ stackBelow: 1024
+} as const;
+
export const dropdownItemClass =
'flex cursor-pointer select-none items-center gap-2 rounded-md px-3 py-2 text-sm ' +
'text-foreground/90 outline-none transition-colors ' +
diff --git a/frontend/src/lib/utils/formatting.ts b/frontend/src/lib/utils/formatting.ts
index 4dc5cfee0..a73c237b2 100644
--- a/frontend/src/lib/utils/formatting.ts
+++ b/frontend/src/lib/utils/formatting.ts
@@ -159,18 +159,19 @@ export const bytes = bytesWithHelpers;
// --- Locale-aware date/time formatting ---
-export function formatDateTime(date: Date | string | null | undefined): string {
+function formatWithPattern(date: Date | string | null | undefined, pattern: string): string {
if (!date) return '';
const d = typeof date === 'string' ? new Date(date) : date;
if (isNaN(d.getTime())) return '';
- return formatDate(d, 'PPpp');
+ return formatDate(d, pattern);
+}
+
+export function formatDateTime(date: Date | string | null | undefined): string {
+ return formatWithPattern(date, 'PPpp');
}
export function formatDateTimeShort(date: Date | string | null | undefined): string {
- if (!date) return '';
- const d = typeof date === 'string' ? new Date(date) : date;
- if (isNaN(d.getTime())) return '';
- return formatDate(d, 'PPp');
+ return formatWithPattern(date, 'PPp');
}
export function formatOptionalDateTime(date: Date | string | null | undefined, fallback = '-'): string {
@@ -187,10 +188,7 @@ export function isPastDate(date: Date | string | null | undefined): boolean {
}
export function formatTime(date: Date | string | null | undefined): string {
- if (!date) return '';
- const d = typeof date === 'string' ? new Date(date) : date;
- if (isNaN(d.getTime())) return '';
- return formatDate(d, 'pp');
+ return formatWithPattern(date, 'pp');
}
type DateFnsLocaleModule = {
diff --git a/frontend/src/lib/utils/mobile-card-badges.ts b/frontend/src/lib/utils/mobile-card-badges.ts
new file mode 100644
index 000000000..90e113591
--- /dev/null
+++ b/frontend/src/lib/utils/mobile-card-badges.ts
@@ -0,0 +1,10 @@
+import { m } from '$lib/paraglide/messages';
+
+export function inUseBadge(visible: boolean) {
+ return (item: { inUse?: boolean }) =>
+ visible
+ ? item.inUse
+ ? { variant: 'green' as const, text: m.common_in_use() }
+ : { variant: 'amber' as const, text: m.common_unused() }
+ : null;
+}
diff --git a/frontend/src/lib/utils/resource-list-page.svelte.ts b/frontend/src/lib/utils/resource-list-page.svelte.ts
new file mode 100644
index 000000000..65e6250e0
--- /dev/null
+++ b/frontend/src/lib/utils/resource-list-page.svelte.ts
@@ -0,0 +1,14 @@
+import { environmentStore } from '$lib/stores/environment.store.svelte';
+
+export class ResourceListPageState<TItems, TReq> {
+ items = $state() as TItems;
+ requestOptions = $state() as TReq;
+ selectedIds = $state<string[]>([]);
+ isCreateDialogOpen = $state(false);
+ envId = $derived(environmentStore.selected?.id || '0');
+
+ constructor(items: TItems, requestOptions: TReq) {
+ this.items = items;
+ this.requestOptions = requestOptions;
+ }
+}
diff --git a/frontend/src/lib/utils/template-editor.ts b/frontend/src/lib/utils/template-editor.ts
index 3f0bd4beb..7e3f580b8 100644
--- a/frontend/src/lib/utils/template-editor.ts
+++ b/frontend/src/lib/utils/template-editor.ts
@@ -56,6 +56,20 @@ export function getTemplateEditorValidationState(
};
}
+export function getTemplateEditorSaveState(
+ validation: TemplateEditorValidationState,
+ hasChanges: boolean
+): { validationState: TemplateEditorValidationState; canSave: boolean } {
+ const validationState = getTemplateEditorValidationState(
+ validation.composeValidationReady,
+ validation.envValidationReady,
+ validation.composeHasErrors,
+ validation.envHasErrors
+ );
+
+ return { validationState, canSave: hasChanges && !hasTemplateEditorErrors(validationState) };
+}
+
export function hasTemplateEditorErrors(state: TemplateEditorValidationState): boolean {
return !state.composeValidationReady || !state.envValidationReady || state.composeHasErrors || state.envHasErrors;
}
diff --git a/frontend/src/routes/(app)/containers/[containerId]/+error.svelte b/frontend/src/routes/(app)/containers/[containerId]/+error.svelte
index 5b4c41d44..93c696485 100644
--- a/frontend/src/routes/(app)/containers/[containerId]/+error.svelte
+++ b/frontend/src/routes/(app)/containers/[containerId]/+error.svelte
@@ -1,36 +1,10 @@
<script lang="ts">
- import { page } from '$app/state';
- import { goto } from '$app/navigation';
- import * as Empty from '$lib/components/ui/empty/index.js';
- import { ArcaneButton } from '$lib/components/arcane-button/index.js';
- import { AlertIcon } from '$lib/icons';
+ import ResourceErrorPage from '$lib/components/resource-error-page.svelte';
import { m } from '$lib/paraglide/messages';
-
- const status = $derived(page.status ?? 500);
- const message = $derived(page.error?.message ?? m.error_generic());
</script>
-<div class="flex h-full flex-1 flex-col items-center justify-center p-8">
- <Empty.Root>
- <Empty.Header>
- <Empty.Media variant="icon">
- <AlertIcon class="text-destructive size-16" aria-hidden="true" />
- </Empty.Media>
- <Empty.Title>
- {status === 404 ? m.error_not_found() : m.error_generic()}
- </Empty.Title>
- <Empty.Description>
- {message}
- </Empty.Description>
- </Empty.Header>
- <Empty.Content>
- <div class="flex flex-col items-center gap-3">
- <ArcaneButton
- action="base"
- customLabel={m.common_back_to({ resource: m.containers_title() })}
- onclick={() => goto('/containers')}
- />
- </div>
- </Empty.Content>
- </Empty.Root>
-</div>
+<ResourceErrorPage
+ fallbackTitle={m.error_generic()}
+ backLabel={m.common_back_to({ resource: m.containers_title() })}
+ backHref="/containers"
+/>
diff --git a/frontend/src/routes/(app)/containers/[containerId]/+page.svelte b/frontend/src/routes/(app)/containers/[containerId]/+page.svelte
index 43e75cb7c..13dde5674 100644
--- a/frontend/src/routes/(app)/containers/[containerId]/+page.svelte
+++ b/frontend/src/routes/(app)/containers/[containerId]/+page.svelte
@@ -24,11 +24,10 @@
import ContainerHealthcheck from '../components/ContainerHealthcheck.svelte';
import ContainerCommitDialog from '../components/container-commit-dialog.svelte';
import IconImage from '$lib/components/icon-image.svelte';
+ import ResourceNotFound from '$lib/components/resource-not-found.svelte';
import { calculateMemoryUsage, getThemedIconUrl } from '$lib/utils/docker';
import { mode } from 'mode-watcher';
import {
- ArrowLeftIcon,
- AlertIcon,
VolumesIcon,
FileTextIcon,
SettingsIcon,
@@ -530,26 +529,12 @@
/>
{/if}
{:else}
- <div class="flex min-h-screen items-center justify-center">
- <div class="text-center">
- <div class="bg-muted/50 mb-6 inline-flex rounded-full p-6">
- <AlertIcon class="text-muted-foreground size-10" />
- </div>
- <h2 class="mb-3 text-2xl font-medium">{m.common_not_found_title({ resource: m.container() })}</h2>
- <p class="text-muted-foreground mb-8 max-w-md text-center">
- {m.common_not_found_description({ resource: m.container().toLowerCase() })}
- </p>
- <div class="flex justify-center gap-4">
- <ArcaneButton action="base" href="/containers">
- <ArrowLeftIcon class="size-4" />
- {m.common_back_to({ resource: m.containers_title() })}
- </ArcaneButton>
- <ArcaneButton action="refresh" onclick={refreshData}>
- {m.common_retry()}
- </ArcaneButton>
- </div>
- </div>
- </div>
+ <ResourceNotFound
+ resource={m.container()}
+ resourceListTitle={m.containers_title()}
+ backHref="/containers"
+ onRetry={refreshData}
+ />
{/if}
<style>
diff --git a/frontend/src/routes/(app)/containers/components/ContainerConfiguration.svelte b/frontend/src/routes/(app)/containers/components/ContainerConfiguration.svelte
index d0225094a..1e4ad7bfb 100644
--- a/frontend/src/routes/(app)/containers/components/ContainerConfiguration.svelte
+++ b/frontend/src/routes/(app)/containers/components/ContainerConfiguration.svelte
@@ -4,6 +4,7 @@
import type { ContainerDetailsDto } from '$lib/types/docker';
import { SettingsIcon, TagIcon } from '$lib/icons';
import { KeyValueCard, KeyValueGrid } from '$lib/components/resource-detail';
+ import EnvVarsList from '$lib/components/env-vars-list.svelte';
interface Props {
container: ContainerDetailsDto;
@@ -14,6 +15,7 @@
let { container, hasEnvVars, hasLabels }: Props = $props();
</script>
+<!-- fallow-ignore-next-line code-duplication container vs swarm-service config; typed props diverge across the boundary -->
<div class="space-y-6">
{#if hasEnvVars}
<Card.Root>
@@ -29,28 +31,17 @@
</Card.Header>
<Card.Content class="p-4">
{#if container.config?.env && container.config.env.length > 0}
- <KeyValueGrid>
- {#each container.config.env as env, index (index)}
- {#if env.includes('=')}
- {@const [key, ...valueParts] = env.split('=')}
- {@const value = valueParts.join('=')}
- <KeyValueCard label={key ?? ''} valueTitle={m.common_click_to_select()}>{value}</KeyValueCard>
- {:else}
- <KeyValueCard
- label={m.swarm_service_env_var()}
- labelClass="text-muted-foreground text-xs font-semibold tracking-wide uppercase"
- valueTitle={m.common_click_to_select()}
- >
- {env}
- </KeyValueCard>
- {/if}
- {/each}
- </KeyValueGrid>
+ <EnvVarsList
+ envVars={container.config.env}
+ nameOnlyLabel={m.swarm_service_env_var()}
+ valueTitle={m.common_click_to_select()}
+ />
{:else}
<div class="text-muted-foreground rounded-lg border border-dashed py-8 text-center">
<div class="text-sm">{m.containers_no_env_vars()}</div>
</div>
{/if}
+ <!-- fallow-ignore-next-line code-duplication container vs swarm-service config; typed props diverge across the boundary -->
</Card.Content>
</Card.Root>
{/if}
diff --git a/frontend/src/routes/(app)/containers/components/ContainerLogsPanel.svelte b/frontend/src/routes/(app)/containers/components/ContainerLogsPanel.svelte
index 657b16ec9..936f50a95 100644
--- a/frontend/src/routes/(app)/containers/components/ContainerLogsPanel.svelte
+++ b/frontend/src/routes/(app)/containers/components/ContainerLogsPanel.svelte
@@ -4,6 +4,7 @@
import * as Card from '$lib/components/ui/card';
import LogViewer from '$lib/components/logs/log-viewer.svelte';
import LogControls from '$lib/components/logs/log-controls.svelte';
+ import LogPanelTitle from '$lib/components/logs/log-panel-title.svelte';
import type { ContainerStats, ContainerStatsHistorySample } from '$lib/types/docker';
import { m } from '$lib/paraglide/messages';
import { bytes } from '$lib/utils/formatting';
@@ -194,19 +195,7 @@
<div class="flex flex-1 flex-col gap-4 lg:flex-row lg:items-start lg:justify-between">
<div class="flex flex-col gap-1.5">
<div class="flex items-start justify-between gap-3 lg:block">
- <div class="flex items-center gap-2">
- <Card.Title>
- <h2>
- {m.containers_logs_title()}
- </h2>
- </Card.Title>
- {#if isStreaming}
- <div class="flex items-center gap-2">
- <div class="size-2 animate-pulse rounded-full bg-green-500"></div>
- <span class="text-xs font-semibold text-green-600 sm:text-sm">{m.common_live()}</span>
- </div>
- {/if}
- </div>
+ <LogPanelTitle title={m.containers_logs_title()} live={isStreaming} />
<LogControls
bind:autoScroll
bind:autoStartLogs
diff --git a/frontend/src/routes/(app)/containers/components/ContainerNetwork.svelte b/frontend/src/routes/(app)/containers/components/ContainerNetwork.svelte
index 1d906b104..b831f4baa 100644
--- a/frontend/src/routes/(app)/containers/components/ContainerNetwork.svelte
+++ b/frontend/src/routes/(app)/containers/components/ContainerNetwork.svelte
@@ -14,6 +14,7 @@
<div class="space-y-6">
<Card.Root id="container-port-mappings">
+ <!-- fallow-ignore-next-line code-duplication container vs swarm-service network; typed props diverge across the boundary -->
<Card.Header icon={NetworksIcon}>
<div class="flex flex-col space-y-1.5">
<Card.Title>
@@ -25,6 +26,7 @@
</Card.Header>
<Card.Content class="p-4">
{#if container.ports && container.ports.length > 0}
+ <!-- fallow-ignore-next-line code-duplication container vs swarm-service network; typed props diverge across the boundary -->
<PortBadge ports={container.ports} />
{:else}
<div class="text-muted-foreground rounded-lg border border-dashed py-12 text-center">
@@ -48,6 +50,7 @@
<Card.Content class="p-4">
{#if container.networkSettings?.networks && Object.keys(container.networkSettings.networks).length > 0}
<div class="grid grid-cols-1 gap-4 lg:grid-cols-2">
+ <!-- fallow-ignore-next-line code-duplication container vs swarm-service network; typed props diverge across the boundary -->
{#each Object.entries(container.networkSettings.networks) as [networkName, rawNetworkConfig] (networkName)}
<Card.Root variant="subtle">
<Card.Content class="p-4">
@@ -157,6 +160,7 @@
<div class="cursor-pointer font-mono break-all select-all" title={m.common_click_to_select()}>
{alias}
</div>
+ <!-- fallow-ignore-next-line code-duplication container vs swarm-service network; typed props diverge across the boundary -->
{/each}
</div>
</Card.Content>
diff --git a/frontend/src/routes/(app)/containers/components/ContainerOverview.svelte b/frontend/src/routes/(app)/containers/components/ContainerOverview.svelte
index 0be862685..bbb989ff0 100644
--- a/frontend/src/routes/(app)/containers/components/ContainerOverview.svelte
+++ b/frontend/src/routes/(app)/containers/components/ContainerOverview.svelte
@@ -7,6 +7,7 @@
import { format, formatDistanceToNow } from 'date-fns';
import { InfoIcon, StartIcon, StopIcon, NetworksIcon, VolumesIcon, HealthIcon } from '$lib/icons';
import { containerService } from '$lib/services/container-service';
+ import { KeyValueCard } from '$lib/components/resource-detail';
import { toast } from 'svelte-sonner';
interface Props {
@@ -216,19 +217,7 @@
</div>
<div class="grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4">
- <Card.Root variant="subtle">
- <Card.Content class="flex flex-col gap-2 p-4">
- <div class="text-muted-foreground text-xs font-semibold tracking-wide uppercase">
- {m.common_id()}
- </div>
- <div
- class="text-foreground cursor-pointer font-mono text-sm font-medium break-all select-all"
- title={m.common_click_to_select()}
- >
- {container.id}
- </div>
- </Card.Content>
- </Card.Root>
+ <KeyValueCard label={m.common_id()} valueTitle={m.common_click_to_select()}>{container.id}</KeyValueCard>
<Card.Root variant="subtle">
<Card.Content class="flex flex-col gap-2 p-4">
diff --git a/frontend/src/routes/(app)/containers/components/ContainerStorage.svelte b/frontend/src/routes/(app)/containers/components/ContainerStorage.svelte
index ec0213331..46f3b3d6b 100644
--- a/frontend/src/routes/(app)/containers/components/ContainerStorage.svelte
+++ b/frontend/src/routes/(app)/containers/components/ContainerStorage.svelte
@@ -114,6 +114,7 @@
<Card.Content class="flex flex-col p-3">
<div class="text-muted-foreground mb-2 text-xs font-semibold">{m.container_propagation()}</div>
<div class="text-foreground text-sm font-medium">
+ <!-- fallow-ignore-next-line code-duplication container vs swarm-service storage; typed Mount vs ServiceMount props diverge across the boundary -->
{mount.propagation}
</div>
</Card.Content>
diff --git a/frontend/src/routes/(app)/containers/components/container-commit-dialog.svelte b/frontend/src/routes/(app)/containers/components/container-commit-dialog.svelte
index a9d353d71..ddb95865f 100644
--- a/frontend/src/routes/(app)/containers/components/container-commit-dialog.svelte
+++ b/frontend/src/routes/(app)/containers/components/container-commit-dialog.svelte
@@ -1,8 +1,9 @@
<script lang="ts">
+ import SheetFooterActions from '$lib/components/sheets/sheet-footer-actions.svelte';
import * as ResponsiveDialog from '$lib/components/ui/responsive-dialog/index.js';
import * as Alert from '$lib/components/ui/alert/index.js';
- import { ArcaneButton } from '$lib/components/arcane-button';
import FormInput from '$lib/components/form/form-input.svelte';
+ import RepoTagFields from '$lib/components/form/repo-tag-fields.svelte';
import { createForm, preventDefault } from '$lib/utils/settings';
import { containerService } from '$lib/services/container-service';
import { m } from '$lib/paraglide/messages';
@@ -89,12 +90,7 @@
<InfoIcon class="size-4" />
<Alert.Description class="text-sm">{m.containers_commit_registry_note()}</Alert.Description>
</Alert.Root>
- <FormInput
- label={m.images_tag_repository()}
- placeholder={m.images_tag_repository_placeholder()}
- bind:input={$inputs.repository}
- />
- <FormInput label={m.images_tag()} placeholder={m.images_tag_latest()} bind:input={$inputs.tag} />
+ <RepoTagFields bind:repository={$inputs.repository} bind:tag={$inputs.tag} />
<FormInput
label={m.common_description()}
placeholder={m.containers_commit_comment_placeholder()}
@@ -109,17 +105,13 @@
{/snippet}
{#snippet footer()}
- <div class="flex w-full gap-2">
- <ArcaneButton action="cancel" tone="outline" type="button" class="flex-1" onclick={() => handleOpenChange(false)} />
- <ArcaneButton
- action="commit"
- tone="outline-primary"
- type="submit"
- class="flex-1"
- loading={isCommitting}
- disabled={isCommitting}
- onclick={handleSubmit}
- />
- </div>
+ <SheetFooterActions
+ onCancel={() => handleOpenChange(false)}
+ submitAction="commit"
+ submitTone="outline-primary"
+ submitLoading={isCommitting}
+ submitDisabled={isCommitting}
+ onSubmit={handleSubmit}
+ />
{/snippet}
</ResponsiveDialog.Root>
diff --git a/frontend/src/routes/(app)/containers/container-table.svelte b/frontend/src/routes/(app)/containers/container-table.svelte
index 23f908046..b9956e3dd 100644
--- a/frontend/src/routes/(app)/containers/container-table.svelte
+++ b/frontend/src/routes/(app)/containers/container-table.svelte
@@ -4,6 +4,8 @@
import { Spinner } from '$lib/components/ui/spinner/index.js';
import { goto } from '$app/navigation';
import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
+ import RowActionsMenu from '$lib/components/arcane-table/row-actions-menu.svelte';
+ import ContainerActionMenuItem from '$lib/components/arcane-table/cells/container-action-menu-item.svelte';
import type { SearchPaginationSortRequest } from '$lib/types/shared';
import StatusBadge from '$lib/components/badges/status-badge.svelte';
import { format } from 'date-fns';
@@ -45,7 +47,6 @@
StopIcon,
RefreshIcon,
TrashIcon,
- EllipsisIcon,
BoxIcon,
ClockIcon,
ImagesIcon,
@@ -453,7 +454,7 @@
</div>
{/snippet}
-{#snippet UpdatesCell({ item }: { item: ContainerSummaryDto })}
+{#snippet ContainerUpdateItem(item: ContainerSummaryDto)}
{@const imageRef = parseImageRef(item.image)}
<ImageUpdateItem
updateInfo={item.updateInfo}
@@ -465,6 +466,10 @@
/>
{/snippet}
+{#snippet UpdatesCell({ item }: { item: ContainerSummaryDto })}
+ {@render ContainerUpdateItem(item)}
+{/snippet}
+
{#snippet ImageCell({ item }: { item: ContainerSummaryDto })}
<ArcaneTooltip.Root>
<ArcaneTooltip.Trigger class="flex w-full min-w-0">
@@ -591,21 +596,13 @@
</div>
{/if}
{#if mobileFieldVisibility['updates'] ?? true}
- {@const imageRef = parseImageRef(item.image)}
<div class="flex min-w-0 flex-1 items-start gap-2.5">
<div class="flex min-w-0 flex-col">
<div class="text-muted-foreground text-[10px] font-medium tracking-wide uppercase">
{m.images_updates()}
</div>
<div class="mt-1">
- <ImageUpdateItem
- updateInfo={item.updateInfo}
- imageId={item.imageId}
- repo={imageRef.repo}
- tag={imageRef.tag}
- onUpdateContainer={canUpdateContainers ? () => handleUpdateContainer(item) : undefined}
- debugHasUpdate={false}
- />
+ {@render ContainerUpdateItem(item)}
</div>
</div>
</div>
@@ -617,140 +614,116 @@
{#snippet RowActions({ item }: { item: ContainerSummaryDto })}
{@const status = actionStatus[item.id]}
- <DropdownMenu.Root>
- <DropdownMenu.Trigger>
- {#snippet child({ props })}
- <ArcaneButton {...props} action="base" tone="ghost" size="icon" class="size-8">
- <span class="sr-only">{m.common_open_menu()}</span>
- <EllipsisIcon class="size-4" />
- </ArcaneButton>
- {/snippet}
- </DropdownMenu.Trigger>
- <DropdownMenu.Content align="end">
- <DropdownMenu.Group>
- <DropdownMenu.Item onclick={() => goto(`/containers/${item.id}`)} disabled={isAnyLoading}>
- <InspectIcon class="size-4" />
- {m.common_inspect()}
- </DropdownMenu.Item>
-
- <DropdownMenu.Separator />
-
- {#if item.updateInfo?.hasUpdate && canUpdateContainers}
- <DropdownMenu.Item onclick={() => handleUpdateContainer(item)} disabled={status === 'updating' || isAnyLoading}>
- {#if status === 'updating'}
- <Spinner class="size-4" />
- {:else}
- <UpdateIcon class="size-4" />
- {m.common_update()}
- {/if}
- </DropdownMenu.Item>
- {/if}
- {#if item.state === 'paused'}
- {#if canPauseContainers}
- <DropdownMenu.Item
- onclick={() => performContainerAction('unpause', item.id)}
- disabled={status === 'unpausing' || isAnyLoading}
- >
- {#if status === 'unpausing'}
- <Spinner class="size-4" />
- {:else}
- <PlayIcon class="size-4" />
- {/if}
- {m.common_unpause()}
- </DropdownMenu.Item>
- {/if}
- {:else if item.state !== 'running'}
- <DropdownMenu.Item
- onclick={() => performContainerAction('start', item.id)}
- disabled={status === 'starting' || isAnyLoading}
- >
- {#if status === 'starting'}
- <Spinner class="size-4" />
- {:else}
- <StartIcon class="size-4" />
- {/if}
- {m.common_start()}
- </DropdownMenu.Item>
+ <RowActionsMenu>
+ <DropdownMenu.Item onclick={() => goto(`/containers/${item.id}`)} disabled={isAnyLoading}>
+ <InspectIcon class="size-4" />
+ {m.common_inspect()}
+ </DropdownMenu.Item>
+
+ <DropdownMenu.Separator />
+
+ {#if item.updateInfo?.hasUpdate && canUpdateContainers}
+ <DropdownMenu.Item onclick={() => handleUpdateContainer(item)} disabled={status === 'updating' || isAnyLoading}>
+ {#if status === 'updating'}
+ <Spinner class="size-4" />
{:else}
- <DropdownMenu.Item
- onclick={() => performContainerAction('stop', item.id)}
- disabled={status === 'stopping' || isAnyLoading}
- >
- {#if status === 'stopping'}
- <Spinner class="size-4" />
- {:else}
- <StopIcon class="size-4" />
- {/if}
- {m.common_stop()}
- </DropdownMenu.Item>
-
- <DropdownMenu.Item
- onclick={() => performContainerAction('restart', item.id)}
- disabled={status === 'restarting' || isAnyLoading}
- >
- {#if status === 'restarting'}
- <Spinner class="size-4" />
- {:else}
- <RefreshIcon class="size-4" />
- {/if}
- {m.common_restart()}
- </DropdownMenu.Item>
-
- {#if canPauseContainers}
- <DropdownMenu.Item
- onclick={() => performContainerAction('pause', item.id)}
- disabled={status === 'pausing' || isAnyLoading}
- >
- {#if status === 'pausing'}
- <Spinner class="size-4" />
- {:else}
- <PauseIcon class="size-4" />
- {/if}
- {m.common_pause()}
- </DropdownMenu.Item>
- {/if}
+ <UpdateIcon class="size-4" />
+ {m.common_update()}
{/if}
-
- {#if (item.state === 'running' || item.state === 'paused') && canKillContainers}
- <DropdownMenu.Item onclick={() => openKillDialog(item)} disabled={isAnyLoading}>
- <ZapIcon class="size-4" />
- {m.common_kill()}
- </DropdownMenu.Item>
- {/if}
-
- {#if item.redeployDisabled}
- <DropdownMenu.Item disabled title={m.common_redeploy_disabled_arcane_self()}>
- <RedeployIcon class="size-4 opacity-50" />
- {m.common_redeploy()}
- </DropdownMenu.Item>
+ </DropdownMenu.Item>
+ {/if}
+ {#if item.state === 'paused'}
+ {#if canPauseContainers}
+ <DropdownMenu.Item
+ onclick={() => performContainerAction('unpause', item.id)}
+ disabled={status === 'unpausing' || isAnyLoading}
+ >
+ {#if status === 'unpausing'}
+ <Spinner class="size-4" />
+ {:else}
+ <PlayIcon class="size-4" />
+ {/if}
+ {m.common_unpause()}
+ </DropdownMenu.Item>
+ {/if}
+ {:else if item.state !== 'running'}
+ <DropdownMenu.Item
+ onclick={() => performContainerAction('start', item.id)}
+ disabled={status === 'starting' || isAnyLoading}
+ >
+ {#if status === 'starting'}
+ <Spinner class="size-4" />
{:else}
- <DropdownMenu.Item onclick={() => handleRedeployContainer(item)} disabled={status === 'redeploying' || isAnyLoading}>
- {#if status === 'redeploying'}
- <Spinner class="size-4" />
- {:else}
- <RedeployIcon class="size-4" />
- {/if}
- {m.common_redeploy()}
- </DropdownMenu.Item>
+ <StartIcon class="size-4" />
{/if}
-
- <DropdownMenu.Separator />
-
+ {m.common_start()}
+ </DropdownMenu.Item>
+ {:else}
+ <ContainerActionMenuItem
+ icon={StopIcon}
+ label={m.common_stop()}
+ onclick={() => performContainerAction('stop', item.id)}
+ loading={status === 'stopping'}
+ disabled={status === 'stopping' || isAnyLoading}
+ />
+
+ <ContainerActionMenuItem
+ icon={RefreshIcon}
+ label={m.common_restart()}
+ onclick={() => performContainerAction('restart', item.id)}
+ loading={status === 'restarting'}
+ disabled={status === 'restarting' || isAnyLoading}
+ />
+
+ {#if canPauseContainers}
<DropdownMenu.Item
- variant="destructive"
- onclick={() => handleRemoveContainer(item.id, getContainerDisplayName(item))}
- disabled={status === 'removing' || isAnyLoading}
+ onclick={() => performContainerAction('pause', item.id)}
+ disabled={status === 'pausing' || isAnyLoading}
>
- {#if status === 'removing'}
+ {#if status === 'pausing'}
<Spinner class="size-4" />
{:else}
- <TrashIcon class="size-4" />
+ <PauseIcon class="size-4" />
{/if}
- {m.common_remove()}
+ {m.common_pause()}
</DropdownMenu.Item>
- </DropdownMenu.Group>
- </DropdownMenu.Content>
- </DropdownMenu.Root>
+ {/if}
+ {/if}
+
+ {#if (item.state === 'running' || item.state === 'paused') && canKillContainers}
+ <DropdownMenu.Item onclick={() => openKillDialog(item)} disabled={isAnyLoading}>
+ <ZapIcon class="size-4" />
+ {m.common_kill()}
+ </DropdownMenu.Item>
+ {/if}
+
+ {#if item.redeployDisabled}
+ <DropdownMenu.Item disabled title={m.common_redeploy_disabled_arcane_self()}>
+ <RedeployIcon class="size-4 opacity-50" />
+ {m.common_redeploy()}
+ </DropdownMenu.Item>
+ {:else}
+ <DropdownMenu.Item onclick={() => handleRedeployContainer(item)} disabled={status === 'redeploying' || isAnyLoading}>
+ {#if status === 'redeploying'}
+ <Spinner class="size-4" />
+ {:else}
+ <RedeployIcon class="size-4" />
+ {/if}
+ {m.common_redeploy()}
+ </DropdownMenu.Item>
+ {/if}
+
+ <DropdownMenu.Separator />
+
+ <ContainerActionMenuItem
+ icon={TrashIcon}
+ label={m.common_remove()}
+ onclick={() => handleRemoveContainer(item.id, getContainerDisplayName(item))}
+ loading={status === 'removing'}
+ disabled={status === 'removing' || isAnyLoading}
+ destructive
+ />
+ </RowActionsMenu>
{/snippet}
<ArcaneTable
diff --git a/frontend/src/routes/(app)/customize/+page.svelte b/frontend/src/routes/(app)/customize/+page.svelte
index e8e69b2f1..06141b20f 100644
--- a/frontend/src/routes/(app)/customize/+page.svelte
+++ b/frontend/src/routes/(app)/customize/+page.svelte
@@ -1,31 +1,17 @@
<script lang="ts">
import { goto } from '$app/navigation';
import { onMount } from 'svelte';
- import { ArcaneButton } from '$lib/components/arcane-button/index.js';
- import { Card } from '$lib/components/ui/card';
import { m } from '$lib/paraglide/messages';
- import { UiConfigDisabledTag } from '$lib/components/badges/index.js';
import { customizeSearchService } from '$lib/services/customize-search';
import { environmentStore } from '$lib/stores/environment.store.svelte';
import type { CustomizeCategory } from '$lib/types/shared';
import { canReachAccessSurfaceUrl } from '$lib/utils/access-policy';
- import * as InputGroup from '$lib/components/ui/input-group/index.js';
import { getCustomizeSubpageUrlsInNavOrder } from '$lib/config/navigation-config';
import { useCategorySearch } from '$lib/hooks/use-category-search.svelte';
import { getCategoryIcon, orderCategoriesByNav } from '$lib/utils/category-page';
- import { Spinner } from '$lib/components/ui/spinner/index.js';
- import {
- SearchIcon,
- TemplateIcon,
- ArrowRightIcon,
- FileTextIcon,
- RegistryIcon,
- VariableIcon,
- CustomizeIcon,
- GitBranchIcon,
- CloseIcon
- } from '$lib/icons';
- import HeaderCard from '$lib/components/header-card.svelte';
+ import { TemplateIcon, FileTextIcon, RegistryIcon, VariableIcon, CustomizeIcon, GitBranchIcon } from '$lib/icons';
+ import CategoryIndexPage from '$lib/components/category-index-page.svelte';
+ import type { NormalizedCategory } from '$lib/components/category-index-page.types';
let { data }: PageProps = $props();
let customizeCategories = $state<CustomizeCategory[]>([]);
@@ -68,166 +54,66 @@
function getIconComponent(iconName: string) {
return getCategoryIcon(iconMap, iconName, CustomizeIcon);
}
-</script>
-
-<div class="space-y-8 pb-5 md:space-y-10 md:pb-5">
- <HeaderCard>
- <div class="flex items-center justify-between gap-4">
- <div class="flex min-w-64 flex-1 items-center gap-3 sm:gap-4">
- <div
- class="bg-primary/10 text-primary ring-primary/20 flex size-8 shrink-0 items-center justify-center rounded-lg ring-1 sm:size-10"
- >
- <CustomizeIcon class="size-4 sm:size-5" />
- </div>
- <div class="min-w-0">
- <h1 class="text-3xl font-semibold tracking-tight">{m.customize_title()}</h1>
- <p class="text-muted-foreground mt-1 text-sm sm:text-base">{m.customize_subtitle()}</p>
- </div>
- </div>
- <div class="flex items-center gap-3">
- <UiConfigDisabledTag />
- </div>
- </div>
-
- <div class="relative mt-4 w-full sm:mt-6 sm:max-w-md">
- <InputGroup.Root>
- <InputGroup.Input
- placeholder={m.customize_search_placeholder()}
- value={categorySearch.searchQuery}
- oninput={(e) => {
- categorySearch.searchQuery = e.currentTarget.value;
- categorySearch.debouncedSearch(e.currentTarget.value);
- }}
- onkeydown={(e) => {
- if (e.key === 'Enter') {
- categorySearch.performSearch((e.currentTarget as HTMLInputElement).value);
- }
- }}
- />
- <InputGroup.Addon>
- {#if categorySearch.showSearchResults}
- <ArcaneButton
- action="base"
- tone="ghost"
- size="sm"
- onclick={categorySearch.clearSearch}
- class="h-6 w-6 p-0"
- icon={CloseIcon}
- showLabel={false}
- customLabel={m.customize_clear_search()}
- />
- {:else}
- <SearchIcon class="size-4" />
- {/if}
- </InputGroup.Addon>
- </InputGroup.Root>
- </div>
- </HeaderCard>
- {#if !categorySearch.showSearchResults}
- <div class="grid grid-cols-1 gap-4 sm:grid-cols-2 sm:gap-6 xl:grid-cols-3">
- {#each customizeCategories as category (category.id)}
- {@const Icon = getIconComponent(category.icon)}
- <Card class="hover:border-primary/20 group cursor-pointer transition-all duration-200 hover:shadow-md">
- <button onclick={() => navigateToCategory(category.url)} class="w-full p-4 text-left sm:p-6">
- <div class="flex items-start justify-between gap-3">
- <div class="flex min-w-0 flex-1 items-start gap-3 sm:gap-4">
- <div
- class="bg-primary/5 text-primary ring-primary/10 group-hover:bg-primary/10 flex size-10 shrink-0 items-center justify-center rounded-lg ring-1 transition-colors sm:size-12"
- >
- <Icon class="size-5 sm:size-6" />
- </div>
- <div class="min-w-0 flex-1">
- <h2 class="text-sm leading-tight font-semibold sm:text-base">{category.title}</h2>
- <p class="text-muted-foreground mt-1 text-xs leading-relaxed sm:text-sm">{category.description}</p>
- </div>
- </div>
- <ArrowRightIcon class="text-muted-foreground group-hover:text-foreground mt-1 size-4 shrink-0 transition-colors" />
- </div>
- </button>
- </Card>
- {/each}
- </div>
- {:else}
- <div class="space-y-6 sm:space-y-8">
- <div class="flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between">
- <h2 class="text-base font-semibold sm:text-lg">
- {m.customize_search_results({ query: categorySearch.searchQuery })} ({categorySearch.searchResults.length}
- {categorySearch.searchResults.length === 1 ? m.customize_result() : m.customize_results()})
- </h2>
- </div>
+ function normalize(category: CustomizeCategory): NormalizedCategory {
+ return {
+ id: category.id,
+ title: category.title,
+ description: category.description,
+ icon: getIconComponent(category.icon),
+ href: category.url,
+ matchingItems: category.matchingCustomizations
+ };
+ }
- {#if categorySearch.isSearching}
- <div class="py-8 text-center sm:py-12">
- <Spinner class="text-primary mx-auto mb-3 size-8 sm:mb-4 sm:size-12" />
- <p class="text-muted-foreground text-sm sm:text-base">{m.customize_searching()}</p>
- </div>
- {:else if categorySearch.searchResults.length === 0}
- <div class="py-8 text-center sm:py-12">
- <SearchIcon class="text-muted-foreground mx-auto mb-3 size-8 sm:mb-4 sm:size-12" />
- <h3 class="mb-2 text-base font-medium sm:text-lg">{m.customize_no_options()}</h3>
- <p class="text-muted-foreground text-sm sm:text-base">{m.customize_try_adjusting()}</p>
- </div>
- {:else}
- <div class="space-y-4 sm:space-y-6">
- {#each categorySearch.searchResults as result (result.id)}
- {@const Icon = getIconComponent(result.icon)}
- <div class="bg-background/40 rounded-lg border shadow-sm">
- <div class="border-b p-4 sm:p-6">
- <div class="flex items-center justify-between">
- <div class="flex items-center gap-3">
- <Icon class="text-primary size-4 shrink-0 sm:size-5" />
- <div>
- <h3 class="text-base font-semibold sm:text-lg">{result.title}</h3>
- <p class="text-muted-foreground text-xs sm:text-sm">{result.description}</p>
- </div>
- </div>
- <ArcaneButton action="base" size="sm" onclick={() => navigateToCategory(result.url)} class="shrink-0">
- {m.customize_button()}
- </ArcaneButton>
- </div>
- </div>
+ const normalizedCategories = $derived(customizeCategories.map(normalize));
+ const searchAdapter = {
+ get searchQuery() {
+ return categorySearch.searchQuery;
+ },
+ set searchQuery(value: string) {
+ categorySearch.searchQuery = value;
+ },
+ get showSearchResults() {
+ return categorySearch.showSearchResults;
+ },
+ get searchResults() {
+ return categorySearch.searchResults.map(normalize);
+ },
+ get isSearching() {
+ return categorySearch.isSearching;
+ },
+ performSearch: categorySearch.performSearch,
+ debouncedSearch: categorySearch.debouncedSearch,
+ clearSearch: categorySearch.clearSearch
+ };
+</script>
- <!-- Show matching customizations with descriptions -->
- {#if result.matchingCustomizations && result.matchingCustomizations.length > 0}
- <div class="space-y-3 p-4 sm:p-6">
- <h4 class="text-muted-foreground mb-3 text-sm font-medium">{m.customize_available_options()}</h4>
- {#each result.matchingCustomizations as customization (customization.key)}
- <div class="bg-background/60 border-primary/20 rounded-md border-l-2 p-3">
- <div class="flex items-start justify-between gap-3">
- <div class="min-w-0 flex-1">
- <h5 class="text-sm font-medium">{customization.label}</h5>
- {#if customization.description}
- <p class="text-muted-foreground mt-1 text-xs">{customization.description}</p>
- {/if}
- {#if customization.keywords && customization.keywords.length > 0}
- <div class="mt-2 flex flex-wrap gap-1">
- {#each customization.keywords.slice(0, 6) as keyword (keyword)}
- <span class="bg-muted/50 text-muted-foreground rounded px-2 py-0.5 text-xs">
- {keyword}
- </span>
- {/each}
- {#if customization.keywords.length > 6}
- <span class="text-muted-foreground px-2 py-0.5 text-xs">
- +{customization.keywords.length - 6}
- {m.customize_more()}
- </span>
- {/if}
- </div>
- {/if}
- </div>
- <div class="bg-muted/30 text-muted-foreground shrink-0 rounded px-2 py-1 font-mono text-xs">
- {customization.type}
- </div>
- </div>
- </div>
- {/each}
- </div>
- {/if}
- </div>
- {/each}
- </div>
- {/if}
- </div>
- {/if}
-</div>
+<CategoryIndexPage
+ headerIcon={CustomizeIcon}
+ title={m.customize_title()}
+ subtitle={m.customize_subtitle()}
+ searchPlaceholder={m.customize_search_placeholder()}
+ clearSearchLabel={m.customize_clear_search()}
+ searchingLabel={m.customize_searching()}
+ noResultsTitle={m.customize_no_options()}
+ noResultsDescription={m.customize_try_adjusting()}
+ matchingItemsLabel={m.customize_available_options()}
+ goToPageLabel={m.customize_button()}
+ rootClass="space-y-8 pb-5 md:space-y-10 md:pb-5"
+ cardClass="hover:border-primary/20 group cursor-pointer transition-all duration-200 hover:shadow-md"
+ resultCardClass="bg-background/40 rounded-lg border shadow-sm"
+ searchIconClass="size-4"
+ categories={normalizedCategories}
+ categorySearch={searchAdapter}
+ navigate={navigateToCategory}
+>
+ {#snippet resultsHeading()}
+ {m.customize_search_results({ query: categorySearch.searchQuery })} ({categorySearch.searchResults.length}
+ {categorySearch.searchResults.length === 1 ? m.customize_result() : m.customize_results()})
+ {/snippet}
+ {#snippet moreKeywords(count: number)}
+ +{count}
+ {m.customize_more()}
+ {/snippet}
+</CategoryIndexPage>
diff --git a/frontend/src/routes/(app)/customize/git-repositories/repository-table.svelte b/frontend/src/routes/(app)/customize/git-repositories/repository-table.svelte
index 34f621ac8..2e0a671a3 100644
--- a/frontend/src/routes/(app)/customize/git-repositories/repository-table.svelte
+++ b/frontend/src/routes/(app)/customize/git-repositories/repository-table.svelte
@@ -1,8 +1,9 @@
<script lang="ts">
import ArcaneTable from '$lib/components/arcane-table/arcane-table.svelte';
import StatusBadge from '$lib/components/badges/status-badge.svelte';
- import { ArcaneButton } from '$lib/components/arcane-button/index.js';
import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
+ import RowActionsMenu from '$lib/components/arcane-table/row-actions-menu.svelte';
+ import RemoveMenuItem from '$lib/components/arcane-table/cells/remove-menu-item.svelte';
import { toast } from 'svelte-sonner';
import { handleApiResultWithCallbacks } from '$lib/utils/api';
import { tryCatch } from '$lib/utils/api';
@@ -10,7 +11,8 @@
import type { GitRepository } from '$lib/types/automation';
import type { ColumnSpec, BulkAction } from '$lib/components/arcane-table';
import { UniversalMobileCard } from '$lib/components/arcane-table/index.js';
- import { format } from 'date-fns';
+ import EnabledStatusCell from '$lib/components/arcane-table/cells/enabled-status-cell.svelte';
+ import CreatedAtCell from '$lib/components/arcane-table/cells/created-at-cell.svelte';
import { m } from '$lib/paraglide/messages';
import { gitRepositoryService } from '$lib/services/git-repository-service';
import {
@@ -19,8 +21,7 @@
TrashIcon as Trash2Icon,
GitBranchIcon,
ApiKeyIcon as KeyIcon,
- ExternalLinkIcon as LinkIcon,
- EllipsisIcon
+ ExternalLinkIcon as LinkIcon
} from '$lib/icons';
import { hasPermission } from '$lib/utils/auth';
import IfPermitted from '$lib/components/if-permitted.svelte';
@@ -81,6 +82,7 @@
},
onComplete: async (result) => {
if (result.success > 0) {
+ // fallow-ignore-next-line code-duplication refresh handler calls gitRepositoryService (sync-table calls gitOpsSyncService); no shared surface
repositories = await gitRepositoryService.getRepositories(requestOptions);
}
},
@@ -145,13 +147,13 @@
accessorKey: 'enabled',
title: m.common_status(),
sortable: true,
- cell: StatusCell
+ cell: enabledStatusCol
},
{
accessorKey: 'createdAt',
title: m.common_created(),
sortable: true,
- cell: CreatedCell
+ cell: createdAtCol
}
] satisfies ColumnSpec<GitRepository>[];
@@ -165,6 +167,15 @@
];
</script>
+<!-- fallow-ignore-next-line code-duplication cell wrapper snippet around the shared EnabledStatusCell; arcane-table cell: API requires a per-table Snippet -->
+{#snippet enabledStatusCol({ value }: { value: unknown })}
+ <EnabledStatusCell {value} />
+{/snippet}
+
+{#snippet createdAtCol({ value }: { value: unknown })}
+ <CreatedAtCell {value} />
+{/snippet}
+
{#snippet NameCell({ value }: { value: unknown })}
<div class="flex items-center gap-2">
<GitBranchIcon class="text-muted-foreground size-4" />
@@ -187,15 +198,6 @@
{/if}
{/snippet}
-{#snippet StatusCell({ value }: { value: unknown })}
- {@const enabled = Boolean(value)}
- <StatusBadge variant={enabled ? 'green' : 'red'} text={enabled ? m.common_enabled() : m.common_disabled()} />
-{/snippet}
-
-{#snippet CreatedCell({ value }: { value: unknown })}
- <span class="text-sm">{value ? format(new Date(String(value)), 'PP p') : m.common_na()}</span>
-{/snippet}
-
{#snippet RepositoryMobileCardSnippet({
item,
mobileFieldVisibility
@@ -231,46 +233,25 @@
{/snippet}
{#snippet RowActions({ item }: { item: GitRepository })}
- <DropdownMenu.Root>
- <DropdownMenu.Trigger>
- {#snippet child({ props })}
- <ArcaneButton {...props} action="base" tone="ghost" size="icon" class="size-8">
- <span class="sr-only">{m.common_open_menu()}</span>
- <EllipsisIcon class="size-4" />
- </ArcaneButton>
- {/snippet}
- </DropdownMenu.Trigger>
- <DropdownMenu.Content align="end">
- <DropdownMenu.Group>
- <IfPermitted perm="git-repositories:test">
- <DropdownMenu.Item onclick={() => handleTest(item.id, item.name)} disabled={isLoading.testing}>
- <TestTubeIcon class="size-4" />
- {m.git_repository_test_connection()}
- </DropdownMenu.Item>
- </IfPermitted>
-
- <IfPermitted perm="git-repositories:update">
- <DropdownMenu.Item onclick={() => onEditRepository(item)}>
- <PencilIcon class="size-4" />
- {m.common_edit()}
- </DropdownMenu.Item>
- </IfPermitted>
+ <RowActionsMenu>
+ <IfPermitted perm="git-repositories:test">
+ <DropdownMenu.Item onclick={() => handleTest(item.id, item.name)} disabled={isLoading.testing}>
+ <TestTubeIcon class="size-4" />
+ {m.git_repository_test_connection()}
+ </DropdownMenu.Item>
+ </IfPermitted>
- {#if canDeleteRepository}
- <DropdownMenu.Separator />
+ <IfPermitted perm="git-repositories:update">
+ <DropdownMenu.Item onclick={() => onEditRepository(item)}>
+ <PencilIcon class="size-4" />
+ {m.common_edit()}
+ </DropdownMenu.Item>
+ </IfPermitted>
- <DropdownMenu.Item
- variant="destructive"
- onclick={() => handleDeleteOne(item.id, item.name)}
- disabled={isLoading.removing}
- >
- <Trash2Icon class="size-4" />
- {m.common_remove()}
- </DropdownMenu.Item>
- {/if}
- </DropdownMenu.Group>
- </DropdownMenu.Content>
- </DropdownMenu.Root>
+ {#if canDeleteRepository}
+ <RemoveMenuItem onclick={() => handleDeleteOne(item.id, item.name)} disabled={isLoading.removing} />
+ {/if}
+ </RowActionsMenu>
{/snippet}
<ArcaneTable
diff --git a/frontend/src/routes/(app)/customize/registries/registry-table.svelte b/frontend/src/routes/(app)/customize/registries/registry-table.svelte
index e9280b36d..6377689aa 100644
--- a/frontend/src/routes/(app)/customize/registries/registry-table.svelte
+++ b/frontend/src/routes/(app)/customize/registries/registry-table.svelte
@@ -1,8 +1,7 @@
<script lang="ts">
import ArcaneTable from '$lib/components/arcane-table/arcane-table.svelte';
- import StatusBadge from '$lib/components/badges/status-badge.svelte';
- import { ArcaneButton } from '$lib/components/arcane-button/index.js';
import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
+ import RowActionsMenu from '$lib/components/arcane-table/row-actions-menu.svelte';
import { Spinner } from '$lib/components/ui/spinner/index.js';
import { openConfirmDialog } from '$lib/components/confirm-dialog';
import { toast } from 'svelte-sonner';
@@ -12,10 +11,11 @@
import type { ContainerRegistry, ContainerRegistryPullUsage } from '$lib/types/docker';
import type { ColumnSpec, MobileFieldVisibility, BulkAction } from '$lib/components/arcane-table';
import { UniversalMobileCard } from '$lib/components/arcane-table/index.js';
- import { format } from 'date-fns';
+ import EnabledStatusCell from '$lib/components/arcane-table/cells/enabled-status-cell.svelte';
+ import CreatedAtCell from '$lib/components/arcane-table/cells/created-at-cell.svelte';
import { m } from '$lib/paraglide/messages';
import { containerRegistryService } from '$lib/services/container-registry-service';
- import { RegistryIcon, UserIcon, ExternalLinkIcon, EditIcon, TrashIcon, TestIcon, EllipsisIcon } from '$lib/icons';
+ import { RegistryIcon, UserIcon, ExternalLinkIcon, EditIcon, TrashIcon, TestIcon } from '$lib/icons';
import { hasPermission } from '$lib/utils/auth';
import IfPermitted from '$lib/components/if-permitted.svelte';
@@ -167,7 +167,7 @@
accessorKey: 'enabled',
title: m.common_status(),
sortable: true,
- cell: StatusCell
+ cell: enabledStatusCol
},
{
id: 'pullUsage',
@@ -179,7 +179,7 @@
accessorKey: 'createdAt',
title: m.common_created(),
sortable: true,
- cell: CreatedCell
+ cell: createdAtCol
}
] satisfies ColumnSpec<ContainerRegistry>[];
@@ -211,6 +211,14 @@
let mobileFieldVisibility = $state<Record<string, boolean>>({});
</script>
+{#snippet enabledStatusCol({ value }: { value: unknown })}
+ <EnabledStatusCell {value} />
+{/snippet}
+
+{#snippet createdAtCol({ value }: { value: unknown })}
+ <CreatedAtCell {value} />
+{/snippet}
+
{#snippet UrlCell({ item }: { item: ContainerRegistry })}
<div class="flex flex-col">
<span class="font-medium">{item.url || 'docker.io'}</span>
@@ -230,19 +238,10 @@
<span class="text-muted-foreground text-sm">{String(value ?? m.common_no_description())}</span>
{/snippet}
-{#snippet StatusCell({ value }: { value: unknown })}
- {@const enabled = Boolean(value)}
- <StatusBadge variant={enabled ? 'green' : 'red'} text={enabled ? m.common_enabled() : m.common_disabled()} />
-{/snippet}
-
{#snippet PullUsageCell({ item }: { item: ContainerRegistry })}
<span class="text-sm">{formatPullUsage(item)}</span>
{/snippet}
-{#snippet CreatedCell({ value }: { value: unknown })}
- <span class="text-sm">{value ? format(new Date(String(value)), 'PP p') : m.common_na()}</span>
-{/snippet}
-
{#snippet RegistryMobileCardSnippet({
item,
mobileFieldVisibility
@@ -287,54 +286,42 @@
{/snippet}
{#snippet RowActions({ item }: { item: ContainerRegistry })}
- <DropdownMenu.Root>
- <DropdownMenu.Trigger>
- {#snippet child({ props })}
- <ArcaneButton {...props} action="base" tone="ghost" size="icon" class="size-8">
- <span class="sr-only">{m.common_open_menu()}</span>
- <EllipsisIcon class="size-4" />
- </ArcaneButton>
- {/snippet}
- </DropdownMenu.Trigger>
- <DropdownMenu.Content align="end">
- <DropdownMenu.Group>
- <IfPermitted perm="registries:test">
- <DropdownMenu.Item onclick={() => handleTest(item.id, item.url)} disabled={testingId === item.id}>
- {#if testingId === item.id}
- <Spinner class="size-4" />
- {:else}
- <TestIcon class="size-4" />
- {/if}
- {m.registries_test_connection()}
- </DropdownMenu.Item>
- </IfPermitted>
+ <RowActionsMenu>
+ <IfPermitted perm="registries:test">
+ <DropdownMenu.Item onclick={() => handleTest(item.id, item.url)} disabled={testingId === item.id}>
+ {#if testingId === item.id}
+ <Spinner class="size-4" />
+ {:else}
+ <TestIcon class="size-4" />
+ {/if}
+ {m.registries_test_connection()}
+ </DropdownMenu.Item>
+ </IfPermitted>
- <IfPermitted perm="registries:update">
- <DropdownMenu.Item onclick={() => onEditRegistry(item)}>
- <EditIcon class="size-4" />
- {m.common_edit()}
- </DropdownMenu.Item>
- </IfPermitted>
+ <IfPermitted perm="registries:update">
+ <DropdownMenu.Item onclick={() => onEditRegistry(item)}>
+ <EditIcon class="size-4" />
+ {m.common_edit()}
+ </DropdownMenu.Item>
+ </IfPermitted>
- {#if canDeleteRegistry}
- <DropdownMenu.Separator />
+ {#if canDeleteRegistry}
+ <DropdownMenu.Separator />
- <DropdownMenu.Item
- variant="destructive"
- onclick={() => handleDeleteOne(item.id, item.url)}
- disabled={removingId === item.id}
- >
- {#if removingId === item.id}
- <Spinner class="size-4" />
- {:else}
- <TrashIcon class="size-4" />
- {/if}
- {m.common_remove()}
- </DropdownMenu.Item>
+ <DropdownMenu.Item
+ variant="destructive"
+ onclick={() => handleDeleteOne(item.id, item.url)}
+ disabled={removingId === item.id}
+ >
+ {#if removingId === item.id}
+ <Spinner class="size-4" />
+ {:else}
+ <TrashIcon class="size-4" />
{/if}
- </DropdownMenu.Group>
- </DropdownMenu.Content>
- </DropdownMenu.Root>
+ {m.common_remove()}
+ </DropdownMenu.Item>
+ {/if}
+ </RowActionsMenu>
{/snippet}
<div>
diff --git a/frontend/src/routes/(app)/customize/templates/[id]/+page.svelte b/frontend/src/routes/(app)/customize/templates/[id]/+page.svelte
index 349bde407..74911b486 100644
--- a/frontend/src/routes/(app)/customize/templates/[id]/+page.svelte
+++ b/frontend/src/routes/(app)/customize/templates/[id]/+page.svelte
@@ -12,12 +12,11 @@
import { untrack } from 'svelte';
import { toast } from 'svelte-sonner';
import { createForm } from '$lib/utils/settings';
- import { ComposeEditorSplit } from '$lib/components/compose';
+ import ComposeTemplateEditor from '$lib/components/ComposeTemplateEditor.svelte';
import { globalVariablesToMap } from '$lib/utils/template-load';
import {
createNamedTemplateSchema,
- getTemplateEditorValidationState,
- hasTemplateEditorErrors,
+ getTemplateEditorSaveState,
resetTemplateEditorFields,
runTemplateEditorSave
} from '$lib/utils/template-editor';
@@ -78,16 +77,10 @@
$inputs.composeContent.value !== originalCompose ||
$inputs.envContent.value !== originalEnv
);
- const validationState = $derived(
- getTemplateEditorValidationState(
- validation.composeValidationReady,
- validation.envValidationReady,
- validation.composeHasErrors,
- validation.envHasErrors
- )
- );
-
- const canSave = $derived(hasChanges && !hasTemplateEditorErrors(validationState));
+ // fallow-ignore-next-line code-duplication template editor form wiring (createForm + getTemplateEditorSaveState); hasChanges fields differ per page
+ const saveState = $derived(getTemplateEditorSaveState(validation, hasChanges));
+ const validationState = $derived(saveState.validationState);
+ const canSave = $derived(saveState.canSave);
async function handleSave() {
await runTemplateEditorSave({
@@ -192,6 +185,7 @@
<div class="mx-auto flex h-full min-h-0 w-full max-w-full flex-col gap-6 overflow-hidden p-2 pb-10 sm:p-6 sm:pb-10">
<!-- Header -->
+ <!-- fallow-ignore-next-line code-duplication page header/back chrome differs per template page (editable vs static header) -->
<div class="flex-shrink-0 space-y-3 sm:space-y-4">
<ArcaneButton action="base" tone="ghost" onclick={() => goto('/customize/templates')} class="w-fit gap-2">
<ArrowLeftIcon class="size-4" />
@@ -315,87 +309,18 @@
{#if !template.isRemote}
<!-- Edit layout: compose editor + env editor side by side -->
- <ComposeEditorSplit
- class="flex min-h-0 flex-1 flex-col gap-6 lg:grid lg:grid-cols-5 lg:grid-rows-1 lg:items-stretch"
- composeClass="contents"
- envClass="contents"
- >
- {#snippet compose()}
- <Card.Root class="flex min-h-0 min-w-0 flex-1 flex-col lg:col-span-3">
- <Card.Header icon={CodeIcon} class="shrink-0">
- <div class="flex flex-col space-y-1.5">
- <Card.Title>
- <h2>{m.templates_compose_template_label()}</h2>
- </Card.Title>
- <Card.Description>{m.templates_service_definitions()}</Card.Description>
- </div>
- </Card.Header>
- <Card.Content class="flex min-h-0 min-w-0 flex-1 flex-col p-0">
- <div class="min-h-0 min-w-0 flex-1 rounded-b-xl">
- <CodeEditor
- bind:value={$inputs.composeContent.value}
- language="yaml"
- readOnly={status.saving}
- fontSize="13px"
- bind:hasErrors={validation.composeHasErrors}
- bind:validationReady={validation.composeValidationReady}
- fileId="templates:custom:{template.id}:compose"
- originalValue={originalCompose}
- enableDiff={true}
- editorContext={{
- envContent: $inputs.envContent.value,
- composeContents: [$inputs.composeContent.value],
- globalVariables: globalVariableMap
- }}
- />
- </div>
- </Card.Content>
- {#if $inputs.composeContent.error}
- <Card.Footer class="pt-0">
- <p class="text-destructive text-xs font-medium">{$inputs.composeContent.error}</p>
- </Card.Footer>
- {/if}
- </Card.Root>
- {/snippet}
-
- {#snippet env()}
- <Card.Root class="flex min-h-0 min-w-0 flex-1 flex-col lg:col-span-2">
- <Card.Header icon={VariableIcon} class="shrink-0">
- <div class="flex flex-col space-y-1.5">
- <Card.Title>
- <h2>{m.templates_env_template_label()}</h2>
- </Card.Title>
- <Card.Description>{m.templates_default_config_values()}</Card.Description>
- </div>
- </Card.Header>
- <Card.Content class="flex min-h-0 min-w-0 flex-1 flex-col p-0">
- <div class="min-h-0 min-w-0 flex-1 rounded-b-xl">
- <CodeEditor
- bind:value={$inputs.envContent.value}
- language="env"
- readOnly={status.saving}
- fontSize="13px"
- bind:hasErrors={validation.envHasErrors}
- bind:validationReady={validation.envValidationReady}
- fileId="templates:custom:{template.id}:env"
- originalValue={originalEnv}
- enableDiff={true}
- editorContext={{
- envContent: $inputs.envContent.value,
- composeContents: [$inputs.composeContent.value],
- globalVariables: globalVariableMap
- }}
- />
- </div>
- </Card.Content>
- {#if $inputs.envContent.error}
- <Card.Footer class="pt-0">
- <p class="text-destructive text-xs font-medium">{$inputs.envContent.error}</p>
- </Card.Footer>
- {/if}
- </Card.Root>
- {/snippet}
- </ComposeEditorSplit>
+ <ComposeTemplateEditor
+ bind:composeValue={$inputs.composeContent.value}
+ bind:envValue={$inputs.envContent.value}
+ {originalCompose}
+ {originalEnv}
+ bind:validation
+ {globalVariableMap}
+ fileIdPrefix="templates:custom:{template.id}"
+ readOnly={status.saving}
+ composeError={$inputs.composeContent.error}
+ envError={$inputs.envContent.error}
+ />
{:else}
<!-- Read-only view for remote templates -->
<div class="grid flex-shrink-0 gap-4 sm:grid-cols-2">
diff --git a/frontend/src/routes/(app)/customize/templates/default/+page.svelte b/frontend/src/routes/(app)/customize/templates/default/+page.svelte
index 43449f0a8..ee87f99aa 100644
--- a/frontend/src/routes/(app)/customize/templates/default/+page.svelte
+++ b/frontend/src/routes/(app)/customize/templates/default/+page.svelte
@@ -1,22 +1,19 @@
<script lang="ts">
import { ArcaneButton } from '$lib/components/arcane-button/index.js';
- import * as Card from '$lib/components/ui/card';
import { toast } from 'svelte-sonner';
- import CodeEditor from '$lib/components/code-editor/editor.svelte';
import { createForm } from '$lib/utils/settings';
import { m } from '$lib/paraglide/messages';
import { templateService } from '$lib/services/template-service';
import { goto } from '$app/navigation';
import TemplateSelectionDialog from '$lib/components/dialogs/template-selection-dialog.svelte';
- import { ComposeEditorSplit } from '$lib/components/compose';
+ import ComposeTemplateEditor from '$lib/components/ComposeTemplateEditor.svelte';
import { untrack } from 'svelte';
import type { Template } from '$lib/types/swarm';
import { globalVariablesToMap } from '$lib/utils/template-load';
- import { ArrowLeftIcon, CodeIcon, VariableIcon } from '$lib/icons';
+ import { ArrowLeftIcon } from '$lib/icons';
import {
createTemplateContentSchema,
- getTemplateEditorValidationState,
- hasTemplateEditorErrors,
+ getTemplateEditorSaveState,
resetTemplateEditorFields,
runTemplateEditorSave
} from '$lib/utils/template-editor';
@@ -52,16 +49,9 @@
const hasChanges = $derived(
$inputs.composeContent.value !== originalComposeContent || $inputs.envContent.value !== originalEnvContent
);
- const validationState = $derived(
- getTemplateEditorValidationState(
- validation.composeValidationReady,
- validation.envValidationReady,
- validation.composeHasErrors,
- validation.envHasErrors
- )
- );
-
- const canSave = $derived(hasChanges && !hasTemplateEditorErrors(validationState));
+ const saveState = $derived(getTemplateEditorSaveState(validation, hasChanges));
+ const validationState = $derived(saveState.validationState);
+ const canSave = $derived(saveState.canSave);
async function handleSave() {
await runTemplateEditorSave({
@@ -146,91 +136,18 @@
</div>
</div>
- <ComposeEditorSplit
- class="flex min-h-0 flex-1 flex-col gap-6 lg:grid lg:grid-cols-5 lg:grid-rows-1 lg:items-stretch"
- composeClass="contents"
- envClass="contents"
- >
- {#snippet compose()}
- <Card.Root class="flex min-h-0 min-w-0 flex-1 flex-col lg:col-span-3">
- <Card.Header icon={CodeIcon} class="shrink-0">
- <div class="flex flex-col space-y-1.5">
- <Card.Title>
- <h2>{m.templates_compose_template_label()}</h2>
- </Card.Title>
- <Card.Description>{m.templates_service_definitions()}</Card.Description>
- </div>
- </Card.Header>
- <Card.Content class="flex min-h-0 min-w-0 flex-1 flex-col p-0">
- <div class="min-h-0 min-w-0 flex-1 rounded-b-xl">
- <CodeEditor
- bind:value={$inputs.composeContent.value}
- language="yaml"
- readOnly={ui.saving || ui.isLoadingTemplate}
- fontSize="13px"
- bind:hasErrors={validation.composeHasErrors}
- bind:validationReady={validation.composeValidationReady}
- fileId="templates:defaults:compose"
- originalValue={originalComposeContent}
- enableDiff={true}
- editorContext={{
- envContent: $inputs.envContent.value,
- composeContents: [$inputs.composeContent.value],
- globalVariables: globalVariableMap
- }}
- />
- </div>
- </Card.Content>
- {#if $inputs.composeContent.error}
- <Card.Footer class="pt-0">
- <p class="text-destructive text-xs font-medium">
- {$inputs.composeContent.error}
- </p>
- </Card.Footer>
- {/if}
- </Card.Root>
- {/snippet}
-
- {#snippet env()}
- <Card.Root class="flex min-h-0 min-w-0 flex-1 flex-col lg:col-span-2">
- <Card.Header icon={VariableIcon} class="shrink-0">
- <div class="flex flex-col space-y-1.5">
- <Card.Title>
- <h2>{m.templates_env_template_label()}</h2>
- </Card.Title>
- <Card.Description>{m.templates_default_config_values()}</Card.Description>
- </div>
- </Card.Header>
- <Card.Content class="flex min-h-0 min-w-0 flex-1 flex-col p-0">
- <div class="min-h-0 min-w-0 flex-1 rounded-b-xl">
- <CodeEditor
- bind:value={$inputs.envContent.value}
- language="env"
- readOnly={ui.saving || ui.isLoadingTemplate}
- fontSize="13px"
- bind:hasErrors={validation.envHasErrors}
- bind:validationReady={validation.envValidationReady}
- fileId="templates:defaults:env"
- originalValue={originalEnvContent}
- enableDiff={true}
- editorContext={{
- envContent: $inputs.envContent.value,
- composeContents: [$inputs.composeContent.value],
- globalVariables: globalVariableMap
- }}
- />
- </div>
- </Card.Content>
- {#if $inputs.envContent.error}
- <Card.Footer class="pt-0">
- <p class="text-destructive text-xs font-medium">
- {$inputs.envContent.error}
- </p>
- </Card.Footer>
- {/if}
- </Card.Root>
- {/snippet}
- </ComposeEditorSplit>
+ <ComposeTemplateEditor
+ bind:composeValue={$inputs.composeContent.value}
+ bind:envValue={$inputs.envContent.value}
+ originalCompose={originalComposeContent}
+ originalEnv={originalEnvContent}
+ bind:validation
+ {globalVariableMap}
+ fileIdPrefix="templates:defaults"
+ readOnly={ui.saving || ui.isLoadingTemplate}
+ composeError={$inputs.composeContent.error}
+ envError={$inputs.envContent.error}
+ />
</div>
<TemplateSelectionDialog bind:open={ui.showTemplateDialog} templates={data.templates || []} onSelect={handleTemplateSelect} />
diff --git a/frontend/src/routes/(app)/customize/templates/template-table.svelte b/frontend/src/routes/(app)/customize/templates/template-table.svelte
index e799c2e07..aa45352f7 100644
--- a/frontend/src/routes/(app)/customize/templates/template-table.svelte
+++ b/frontend/src/routes/(app)/customize/templates/template-table.svelte
@@ -1,9 +1,9 @@
<script lang="ts">
import ArcaneTable from '$lib/components/arcane-table/arcane-table.svelte';
- import { ArcaneButton } from '$lib/components/arcane-button/index.js';
import { Badge } from '$lib/components/ui/badge';
import { Spinner } from '$lib/components/ui/spinner/index.js';
import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
+ import RowActionsMenu from '$lib/components/arcane-table/row-actions-menu.svelte';
import { goto } from '$app/navigation';
import { toast } from 'svelte-sonner';
import { openConfirmDialog } from '$lib/components/confirm-dialog';
@@ -30,8 +30,7 @@
DownloadIcon,
TagIcon,
MoveToFolderIcon,
- RegistryIcon,
- EllipsisIcon
+ RegistryIcon
} from '$lib/icons';
let {
@@ -273,59 +272,47 @@
{/snippet}
{#snippet RowActions({ item }: { item: Template })}
- <DropdownMenu.Root>
- <DropdownMenu.Trigger>
- {#snippet child({ props })}
- <ArcaneButton {...props} action="base" tone="ghost" size="icon" class="size-8">
- <span class="sr-only">{m.common_open_menu()}</span>
- <EllipsisIcon class="size-4" />
- </ArcaneButton>
- {/snippet}
- </DropdownMenu.Trigger>
- <DropdownMenu.Content align="end">
- <DropdownMenu.Group>
- <DropdownMenu.Item onclick={() => goto(`/customize/templates/${item.id}`)}>
- <InspectIcon class="size-4" />
- {m.common_view_details()}
- </DropdownMenu.Item>
+ <RowActionsMenu>
+ <DropdownMenu.Item onclick={() => goto(`/customize/templates/${item.id}`)}>
+ <InspectIcon class="size-4" />
+ {m.common_view_details()}
+ </DropdownMenu.Item>
- <IfPermitted perm="projects:create">
- <DropdownMenu.Item onclick={() => goto(`/projects/new?templateId=${item.id}`)}>
- <MoveToFolderIcon class="size-4" />
- {m.compose_create_project()}
- </DropdownMenu.Item>
- </IfPermitted>
+ <IfPermitted perm="projects:create">
+ <DropdownMenu.Item onclick={() => goto(`/projects/new?templateId=${item.id}`)}>
+ <MoveToFolderIcon class="size-4" />
+ {m.compose_create_project()}
+ </DropdownMenu.Item>
+ </IfPermitted>
- {#if (item.isRemote && canReadTemplate) || (!item.isRemote && canDeleteTemplate)}
- <DropdownMenu.Separator />
- {/if}
+ {#if (item.isRemote && canReadTemplate) || (!item.isRemote && canDeleteTemplate)}
+ <DropdownMenu.Separator />
+ {/if}
- {#if item.isRemote && canReadTemplate}
- <DropdownMenu.Item onclick={() => handleDownloadTemplate(item.id, item.name)} disabled={downloadingId === item.id}>
- {#if downloadingId === item.id}
- <Spinner class="size-4" />
- {:else}
- <DownloadIcon class="size-4" />
- {/if}
- {m.templates_download()}
- </DropdownMenu.Item>
- {:else if !item.isRemote && canDeleteTemplate}
- <DropdownMenu.Item
- variant="destructive"
- onclick={() => handleDeleteTemplate(item.id, item.name)}
- disabled={deletingId === item.id}
- >
- {#if deletingId === item.id}
- <Spinner class="size-4" />
- {:else}
- <TrashIcon class="size-4" />
- {/if}
- {m.templates_delete_template()}
- </DropdownMenu.Item>
+ {#if item.isRemote && canReadTemplate}
+ <DropdownMenu.Item onclick={() => handleDownloadTemplate(item.id, item.name)} disabled={downloadingId === item.id}>
+ {#if downloadingId === item.id}
+ <Spinner class="size-4" />
+ {:else}
+ <DownloadIcon class="size-4" />
+ {/if}
+ {m.templates_download()}
+ </DropdownMenu.Item>
+ {:else if !item.isRemote && canDeleteTemplate}
+ <DropdownMenu.Item
+ variant="destructive"
+ onclick={() => handleDeleteTemplate(item.id, item.name)}
+ disabled={deletingId === item.id}
+ >
+ {#if deletingId === item.id}
+ <Spinner class="size-4" />
+ {:else}
+ <TrashIcon class="size-4" />
{/if}
- </DropdownMenu.Group>
- </DropdownMenu.Content>
- </DropdownMenu.Root>
+ {m.templates_delete_template()}
+ </DropdownMenu.Item>
+ {/if}
+ </RowActionsMenu>
{/snippet}
<ArcaneTable
diff --git a/frontend/src/routes/(app)/dashboard/dash-container-table.svelte b/frontend/src/routes/(app)/dashboard/dash-container-table.svelte
index 69fe6499b..ed1c307c8 100644
--- a/frontend/src/routes/(app)/dashboard/dash-container-table.svelte
+++ b/frontend/src/routes/(app)/dashboard/dash-container-table.svelte
@@ -1,9 +1,9 @@
<script lang="ts">
import ArcaneTable from '$lib/components/arcane-table/arcane-table.svelte';
- import { ArcaneButton } from '$lib/components/arcane-button/index.js';
import * as Card from '$lib/components/ui/card/index.js';
import StatusBadge from '$lib/components/badges/status-badge.svelte';
import { UniversalMobileCard } from '$lib/components/arcane-table/index.js';
+ import DashTableCardHeader from './dash-table-card-header.svelte';
import { getStatusVariant } from '$lib/utils/docker';
import { capitalizeFirstLetter } from '$lib/utils/formatting';
import type { SearchPaginationSortRequest, Paginated } from '$lib/types/shared';
@@ -14,7 +14,7 @@
import { goto } from '$app/navigation';
import { mode } from 'mode-watcher';
import { useResponsiveTableLimit } from '$lib/hooks/use-responsive-table-limit.svelte';
- import { ContainersIcon, ArrowRightIcon } from '$lib/icons';
+ import { ContainersIcon } from '$lib/icons';
import IconImage from '$lib/components/icon-image.svelte';
import { getThemedIconUrl } from '$lib/utils/docker';
@@ -102,20 +102,13 @@
<div class="flex flex-col lg:h-full lg:min-h-0" bind:clientHeight={tableLimit.measuredHeight}>
<Card.Root class="flex flex-col lg:h-full lg:min-h-0">
- <Card.Header icon={ContainersIcon} class="shrink-0">
- <div class="flex flex-1 items-center justify-between">
- <div class="flex flex-col space-y-1.5">
- <Card.Title>
- <h2><a class="hover:underline" href="/containers">{m.containers_title()}</a></h2>
- </Card.Title>
- <Card.Description>{m.containers_recent()}</Card.Description>
- </div>
- <ArcaneButton action="base" tone="ghost" size="sm" href="/containers" disabled={isLoading}>
- {m.common_view_all()}
- <ArrowRightIcon class="size-4" />
- </ArcaneButton>
- </div>
- </Card.Header>
+ <DashTableCardHeader
+ icon={ContainersIcon}
+ href="/containers"
+ title={m.containers_title()}
+ description={m.containers_recent()}
+ {isLoading}
+ />
<Card.Content class="px-0 lg:flex lg:min-h-0 lg:flex-1 lg:flex-col">
<ArcaneTable
items={{ ...containers, data: containers.data.slice(0, tableLimit.displayLimit) }}
diff --git a/frontend/src/routes/(app)/dashboard/dash-image-table.svelte b/frontend/src/routes/(app)/dashboard/dash-image-table.svelte
index 93699fc73..669e687e6 100644
--- a/frontend/src/routes/(app)/dashboard/dash-image-table.svelte
+++ b/frontend/src/routes/(app)/dashboard/dash-image-table.svelte
@@ -1,18 +1,18 @@
<script lang="ts">
import ArcaneTable from '$lib/components/arcane-table/arcane-table.svelte';
- import { ArcaneButton } from '$lib/components/arcane-button/index.js';
import * as Card from '$lib/components/ui/card/index.js';
- import StatusBadge from '$lib/components/badges/status-badge.svelte';
+ import InUseStatus from '$lib/components/arcane-table/cells/in-use-status.svelte';
import type { SearchPaginationSortRequest, Paginated } from '$lib/types/shared';
import type { ImageSummaryDto } from '$lib/types/docker';
import { bytes } from '$lib/utils/formatting';
import type { ColumnSpec } from '$lib/components/arcane-table';
import { UniversalMobileCard } from '$lib/components/arcane-table';
+ import DashTableCardHeader from './dash-table-card-header.svelte';
import { m } from '$lib/paraglide/messages';
import { imageService } from '$lib/services/image-service';
import { goto } from '$app/navigation';
import { useResponsiveTableLimit } from '$lib/hooks/use-responsive-table-limit.svelte';
- import { ImagesIcon, ArrowRightIcon } from '$lib/icons';
+ import { ImagesIcon } from '$lib/icons';
let {
images = $bindable(),
@@ -60,11 +60,7 @@
{/snippet}
{#snippet StatusCell({ item }: { item: ImageSummaryDto })}
- {#if item.inUse}
- <StatusBadge text={m.common_in_use()} variant="green" />
- {:else}
- <StatusBadge text={m.common_unused()} variant="amber" />
- {/if}
+ <InUseStatus inUse={item.inUse} />
{/snippet}
{#snippet TagCell({ item }: { item: ImageSummaryDto })}
@@ -109,20 +105,13 @@
<div class="flex flex-col lg:h-full lg:min-h-0" bind:clientHeight={tableLimit.measuredHeight}>
<Card.Root class="flex flex-col lg:h-full lg:min-h-0">
- <Card.Header icon={ImagesIcon} class="shrink-0">
- <div class="flex flex-1 items-center justify-between">
- <div class="flex flex-col space-y-1.5">
- <Card.Title>
- <h2><a class="hover:underline" href="/images">{m.images_title()}</a></h2>
- </Card.Title>
- <Card.Description>{m.images_top_largest()}</Card.Description>
- </div>
- <ArcaneButton action="base" tone="ghost" size="sm" href="/images" disabled={isLoading}>
- {m.common_view_all()}
- <ArrowRightIcon class="size-4" />
- </ArcaneButton>
- </div>
- </Card.Header>
+ <DashTableCardHeader
+ icon={ImagesIcon}
+ href="/images"
+ title={m.images_title()}
+ description={m.images_top_largest()}
+ {isLoading}
+ />
<Card.Content class="px-0 lg:flex lg:min-h-0 lg:flex-1 lg:flex-col">
<ArcaneTable
items={{ ...images, data: images.data.slice(0, tableLimit.displayLimit) }}
diff --git a/frontend/src/routes/(app)/dashboard/dash-table-card-header.svelte b/frontend/src/routes/(app)/dashboard/dash-table-card-header.svelte
new file mode 100644
index 000000000..14ec930dd
--- /dev/null
+++ b/frontend/src/routes/(app)/dashboard/dash-table-card-header.svelte
@@ -0,0 +1,32 @@
+<script lang="ts">
+ import { ArcaneButton } from '$lib/components/arcane-button/index.js';
+ import * as Card from '$lib/components/ui/card/index.js';
+ import type { Component } from 'svelte';
+ import { m } from '$lib/paraglide/messages';
+ import { ArrowRightIcon } from '$lib/icons';
+
+ interface Props {
+ icon: Component<any>;
+ href: string;
+ title: string;
+ description: string;
+ isLoading?: boolean;
+ }
+
+ let { icon, href, title, description, isLoading = false }: Props = $props();
+</script>
+
+<Card.Header {icon} class="shrink-0">
+ <div class="flex flex-1 items-center justify-between">
+ <div class="flex flex-col space-y-1.5">
+ <Card.Title>
+ <h2><a class="hover:underline" {href}>{title}</a></h2>
+ </Card.Title>
+ <Card.Description>{description}</Card.Description>
+ </div>
+ <ArcaneButton action="base" tone="ghost" size="sm" {href} disabled={isLoading}>
+ {m.common_view_all()}
+ <ArrowRightIcon class="size-4" />
+ </ArcaneButton>
+ </div>
+</Card.Header>
diff --git a/frontend/src/routes/(app)/dashboard/dashboard-environment-upgrade-action.svelte b/frontend/src/routes/(app)/dashboard/dashboard-environment-upgrade-action.svelte
index 316e8a5d4..7e607df8d 100644
--- a/frontend/src/routes/(app)/dashboard/dashboard-environment-upgrade-action.svelte
+++ b/frontend/src/routes/(app)/dashboard/dashboard-environment-upgrade-action.svelte
@@ -8,7 +8,7 @@
import systemUpgradeService from '$lib/services/api/system-upgrade-service';
import type { AppVersionInformation } from '$lib/types/settings';
import type { Environment } from '$lib/types/environment';
- import { extractApiErrorMessage } from '$lib/utils/api';
+ import { toastUpgradeError } from '$lib/utils/api';
import { DownloadIcon } from '$lib/icons';
// open/upgrading have no $bindable fallback: they bind to per-environment
@@ -103,9 +103,7 @@
toast.success(m.upgrade_success());
await onRefreshRequested?.();
} catch (error) {
- const errorMessage = extractApiErrorMessage(error);
- const wrappedPrefix = m.upgrade_failed({ error: '' });
- toast.error(errorMessage.startsWith(wrappedPrefix) ? errorMessage : m.upgrade_failed({ error: errorMessage }));
+ toastUpgradeError(error, m.upgrade_failed);
throw error;
}
}
diff --git a/frontend/src/routes/(app)/environments/[id]/components/JobsTab.svelte b/frontend/src/routes/(app)/environments/[id]/components/JobsTab.svelte
index 2d3341fa1..adc7ce25a 100644
--- a/frontend/src/routes/(app)/environments/[id]/components/JobsTab.svelte
+++ b/frontend/src/routes/(app)/environments/[id]/components/JobsTab.svelte
@@ -200,6 +200,64 @@
}
</script>
+{#snippet ContainerExclusionList(config: {
+ term: string;
+ mapItem: (container: ContainerSummaryDto) => {
+ value: string;
+ label: string;
+ disabled?: boolean;
+ hint?: string;
+ selected: boolean;
+ };
+ idPrefix: string;
+ onToggle: (containerName: string) => void;
+})}
+ <ScrollArea.Root class="h-64 w-full rounded-md border p-2">
+ <div class="space-y-2">
+ {#await containersPromise}
+ <div class="flex items-center justify-center p-4">
+ <Spinner class="size-4" />
+ </div>
+ {:then containers}
+ {@const allItems = containers.map(config.mapItem)}
+ {@const filteredItems = config.term
+ ? allItems.filter((item) => item.label.toLowerCase().includes(config.term.toLowerCase()))
+ : allItems}
+
+ {#if filteredItems.length === 0}
+ <p class="text-muted-foreground py-4 text-center text-sm">
+ {m.common_no_results_found()}
+ </p>
+ {:else}
+ {#each filteredItems as container (container.value)}
+ <div class="flex items-center space-x-2">
+ <Checkbox
+ id="{config.idPrefix}{container.value}"
+ checked={container.selected}
+ disabled={container.disabled}
+ onCheckedChange={() => config.onToggle(container.value)}
+ />
+ <Label
+ for="{config.idPrefix}{container.value}"
+ class="text-sm font-normal {container.disabled ? 'text-muted-foreground' : ''}"
+ >
+ {container.label}
+ {#if container.hint}
+ <span class="ml-1 text-xs opacity-70">{container.hint}</span>
+ {/if}
+ </Label>
+ </div>
+ {/each}
+ {/if}
+ {:catch error}
+ <div class="text-destructive p-2 text-sm">
+ {(error instanceof Error ? error.message : '') || 'Failed to load containers'}
+ </div>
+ {/await}
+ </div>
+ </ScrollArea.Root>
+{/snippet}
+
<div class="space-y-6">
<Card.Root>
<Card.Header icon={JobsIcon}>
@@ -264,50 +322,12 @@
<div class="space-y-2">
<Input type="search" placeholder={m.jobs_search_containers()} class="h-8" bind:value={searchTerm} />
- <ScrollArea.Root class="h-64 w-full rounded-md border p-2">
- <div class="space-y-2">
- {#await containersPromise}
- <div class="flex items-center justify-center p-4">
- <Spinner class="size-4" />
- </div>
- {:then containers}
- {@const allItems = containers.map(mapContainerToItem)}
- {@const filteredItems = searchTerm
- ? allItems.filter((item) => item.label.toLowerCase().includes(searchTerm.toLowerCase()))
- : allItems}
-
- {#if filteredItems.length === 0}
- <p class="text-muted-foreground py-4 text-center text-sm">
- {m.common_no_results_found()}
- </p>
- {:else}
- {#each filteredItems as container (container.value)}
- <div class="flex items-center space-x-2">
- <Checkbox
- id="container-{container.value}"
- checked={container.selected}
- disabled={container.disabled}
- onCheckedChange={() => toggleContainerExclusion(container.value)}
- />
- <Label
- for="container-{container.value}"
- class="text-sm font-normal {container.disabled ? 'text-muted-foreground' : ''}"
- >
- {container.label}
- {#if container.hint}
- <span class="ml-1 text-xs opacity-70">{container.hint}</span>
- {/if}
- </Label>
- </div>
- {/each}
- {/if}
- {:catch error}
- <div class="text-destructive p-2 text-sm">
- {(error instanceof Error ? error.message : '') || 'Failed to load containers'}
- </div>
- {/await}
- </div>
- </ScrollArea.Root>
+ {@render ContainerExclusionList({
+ term: searchTerm,
+ mapItem: mapContainerToItem,
+ idPrefix: 'container-',
+ onToggle: toggleContainerExclusion
+ })}
</div>
</div>
{/if}
@@ -362,45 +382,12 @@
class="h-8"
bind:value={autoHealSearchTerm}
/>
- <ScrollArea.Root class="h-64 w-full rounded-md border p-2">
- <div class="space-y-2">
- {#await containersPromise}
- <div class="flex items-center justify-center p-4">
- <Spinner class="size-4" />
- </div>
- {:then containers}
- {@const allItems = containers.map(mapContainerToAutoHealItem)}
- {@const filteredItems = autoHealSearchTerm
- ? allItems.filter((item) =>
- item.label.toLowerCase().includes(autoHealSearchTerm.toLowerCase())
- )
- : allItems}
-
- {#if filteredItems.length === 0}
- <p class="text-muted-foreground py-4 text-center text-sm">
- {m.common_no_results_found()}
- </p>
- {:else}
- {#each filteredItems as container (container.value)}
- <div class="flex items-center space-x-2">
- <Checkbox
- id="auto-heal-container-{container.value}"
- checked={container.selected}
- onCheckedChange={() => toggleAutoHealContainerExclusion(container.value)}
- />
- <Label for="auto-heal-container-{container.value}" class="text-sm font-normal">
- {container.label}
- </Label>
- </div>
- {/each}
- {/if}
- {:catch error}
- <div class="text-destructive p-2 text-sm">
- {(error instanceof Error ? error.message : '') || 'Failed to load containers'}
- </div>
- {/await}
- </div>
- </ScrollArea.Root>
+ {@render ContainerExclusionList({
+ term: autoHealSearchTerm,
+ mapItem: mapContainerToAutoHealItem,
+ idPrefix: 'auto-heal-container-',
+ onToggle: toggleAutoHealContainerExclusion
+ })}
</div>
</div>
{/if}
diff --git a/frontend/src/routes/(app)/environments/[id]/gitops/sync-table.svelte b/frontend/src/routes/(app)/environments/[id]/gitops/sync-table.svelte
index 6ba2beaf2..eb3f0574f 100644
--- a/frontend/src/routes/(app)/environments/[id]/gitops/sync-table.svelte
+++ b/frontend/src/routes/(app)/environments/[id]/gitops/sync-table.svelte
@@ -2,8 +2,9 @@
import ArcaneTable from '$lib/components/arcane-table/arcane-table.svelte';
import StatusBadge from '$lib/components/badges/status-badge.svelte';
import { LifecycleIndicator } from '$lib/components/lifecycle-indicator';
- import { ArcaneButton } from '$lib/components/arcane-button/index.js';
import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
+ import RowActionsMenu from '$lib/components/arcane-table/row-actions-menu.svelte';
+ import RemoveMenuItem from '$lib/components/arcane-table/cells/remove-menu-item.svelte';
import { toast } from 'svelte-sonner';
import { handleApiResultWithCallbacks } from '$lib/utils/api';
import { tryCatch } from '$lib/utils/api';
@@ -22,8 +23,7 @@
RefreshIcon as RefreshCwIcon,
GitBranchIcon,
ProjectsIcon as FolderIcon,
- HashIcon,
- EllipsisIcon
+ HashIcon
} from '$lib/icons';
import { bulkConfirmAndRun, confirmAndRun } from '$lib/utils/bulk-actions';
@@ -289,40 +289,19 @@
{/snippet}
{#snippet RowActions({ item }: { item: GitOpsSync })}
- <DropdownMenu.Root>
- <DropdownMenu.Trigger>
- {#snippet child({ props })}
- <ArcaneButton {...props} action="base" tone="ghost" size="icon" class="size-8">
- <span class="sr-only">{m.common_open_menu()}</span>
- <EllipsisIcon class="size-4" />
- </ArcaneButton>
- {/snippet}
- </DropdownMenu.Trigger>
- <DropdownMenu.Content align="end">
- <DropdownMenu.Group>
- <DropdownMenu.Item onclick={() => handlePerformSync(item.id, item.name)} disabled={isLoading.syncing}>
- <PlayIcon class="size-4" />
- {m.git_sync_perform()}
- </DropdownMenu.Item>
+ <RowActionsMenu>
+ <DropdownMenu.Item onclick={() => handlePerformSync(item.id, item.name)} disabled={isLoading.syncing}>
+ <PlayIcon class="size-4" />
+ {m.git_sync_perform()}
+ </DropdownMenu.Item>
- <DropdownMenu.Item onclick={() => onEditSync(item)}>
- <PencilIcon class="size-4" />
- {m.common_edit()}
- </DropdownMenu.Item>
+ <DropdownMenu.Item onclick={() => onEditSync(item)}>
+ <PencilIcon class="size-4" />
+ {m.common_edit()}
+ </DropdownMenu.Item>
- <DropdownMenu.Separator />
-
- <DropdownMenu.Item
- variant="destructive"
- onclick={() => handleDeleteOne(item.id, item.name)}
- disabled={isLoading.removing}
- >
- <Trash2Icon class="size-4" />
- {m.common_remove()}
- </DropdownMenu.Item>
- </DropdownMenu.Group>
- </DropdownMenu.Content>
- </DropdownMenu.Root>
+ <RemoveMenuItem onclick={() => handleDeleteOne(item.id, item.name)} disabled={isLoading.removing} />
+ </RowActionsMenu>
{/snippet}
<ArcaneTable
diff --git a/frontend/src/routes/(app)/environments/environment-table.svelte b/frontend/src/routes/(app)/environments/environment-table.svelte
index e88544a79..a07bff6aa 100644
--- a/frontend/src/routes/(app)/environments/environment-table.svelte
+++ b/frontend/src/routes/(app)/environments/environment-table.svelte
@@ -1,7 +1,7 @@
<script lang="ts">
import ArcaneTable from '$lib/components/arcane-table/arcane-table.svelte';
- import { ArcaneButton } from '$lib/components/arcane-button/index.js';
import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
+ import RowActionsMenu from '$lib/components/arcane-table/row-actions-menu.svelte';
import StatusBadge from '$lib/components/badges/status-badge.svelte';
import { Badge } from '$lib/components/ui/badge';
import { goto } from '$app/navigation';
@@ -9,7 +9,7 @@
import { handleApiResultWithCallbacks } from '$lib/utils/api';
import { tryCatch } from '$lib/utils/api';
import { toast } from 'svelte-sonner';
- import { extractApiErrorMessage } from '$lib/utils/api';
+ import { toastUpgradeError } from '$lib/utils/api';
import type { Paginated, SearchPaginationSortRequest } from '$lib/types/shared';
import type { ColumnSpec, MobileFieldVisibility, BulkAction } from '$lib/components/arcane-table';
import type { FilterOption } from '$lib/components/arcane-table/arcane-table.types.svelte';
@@ -25,7 +25,7 @@
import { environmentStore } from '$lib/stores/environment.store.svelte';
import { capitalizeFirstLetter } from '$lib/utils/formatting';
import { getEnvironmentStatusVariant, isEnvironmentOnline, resolveEnvironmentStatus } from '$lib/utils/docker';
- import { EyeOnIcon, TrashIcon, EnvironmentsIcon, InspectIcon, StatsIcon, EyeOffIcon, TestIcon, EllipsisIcon } from '$lib/icons';
+ import { EyeOnIcon, TrashIcon, EnvironmentsIcon, InspectIcon, StatsIcon, EyeOffIcon, TestIcon } from '$lib/icons';
let {
environments = $bindable(),
@@ -175,10 +175,8 @@
throw new Error(result.error || m.upgrade_failed({ error: 'Unknown error' }));
}
toast.success(m.upgrade_success());
- } catch (error: any) {
- const errorMessage = extractApiErrorMessage(error);
- const wrappedPrefix = m.upgrade_failed({ error: '' });
- toast.error(errorMessage.startsWith(wrappedPrefix) ? errorMessage : m.upgrade_failed({ error: errorMessage }));
+ } catch (error) {
+ toastUpgradeError(error, m.upgrade_failed);
throw error;
}
}
@@ -374,81 +372,65 @@
{/snippet}
{#snippet RowActions({ item }: { item: Environment })}
- <DropdownMenu.Root>
- <DropdownMenu.Trigger>
- {#snippet child({ props })}
- <ArcaneButton {...props} action="base" tone="ghost" size="icon" class="size-8">
- <span class="sr-only">{m.common_open_menu()}</span>
- <EllipsisIcon class="size-4" />
- </ArcaneButton>
- {/snippet}
- </DropdownMenu.Trigger>
- <DropdownMenu.Content align="end">
- <DropdownMenu.Group>
- <DropdownMenu.Item
- onclick={async () => {
- if (!item.enabled) {
- toast.error(m.environments_cannot_switch_disabled());
- return;
- }
- try {
- await environmentStore.setEnvironment(item);
- toast.success(m.environments_switched_to({ name: item.name }));
- } catch (error) {
- console.error('Failed to set environment:', error);
- }
- }}
- disabled={!item.enabled || environmentStore.selected?.id === item.id}
- >
- <EnvironmentsIcon class="size-4" />
- {environmentStore.selected?.id === item.id ? m.environments_current_environment() : m.environments_use_environment()}
- </DropdownMenu.Item>
-
- <DropdownMenu.Item onclick={() => goto(`/environments/${item.id}`)}>
- <InspectIcon class="size-4" />
- {m.common_view_details()}
- </DropdownMenu.Item>
-
- <DropdownMenu.Item onclick={() => handleTest(item.id)} disabled={isLoading.testing}>
- <TestIcon class="size-4" />
- {m.environments_test_connection()}
- </DropdownMenu.Item>
-
- {#if item.id !== '0'}
- <DropdownMenu.Separator />
-
- <EnvironmentUpgradeMenuItem
- environment={item}
- isOnline={isEnvironmentOnline(item)}
- disabled={isLoading.upgrading}
- isUpgradingThis={upgradingEnvironmentId === item.id}
- onSelect={handleUpgradeSelected}
- />
-
- <DropdownMenu.Item onclick={() => handleToggleEnabled(item)} disabled={isLoading.toggling}>
- {#if item.enabled}
- <EyeOffIcon class="size-4" />
- {m.common_disable()}
- {:else}
- <EyeOnIcon class="size-4" />
- {m.common_enable()}
- {/if}
- </DropdownMenu.Item>
-
- <DropdownMenu.Separator />
-
- <DropdownMenu.Item
- variant="destructive"
- onclick={() => handleDeleteOne(item.id, item.name)}
- disabled={isLoading.removing}
- >
- <TrashIcon class="size-4" />
- {m.common_delete()}
- </DropdownMenu.Item>
+ <RowActionsMenu>
+ <DropdownMenu.Item
+ onclick={async () => {
+ if (!item.enabled) {
+ toast.error(m.environments_cannot_switch_disabled());
+ return;
+ }
+ try {
+ await environmentStore.setEnvironment(item);
+ toast.success(m.environments_switched_to({ name: item.name }));
+ } catch (error) {
+ console.error('Failed to set environment:', error);
+ }
+ }}
+ disabled={!item.enabled || environmentStore.selected?.id === item.id}
+ >
+ <EnvironmentsIcon class="size-4" />
+ {environmentStore.selected?.id === item.id ? m.environments_current_environment() : m.environments_use_environment()}
+ </DropdownMenu.Item>
+
+ <DropdownMenu.Item onclick={() => goto(`/environments/${item.id}`)}>
+ <InspectIcon class="size-4" />
+ {m.common_view_details()}
+ </DropdownMenu.Item>
+
+ <DropdownMenu.Item onclick={() => handleTest(item.id)} disabled={isLoading.testing}>
+ <TestIcon class="size-4" />
+ {m.environments_test_connection()}
+ </DropdownMenu.Item>
+
+ {#if item.id !== '0'}
+ <DropdownMenu.Separator />
+
+ <EnvironmentUpgradeMenuItem
+ environment={item}
+ isOnline={isEnvironmentOnline(item)}
+ disabled={isLoading.upgrading}
+ isUpgradingThis={upgradingEnvironmentId === item.id}
+ onSelect={handleUpgradeSelected}
+ />
+
+ <DropdownMenu.Item onclick={() => handleToggleEnabled(item)} disabled={isLoading.toggling}>
+ {#if item.enabled}
+ <EyeOffIcon class="size-4" />
+ {m.common_disable()}
+ {:else}
+ <EyeOnIcon class="size-4" />
+ {m.common_enable()}
{/if}
- </DropdownMenu.Group>
- </DropdownMenu.Content>
- </DropdownMenu.Root>
+ </DropdownMenu.Item>
+
+ <DropdownMenu.Separator />
+
+ <DropdownMenu.Item variant="destructive" onclick={() => handleDeleteOne(item.id, item.name)} disabled={isLoading.removing}>
+ <TrashIcon class="size-4" />
+ {m.common_delete()}
+ </DropdownMenu.Item>
+ {/if}
+ </RowActionsMenu>
{/snippet}
<ArcaneTable
diff --git a/frontend/src/routes/(app)/events/event-table.svelte b/frontend/src/routes/(app)/events/event-table.svelte
index 164cf0d4a..78f96d47e 100644
--- a/frontend/src/routes/(app)/events/event-table.svelte
+++ b/frontend/src/routes/(app)/events/event-table.svelte
@@ -1,7 +1,7 @@
<script lang="ts">
import ArcaneTable from '$lib/components/arcane-table/arcane-table.svelte';
- import { ArcaneButton } from '$lib/components/arcane-button/index.js';
import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
+ import RowActionsMenu from '$lib/components/arcane-table/row-actions-menu.svelte';
import { toast } from 'svelte-sonner';
import { openConfirmDialog } from '$lib/components/confirm-dialog';
import StatusBadge from '$lib/components/badges/status-badge.svelte';
@@ -18,7 +18,7 @@
import { eventService } from '$lib/services/event-service';
import { environmentStore } from '$lib/stores/environment.store.svelte';
import IfPermitted from '$lib/components/if-permitted.svelte';
- import { TrashIcon, InfoIcon, NotificationsIcon, TagIcon, EnvironmentsIcon, UserIcon, EllipsisIcon } from '$lib/icons';
+ import { TrashIcon, InfoIcon, NotificationsIcon, TagIcon, EnvironmentsIcon, UserIcon } from '$lib/icons';
let {
events = $bindable(),
@@ -253,37 +253,25 @@
{/snippet}
{#snippet RowActions({ item }: { item: Event })}
- <DropdownMenu.Root>
- <DropdownMenu.Trigger>
- {#snippet child({ props })}
- <ArcaneButton {...props} action="base" tone="ghost" size="icon" class="size-8">
- <span class="sr-only">{m.common_open_menu()}</span>
- <EllipsisIcon class="size-4" />
- </ArcaneButton>
- {/snippet}
- </DropdownMenu.Trigger>
- <DropdownMenu.Content align="end">
- <DropdownMenu.Group>
- <DropdownMenu.Item onclick={() => openDetails(item)}>
- <InfoIcon class="size-4" />
- {m.common_view_details()}
- </DropdownMenu.Item>
+ <RowActionsMenu>
+ <DropdownMenu.Item onclick={() => openDetails(item)}>
+ <InfoIcon class="size-4" />
+ {m.common_view_details()}
+ </DropdownMenu.Item>
- <IfPermitted perm="events:delete">
- <DropdownMenu.Separator />
+ <IfPermitted perm="events:delete">
+ <DropdownMenu.Separator />
- <DropdownMenu.Item
- variant="destructive"
- onclick={() => handleDeleteEvent(item.id, item.title)}
- disabled={isLoading.removing}
- >
- <TrashIcon class="size-4" />
- {m.common_delete()}
- </DropdownMenu.Item>
- </IfPermitted>
- </DropdownMenu.Group>
- </DropdownMenu.Content>
- </DropdownMenu.Root>
+ <DropdownMenu.Item
+ variant="destructive"
+ onclick={() => handleDeleteEvent(item.id, item.title)}
+ disabled={isLoading.removing}
+ >
+ <TrashIcon class="size-4" />
+ {m.common_delete()}
+ </DropdownMenu.Item>
+ </IfPermitted>
+ </RowActionsMenu>
{/snippet}
<ArcaneTable
diff --git a/frontend/src/routes/(app)/images/[imageId]/+error.svelte b/frontend/src/routes/(app)/images/[imageId]/+error.svelte
index e952991cc..128cfea34 100644
--- a/frontend/src/routes/(app)/images/[imageId]/+error.svelte
+++ b/frontend/src/routes/(app)/images/[imageId]/+error.svelte
@@ -1,36 +1,10 @@
<script lang="ts">
- import { page } from '$app/state';
- import { goto } from '$app/navigation';
- import * as Empty from '$lib/components/ui/empty/index.js';
- import { ArcaneButton } from '$lib/components/arcane-button/index.js';
- import { AlertIcon } from '$lib/icons';
+ import ResourceErrorPage from '$lib/components/resource-error-page.svelte';
import { m } from '$lib/paraglide/messages';
-
- const status = $derived(page.status ?? 500);
- const message = $derived(page.error?.message ?? m.error_generic());
</script>
-<div class="flex h-full flex-1 flex-col items-center justify-center p-8">
- <Empty.Root>
- <Empty.Header>
- <Empty.Media variant="icon">
- <AlertIcon class="text-destructive size-16" aria-hidden="true" />
- </Empty.Media>
- <Empty.Title>
- {status === 404 ? m.error_not_found() : m.error_generic()}
- </Empty.Title>
- <Empty.Description>
- {message}
- </Empty.Description>
- </Empty.Header>
- <Empty.Content>
- <div class="flex flex-col items-center gap-3">
- <ArcaneButton
- action="base"
- customLabel={m.common_back_to({ resource: m.images_title() })}
- onclick={() => goto('/images')}
- />
- </div>
- </Empty.Content>
- </Empty.Root>
-</div>
+<ResourceErrorPage
+ fallbackTitle={m.error_generic()}
+ backLabel={m.common_back_to({ resource: m.images_title() })}
+ backHref="/images"
+/>
diff --git a/frontend/src/routes/(app)/images/[imageId]/+page.svelte b/frontend/src/routes/(app)/images/[imageId]/+page.svelte
index e0e02e330..6d24ee5e8 100644
--- a/frontend/src/routes/(app)/images/[imageId]/+page.svelte
+++ b/frontend/src/routes/(app)/images/[imageId]/+page.svelte
@@ -38,6 +38,7 @@
let securityTab = $state('attestations');
const currentEnvId = $derived(environmentStore.selected?.id || '0');
+ // fallow-ignore-next-line code-duplication permission $derived declarations; script-level, no shared render surface
const canDeleteImage = $derived(hasPermission('images:delete', currentEnvId));
const canScanImage = $derived(hasPermission('vulnerabilities:scan', currentEnvId));
const canTagImage = $derived(hasPermission('images:tag', currentEnvId));
diff --git a/frontend/src/routes/(app)/images/builds/+page.svelte b/frontend/src/routes/(app)/images/builds/+page.svelte
index 02d0cf758..121bea3c4 100644
--- a/frontend/src/routes/(app)/images/builds/+page.svelte
+++ b/frontend/src/routes/(app)/images/builds/+page.svelte
@@ -340,9 +340,6 @@
});
const isIndeterminate = $derived(isIndeterminatePhase(layerProgress, buildProgress));
const progressValue = $derived(Math.round(hasReachedComplete ? 100 : buildProgress));
- const selectedProviderLabel = $derived.by(
- () => providerOptions.find((option) => option.value === $inputs.provider.value)?.label ?? m.local_docker()
- );
const statusLabel = $derived.by(() => {
if (buildError) return m.common_error();
if (hasReachedComplete) return m.build_completed();
@@ -865,6 +862,21 @@
}
</script>
+{#snippet workspaceCard()}
+ <Card.Root class="flex h-full flex-col overflow-hidden">
+ <BuildWorkspacePanel
+ rootLabel={buildsRootLabel}
+ rootPath={buildsRoot}
+ {contextMode}
+ {contextDir}
+ remoteContext={remoteContextSource}
+ onModeChange={(mode) => (contextMode = mode)}
+ onRemoteContextChange={(value: string) => (remoteContextSource = value)}
+ onSelectContext={(path: string) => (selectedContextPath = path)}
+ />
+ </Card.Root>
+{/snippet}
+
{#snippet BuildHistoryStatusCell({ value }: { value: unknown })}
<StatusBadge
variant={getStatusBadgeVariant(value as ImageBuildStatus)}
@@ -1273,7 +1285,7 @@
</Tabs.List>
<div class="flex items-center gap-3 pr-2">
- <BuildControls {inputs} {providerOptions} {selectedProviderLabel} {isBuilding} onBuild={handleSubmit} />
+ <BuildControls {inputs} {providerOptions} {isBuilding} onBuild={handleSubmit} />
<div class="bg-border hidden h-4 w-px xl:block"></div>
<div class="flex items-center gap-2">
<div class="relative flex items-center">
@@ -1351,18 +1363,7 @@
persistKey="arcane.build.workspace.split"
>
{#snippet first()}
- <Card.Root class="flex h-full flex-col overflow-hidden">
- <BuildWorkspacePanel
- rootLabel={buildsRootLabel}
- rootPath={buildsRoot}
- {contextMode}
- {contextDir}
- remoteContext={remoteContextSource}
- onModeChange={(mode) => (contextMode = mode)}
- onRemoteContextChange={(value: string) => (remoteContextSource = value)}
- onSelectContext={(path: string) => (selectedContextPath = path)}
- />
- </Card.Root>
+ {@render workspaceCard()}
{/snippet}
{#snippet second()}
<Card.Root class="flex h-full flex-col overflow-hidden">
@@ -1396,7 +1397,7 @@
{#snippet headerActions()}
{#if mainTab === 'build'}
- <BuildControls {inputs} {providerOptions} {selectedProviderLabel} {isBuilding} onBuild={handleSubmit} />
+ <BuildControls {inputs} {providerOptions} {isBuilding} onBuild={handleSubmit} />
{/if}
{/snippet}
@@ -1416,22 +1417,11 @@
</div>
{/snippet}
{#snippet headerActions()}
- <BuildControls {inputs} {providerOptions} {selectedProviderLabel} {isBuilding} onBuild={handleSubmit} />
+ <BuildControls {inputs} {providerOptions} {isBuilding} onBuild={handleSubmit} />
{/snippet}
{#snippet tabContent(buildTabValue)}
{#if buildTabValue === 'workspace'}
- <Card.Root class="flex h-full flex-col overflow-hidden">
- <BuildWorkspacePanel
- rootLabel={buildsRootLabel}
- rootPath={buildsRoot}
- {contextMode}
- {contextDir}
- remoteContext={remoteContextSource}
- onModeChange={(mode) => (contextMode = mode)}
- onRemoteContextChange={(value: string) => (remoteContextSource = value)}
- onSelectContext={(path: string) => (selectedContextPath = path)}
- />
- </Card.Root>
+ {@render workspaceCard()}
{:else if buildTabValue === 'configuration'}
<Card.Root class="overflow-hidden">
<BuildConfigPanel {inputs} provider={$inputs.provider.value} bind:showAdvanced onSubmit={handleSubmit} />
diff --git a/frontend/src/routes/(app)/images/builds/build-workspace-browser.svelte b/frontend/src/routes/(app)/images/builds/build-workspace-browser.svelte
index 34b3d76cb..1bc2a503f 100644
--- a/frontend/src/routes/(app)/images/builds/build-workspace-browser.svelte
+++ b/frontend/src/routes/(app)/images/builds/build-workspace-browser.svelte
@@ -17,7 +17,7 @@
import { hasPermission } from '$lib/utils/auth';
import { queryKeys } from '$lib/query/query-keys';
import type { FileEntry } from '$lib/types/shared';
- import type { FileProvider } from '$lib/components/file-browser';
+ import { sortFileEntries, type FileProvider } from '$lib/components/file-browser';
import { createMutation, createQuery, useQueryClient } from '@tanstack/svelte-query';
let {
@@ -46,11 +46,7 @@
const files = $derived.by<FileEntry[]>(() => {
const result = (filesQuery.data ?? []).slice();
- return result.sort((a, b) => {
- if (a.isDirectory && !b.isDirectory) return -1;
- if (!a.isDirectory && b.isDirectory) return 1;
- return a.name.localeCompare(b.name);
- });
+ return sortFileEntries(result);
});
const loading = $derived(filesQuery.isPending);
diff --git a/frontend/src/routes/(app)/images/builds/components/build-controls.svelte b/frontend/src/routes/(app)/images/builds/components/build-controls.svelte
index c5d7857e8..44b7e3754 100644
--- a/frontend/src/routes/(app)/images/builds/components/build-controls.svelte
+++ b/frontend/src/routes/(app)/images/builds/components/build-controls.svelte
@@ -1,7 +1,7 @@
<script lang="ts">
import { ArcaneButton } from '$lib/components/arcane-button/index.js';
import { Label } from '$lib/components/ui/label';
- import * as Select from '$lib/components/ui/select/index.js';
+ import SelectWithLabel from '$lib/components/form/select-with-label.svelte';
import { Switch } from '$lib/components/ui/switch/index.js';
import { m } from '$lib/paraglide/messages';
import IfPermitted from '$lib/components/if-permitted.svelte';
@@ -10,36 +10,26 @@
let {
inputs,
providerOptions,
- selectedProviderLabel,
isBuilding = false,
onBuild
}: {
inputs: BuildFormInputsStore;
providerOptions: BuildProviderOption[];
- selectedProviderLabel: string;
isBuilding?: boolean;
onBuild?: () => void;
} = $props();
</script>
<div class="flex flex-wrap items-center justify-end gap-3">
- <Select.Root type="single" bind:value={$inputs.provider.value}>
- <Select.Trigger size="sm" class="w-[160px]">
- <span class="truncate">{selectedProviderLabel}</span>
- </Select.Trigger>
- <Select.Content>
- {#each providerOptions as option (option.value)}
- <Select.Item value={option.value}>
- <div class="flex flex-col items-start gap-0.5">
- <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}
- </Select.Content>
- </Select.Root>
+ <SelectWithLabel
+ id="build-provider"
+ label={m.build_provider()}
+ hideLabel
+ triggerSize="sm"
+ triggerClass="w-[160px]"
+ options={providerOptions}
+ bind:value={$inputs.provider.value}
+ />
<div class="bg-border hidden h-6 w-px lg:block"></div>
diff --git a/frontend/src/routes/(app)/images/components/image-tag-dialog.svelte b/frontend/src/routes/(app)/images/components/image-tag-dialog.svelte
index 8887150f3..7149124f9 100644
--- a/frontend/src/routes/(app)/images/components/image-tag-dialog.svelte
+++ b/frontend/src/routes/(app)/images/components/image-tag-dialog.svelte
@@ -1,7 +1,7 @@
<script lang="ts">
+ import SheetFooterActions from '$lib/components/sheets/sheet-footer-actions.svelte';
import * as ResponsiveDialog from '$lib/components/ui/responsive-dialog/index.js';
- import { ArcaneButton } from '$lib/components/arcane-button';
- import FormInput from '$lib/components/form/form-input.svelte';
+ import RepoTagFields from '$lib/components/form/repo-tag-fields.svelte';
import { createForm, preventDefault } from '$lib/utils/settings';
import { imageService } from '$lib/services/image-service';
import { m } from '$lib/paraglide/messages';
@@ -68,27 +68,18 @@
>
{#snippet children()}
<form onsubmit={preventDefault(handleSubmit)} class="grid gap-4 py-4">
- <FormInput
- label={m.images_tag_repository()}
- placeholder={m.images_tag_repository_placeholder()}
- bind:input={$inputs.repository}
- />
- <FormInput label={m.images_tag()} placeholder={m.images_tag_latest()} bind:input={$inputs.tag} />
+ <RepoTagFields bind:repository={$inputs.repository} bind:tag={$inputs.tag} />
</form>
{/snippet}
{#snippet footer()}
- <div class="flex w-full gap-2">
- <ArcaneButton action="cancel" tone="outline" type="button" class="flex-1" onclick={() => handleOpenChange(false)} />
- <ArcaneButton
- action="base"
- type="submit"
- class="flex-1"
- customLabel={m.images_tag_image()}
- loading={isTagging}
- disabled={isTagging}
- onclick={handleSubmit}
- />
- </div>
+ <SheetFooterActions
+ onCancel={() => handleOpenChange(false)}
+ submitAction="base"
+ submitLabel={m.images_tag_image()}
+ submitLoading={isTagging}
+ submitDisabled={isTagging}
+ onSubmit={handleSubmit}
+ />
{/snippet}
</ResponsiveDialog.Root>
diff --git a/frontend/src/routes/(app)/images/image-table.svelte b/frontend/src/routes/(app)/images/image-table.svelte
index 5213f38f4..3bc634cf7 100644
--- a/frontend/src/routes/(app)/images/image-table.svelte
+++ b/frontend/src/routes/(app)/images/image-table.svelte
@@ -1,14 +1,14 @@
<script lang="ts">
import ArcaneTable from '$lib/components/arcane-table/arcane-table.svelte';
- import { ArcaneButton } from '$lib/components/arcane-button/index.js';
import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
+ import RowActionsMenu from '$lib/components/arcane-table/row-actions-menu.svelte';
import { Spinner } from '$lib/components/ui/spinner/index.js';
import { goto } from '$app/navigation';
import { onDestroy } from 'svelte';
import { toast } from 'svelte-sonner';
import { bytes } from '$lib/utils/formatting';
+ import { inUseBadge } from '$lib/utils/mobile-card-badges';
import { openConfirmDialog } from '$lib/components/confirm-dialog';
- import StatusBadge from '$lib/components/badges/status-badge.svelte';
import { Badge } from '$lib/components/ui/badge/index.js';
import { handleApiResultWithCallbacks } from '$lib/utils/api';
import { tryCatch } from '$lib/utils/api';
@@ -30,6 +30,8 @@
import { hasPermission } from '$lib/utils/auth';
import { activityToastOptions, extractActivityId } from '$lib/utils/activity-toast';
import { bulkConfirmAndRun } from '$lib/utils/bulk-actions';
+ import InUseStatus from '$lib/components/arcane-table/cells/in-use-status.svelte';
+ import UnixCreatedCell from '$lib/components/arcane-table/cells/unix-created-cell.svelte';
import {
DownloadIcon,
@@ -38,7 +40,6 @@
ImagesIcon,
VolumesIcon,
ClockIcon,
- EllipsisIcon,
ScanIcon,
ProjectsIcon,
ContainersIcon,
@@ -449,15 +450,55 @@
{/snippet}
{#snippet CreatedCell({ value }: { value: unknown })}
- {format(new Date(Number(value || 0) * 1000), 'PP p')}
+ <UnixCreatedCell {value} />
{/snippet}
{#snippet StatusCell({ item }: { item: ImageSummaryDto })}
- {#if item.inUse}
- <StatusBadge text={m.common_in_use()} variant="green" />
- {:else}
- <StatusBadge text={m.common_unused()} variant="amber" />
- {/if}
+ <InUseStatus inUse={item.inUse} />
+{/snippet}
+
+{#snippet UsageBadgeList(usages: NonNullable<ImageSummaryDto['usedBy']>)}
+ {#each usages as usage, usageIndex (`${usage.type}-${usage.id ?? usage.name}-${usageIndex}`)}
+ {#if usage.type === 'project'}
+ {#if usage.id}
+ <a class="inline-flex" href={`/projects/${encodeURIComponent(usage.id)}`}>
+ <Badge
+ variant="outline"
+ class="hover:bg-accent/40 focus-visible:ring-primary/40 bg-background/80 inline-flex items-center gap-1 rounded-md text-xs transition-colors focus-visible:ring-2"
+ >
+ <ProjectsIcon class="size-3" />
+ <span>{usage.name}</span>
+ </Badge>
+ </a>
+ {:else}
+ <Badge
+ variant="outline"
+ class="hover:bg-accent/40 focus-visible:ring-primary/40 bg-background/80 inline-flex items-center gap-1 rounded-md text-xs transition-colors focus-visible:ring-2"
+ >
+ <ProjectsIcon class="size-3" />
+ <span>{usage.name}</span>
+ </Badge>
+ {/if}
+ {:else if usage.id}
+ <a class="inline-flex" href={`/containers/${encodeURIComponent(usage.id)}`}>
+ <Badge
+ variant="outline"
+ class="hover:bg-accent/40 focus-visible:ring-primary/40 bg-background/80 inline-flex items-center gap-1 rounded-md text-xs transition-colors focus-visible:ring-2"
+ >
+ <ContainersIcon class="size-3" />
+ <span>{usage.name}</span>
+ </Badge>
+ </a>
+ {:else}
+ <Badge
+ variant="outline"
+ class="hover:bg-accent/40 focus-visible:ring-primary/40 bg-background/80 inline-flex items-center gap-1 rounded-md text-xs transition-colors focus-visible:ring-2"
+ >
+ <ContainersIcon class="size-3" />
+ <span>{usage.name}</span>
+ </Badge>
+ {/if}
+ {/each}
{/snippet}
{#snippet UsedByCell({ item }: { item: ImageSummaryDto })}
@@ -467,47 +508,7 @@
{@const visibleUsage = hasOverflow ? item.usedBy.slice(0, maxVisible) : item.usedBy}
{@const overflowUsage = hasOverflow ? item.usedBy.slice(maxVisible) : []}
<div class="flex flex-wrap gap-1.5">
- {#each visibleUsage as usage, usageIndex (`${usage.type}-${usage.id ?? usage.name}-${usageIndex}`)}
- {#if usage.type === 'project'}
- {#if usage.id}
- <a class="inline-flex" href={`/projects/${encodeURIComponent(usage.id)}`}>
- <Badge
- variant="outline"
- class="hover:bg-accent/40 focus-visible:ring-primary/40 bg-background/80 inline-flex items-center gap-1 rounded-md text-xs transition-colors focus-visible:ring-2"
- >
- <ProjectsIcon class="size-3" />
- <span>{usage.name}</span>
- </Badge>
- </a>
- {:else}
- <Badge
- variant="outline"
- class="hover:bg-accent/40 focus-visible:ring-primary/40 bg-background/80 inline-flex items-center gap-1 rounded-md text-xs transition-colors focus-visible:ring-2"
- >
- <ProjectsIcon class="size-3" />
- <span>{usage.name}</span>
- </Badge>
- {/if}
- {:else if usage.id}
- <a class="inline-flex" href={`/containers/${encodeURIComponent(usage.id)}`}>
- <Badge
- variant="outline"
- class="hover:bg-accent/40 focus-visible:ring-primary/40 bg-background/80 inline-flex items-center gap-1 rounded-md text-xs transition-colors focus-visible:ring-2"
- >
- <ContainersIcon class="size-3" />
- <span>{usage.name}</span>
- </Badge>
- </a>
- {:else}
- <Badge
- variant="outline"
- class="hover:bg-accent/40 focus-visible:ring-primary/40 bg-background/80 inline-flex items-center gap-1 rounded-md text-xs transition-colors focus-visible:ring-2"
- >
- <ContainersIcon class="size-3" />
- <span>{usage.name}</span>
- </Badge>
- {/if}
- {/each}
+ {@render UsageBadgeList(visibleUsage)}
{#if hasOverflow}
<Tooltip.Provider>
<Tooltip.Root>
@@ -521,47 +522,7 @@
</Tooltip.Trigger>
<Tooltip.Content class="pointer-events-auto">
<div class="flex max-w-xs flex-wrap gap-1.5">
- {#each overflowUsage as usage, usageIndex (`${usage.type}-${usage.id ?? usage.name}-${usageIndex}`)}
- {#if usage.type === 'project'}
- {#if usage.id}
- <a class="inline-flex" href={`/projects/${encodeURIComponent(usage.id)}`}>
- <Badge
- variant="outline"
- class="hover:bg-accent/40 focus-visible:ring-primary/40 bg-background/80 inline-flex items-center gap-1 rounded-md text-xs transition-colors focus-visible:ring-2"
- >
- <ProjectsIcon class="size-3" />
- <span>{usage.name}</span>
- </Badge>
- </a>
- {:else}
- <Badge
- variant="outline"
- class="hover:bg-accent/40 focus-visible:ring-primary/40 bg-background/80 inline-flex items-center gap-1 rounded-md text-xs transition-colors focus-visible:ring-2"
- >
- <ProjectsIcon class="size-3" />
- <span>{usage.name}</span>
- </Badge>
- {/if}
- {:else if usage.id}
- <a class="inline-flex" href={`/containers/${encodeURIComponent(usage.id)}`}>
- <Badge
- variant="outline"
- class="hover:bg-accent/40 focus-visible:ring-primary/40 bg-background/80 inline-flex items-center gap-1 rounded-md text-xs transition-colors focus-visible:ring-2"
- >
- <ContainersIcon class="size-3" />
- <span>{usage.name}</span>
- </Badge>
- </a>
- {:else}
- <Badge
- variant="outline"
- class="hover:bg-accent/40 focus-visible:ring-primary/40 bg-background/80 inline-flex items-center gap-1 rounded-md text-xs transition-colors focus-visible:ring-2"
- >
- <ContainersIcon class="size-3" />
- <span>{usage.name}</span>
- </Badge>
- {/if}
- {/each}
+ {@render UsageBadgeList(overflowUsage)}
</div>
</Tooltip.Content>
</Tooltip.Root>
@@ -616,12 +577,7 @@
}}
subtitle={(item) => ((mobileFieldVisibility['id'] ?? false) ? item.id : null)}
badges={[
- (item: ImageSummaryDto) =>
- (mobileFieldVisibility['inUse'] ?? true)
- ? item.inUse
- ? { variant: 'green' as const, text: m.common_in_use() }
- : { variant: 'amber' as const, text: m.common_unused() }
- : null,
+ inUseBadge(mobileFieldVisibility['inUse'] ?? true),
(item: ImageSummaryDto) => {
if (!(mobileFieldVisibility['updates'] ?? false)) return null;
if (!item.repoDigests || item.repoDigests.length === 0) {
@@ -675,80 +631,68 @@
{/snippet}
{#snippet RowActions({ item }: { item: ImageSummaryDto })}
- <DropdownMenu.Root>
- <DropdownMenu.Trigger>
- {#snippet child({ props })}
- <ArcaneButton {...props} action="base" tone="ghost" size="icon" class="size-8">
- <span class="sr-only">{m.common_open_menu()}</span>
- <EllipsisIcon class="size-4" />
- </ArcaneButton>
- {/snippet}
- </DropdownMenu.Trigger>
- <DropdownMenu.Content align="end">
- <DropdownMenu.Group>
- <DropdownMenu.Item onclick={() => goto(`/images/${item.id}`)}>
- <InspectIcon class="size-4" />
- {m.common_inspect()}
- </DropdownMenu.Item>
-
- {#if canPullImage || canScanImage || canTagImage || canReadImage}
- <DropdownMenu.Separator />
- {/if}
-
- {#if canTagImage}
- <DropdownMenu.Item onclick={() => (tagDialogImage = item)}>
- <TagIcon class="size-4" />
- {m.images_tag_image()}
- </DropdownMenu.Item>
- {/if}
-
- {#if canReadImage}
- <DropdownMenu.Item onclick={() => handleExportImage(item.id)}>
- <DownloadIcon class="size-4" />
- {m.images_export()}
- </DropdownMenu.Item>
+ <RowActionsMenu>
+ <DropdownMenu.Item onclick={() => goto(`/images/${item.id}`)}>
+ <InspectIcon class="size-4" />
+ {m.common_inspect()}
+ </DropdownMenu.Item>
+
+ {#if canPullImage || canScanImage || canTagImage || canReadImage}
+ <DropdownMenu.Separator />
+ {/if}
+
+ {#if canTagImage}
+ <DropdownMenu.Item onclick={() => (tagDialogImage = item)}>
+ <TagIcon class="size-4" />
+ {m.images_tag_image()}
+ </DropdownMenu.Item>
+ {/if}
+
+ {#if canReadImage}
+ <DropdownMenu.Item onclick={() => handleExportImage(item.id)}>
+ <DownloadIcon class="size-4" />
+ {m.images_export()}
+ </DropdownMenu.Item>
+ {/if}
+
+ {#if canPullImage}
+ <DropdownMenu.Item
+ onclick={() => handleInlineImagePull(item.id, item.repoTags?.[0] || '')}
+ disabled={isPullingInline[item.id] || !item.repoTags?.[0]}
+ >
+ {#if isPullingInline[item.id]}
+ <Spinner class="size-4" />
+ {:else}
+ <DownloadIcon class="size-4" />
{/if}
-
- {#if canPullImage}
- <DropdownMenu.Item
- onclick={() => handleInlineImagePull(item.id, item.repoTags?.[0] || '')}
- disabled={isPullingInline[item.id] || !item.repoTags?.[0]}
- >
- {#if isPullingInline[item.id]}
- <Spinner class="size-4" />
- {:else}
- <DownloadIcon class="size-4" />
- {/if}
- {m.images_pull()}
- </DropdownMenu.Item>
+ {m.images_pull()}
+ </DropdownMenu.Item>
+ {/if}
+
+ {#if canScanImage}
+ <DropdownMenu.Item onclick={() => handleInlineVulnerabilityScan(item.id)} disabled={isScanningInline[item.id]}>
+ {#if isScanningInline[item.id]}
+ <Spinner class="size-4" />
+ {:else}
+ <ScanIcon class="size-4" />
{/if}
+ {m.vuln_scan()}
+ </DropdownMenu.Item>
+ {/if}
- {#if canScanImage}
- <DropdownMenu.Item onclick={() => handleInlineVulnerabilityScan(item.id)} disabled={isScanningInline[item.id]}>
- {#if isScanningInline[item.id]}
- <Spinner class="size-4" />
- {:else}
- <ScanIcon class="size-4" />
- {/if}
- {m.vuln_scan()}
- </DropdownMenu.Item>
- {/if}
+ {#if canDeleteImage}
+ <DropdownMenu.Separator />
- {#if canDeleteImage}
- <DropdownMenu.Separator />
-
- <DropdownMenu.Item variant="destructive" onclick={() => deleteImage(item.id)} disabled={isLoading.removing}>
- {#if isLoading.removing}
- <Spinner class="size-4" />
- {:else}
- <TrashIcon class="size-4" />
- {/if}
- {m.common_remove()}
- </DropdownMenu.Item>
+ <DropdownMenu.Item variant="destructive" onclick={() => deleteImage(item.id)} disabled={isLoading.removing}>
+ {#if isLoading.removing}
+ <Spinner class="size-4" />
+ {:else}
+ <TrashIcon class="size-4" />
{/if}
- </DropdownMenu.Group>
- </DropdownMenu.Content>
- </DropdownMenu.Root>
+ {m.common_remove()}
+ </DropdownMenu.Item>
+ {/if}
+ </RowActionsMenu>
{/snippet}
<ArcaneTable
diff --git a/frontend/src/routes/(app)/images/vulnerabilities/security-vulnerability-table.svelte b/frontend/src/routes/(app)/images/vulnerabilities/security-vulnerability-table.svelte
index 11fac80b8..8cde12a0f 100644
--- a/frontend/src/routes/(app)/images/vulnerabilities/security-vulnerability-table.svelte
+++ b/frontend/src/routes/(app)/images/vulnerabilities/security-vulnerability-table.svelte
@@ -1,7 +1,10 @@
<script lang="ts">
import ArcaneTable from '$lib/components/arcane-table/arcane-table.svelte';
import UniversalMobileCard from '$lib/components/arcane-table/cards/universal-mobile-card.svelte';
- import StatusBadge from '$lib/components/badges/status-badge.svelte';
+ import CveCell from '$lib/components/vulnerability/cve-cell.svelte';
+ import MonoCell from '$lib/components/vulnerability/mono-cell.svelte';
+ import FixedCell from '$lib/components/vulnerability/fixed-cell.svelte';
+ import SeverityBadge from '$lib/components/vulnerability/severity-badge.svelte';
import { vulnerabilityService } from '$lib/services/vulnerability-service';
import { m } from '$lib/paraglide/messages';
import type { ColumnSpec } from '$lib/components/arcane-table/arcane-table.types.svelte';
@@ -99,11 +102,11 @@
}
const columns = $derived([
- { accessorKey: 'vulnerabilityId', title: 'CVE', cell: CveCell },
+ { accessorKey: 'vulnerabilityId', title: 'CVE', cell: CveCol },
{ accessorKey: 'pkgName', title: m.vuln_package(), cell: PackageCell },
{ id: 'vulnSeverity', accessorKey: 'severity', title: m.events_col_severity(), sortable: true, cell: SeverityCell },
{ accessorKey: 'installedVersion', title: m.vuln_installed_version(), cell: InstalledCell },
- { accessorKey: 'fixedVersion', title: m.vuln_fixed_version(), cell: FixedCell },
+ { accessorKey: 'fixedVersion', title: m.vuln_fixed_version(), cell: FixedCol },
{ accessorKey: 'imageName', title: m.common_image(), sortable: true, cell: ImageCell }
] satisfies ColumnSpec<VulnerabilityRow>[]);
@@ -121,41 +124,24 @@
];
</script>
-{#snippet CveCell({ item }: { item: VulnerabilityRow })}
- <a
- href="https://nvd.nist.gov/vuln/detail/{item.vulnerabilityId}"
- target="_blank"
- rel="noopener noreferrer"
- class="font-mono text-xs text-blue-600 hover:underline dark:text-blue-400"
- >
- {item.vulnerabilityId}
- </a>
+{#snippet CveCol({ item }: { item: VulnerabilityRow })}
+ <CveCell vulnerabilityId={item.vulnerabilityId} />
{/snippet}
{#snippet PackageCell({ item }: { item: VulnerabilityRow })}
- <span class="font-mono text-xs">{item.pkgName}</span>
+ <MonoCell value={item.pkgName} />
{/snippet}
{#snippet SeverityCell({ item }: { item: VulnerabilityRow })}
- {#if item.severity === 'CRITICAL'}
- <StatusBadge text={m.vuln_severity_critical()} variant="red" size="sm" />
- {:else if item.severity === 'HIGH'}
- <StatusBadge text={m.vuln_severity_high()} variant="orange" size="sm" />
- {:else if item.severity === 'MEDIUM'}
- <StatusBadge text={m.vuln_severity_medium()} variant="amber" size="sm" />
- {:else if item.severity === 'LOW'}
- <StatusBadge text={m.vuln_severity_low()} variant="lime" size="sm" />
- {:else}
- <StatusBadge text={m.vuln_severity_unknown()} variant="gray" size="sm" />
- {/if}
+ <SeverityBadge severity={item.severity} />
{/snippet}
{#snippet InstalledCell({ item }: { item: VulnerabilityRow })}
- <span class="font-mono text-xs">{item.installedVersion}</span>
+ <MonoCell value={item.installedVersion} />
{/snippet}
-{#snippet FixedCell({ item }: { item: VulnerabilityRow })}
- <span class="font-mono text-xs">{item.fixedVersion || m.vuln_no_fix()}</span>
+{#snippet FixedCol({ item }: { item: VulnerabilityRow })}
+ <FixedCell fixedVersion={item.fixedVersion} />
{/snippet}
{#snippet ImageCell({ item }: { item: VulnerabilityRow })}
diff --git a/frontend/src/routes/(app)/networks/+page.svelte b/frontend/src/routes/(app)/networks/+page.svelte
index 4189199bc..98e33abe9 100644
--- a/frontend/src/routes/(app)/networks/+page.svelte
+++ b/frontend/src/routes/(app)/networks/+page.svelte
@@ -8,7 +8,7 @@
import NetworkTable from './network-table.svelte';
import { m } from '$lib/paraglide/messages';
import { networkService } from '$lib/services/network-service';
- import { environmentStore } from '$lib/stores/environment.store.svelte';
+ import { ResourceListPageState } from '$lib/utils/resource-list-page.svelte';
import { queryKeys } from '$lib/query/query-keys';
import { untrack } from 'svelte';
import { ResourcePageLayout, type ActionButton, type StatCardConfig } from '$lib/layouts/index.js';
@@ -17,21 +17,20 @@
let { data } = $props();
- let networks = $state(untrack(() => data.networks));
- let requestOptions = $state(untrack(() => data.networkRequestOptions));
- let selectedIds = $state<string[]>([]);
- let isCreateDialogOpen = $state(false);
- const envId = $derived(environmentStore.selected?.id || '0');
+ const pageState = new ResourceListPageState(
+ untrack(() => data.networks),
+ untrack(() => data.networkRequestOptions)
+ );
const countsFallback: NetworkUsageCounts = { inuse: 0, unused: 0, total: 0 };
const networksQuery = createQuery(() => ({
- queryKey: queryKeys.networks.list(envId, requestOptions),
- queryFn: () => networkService.getNetworksForEnvironment(envId, requestOptions),
+ queryKey: queryKeys.networks.list(pageState.envId, pageState.requestOptions),
+ queryFn: () => networkService.getNetworksForEnvironment(pageState.envId, pageState.requestOptions),
initialData: data.networks
}));
const createNetworkMutation = createMutation(() => ({
- mutationKey: ['networks', 'create', envId],
+ mutationKey: ['networks', 'create', pageState.envId],
mutationFn: ({ name, options }: { name: string; options: NetworkCreateOptions }) =>
networkService.createNetwork(name, options),
onSuccess: async (data, variables) => {
@@ -40,7 +39,7 @@
activityToastOptions(extractActivityId(data))
);
await networksQuery.refetch();
- isCreateDialogOpen = false;
+ pageState.isCreateDialogOpen = false;
},
onError: (_error, variables) => {
toast.error(m.common_create_failed({ resource: `${m.resource_network()} "${variables.name}"` }));
@@ -49,7 +48,7 @@
$effect(() => {
if (networksQuery.data) {
- networks = networksQuery.data;
+ pageState.items = networksQuery.data;
}
});
@@ -62,14 +61,14 @@
}
const isRefreshing = $derived(networksQuery.isFetching && !networksQuery.isPending);
- const networkUsageCounts = $derived(networks.counts ?? countsFallback);
+ const networkUsageCounts = $derived(pageState.items.counts ?? countsFallback);
const actionButtons: ActionButton[] = $derived([
{
id: 'create',
action: 'create',
label: m.common_create_button({ resource: m.resource_network_cap() }),
- onclick: () => (isCreateDialogOpen = true),
+ onclick: () => (pageState.isCreateDialogOpen = true),
loading: createNetworkMutation.isPending,
disabled: createNetworkMutation.isPending
},
@@ -109,17 +108,21 @@
<ResourcePageLayout title={m.networks_title()} subtitle={m.networks_subtitle()} {actionButtons} {statCards}>
{#snippet mainContent()}
<NetworkTable
- bind:networks
- bind:selectedIds
- bind:requestOptions
+ bind:networks={pageState.items}
+ bind:selectedIds={pageState.selectedIds}
+ bind:requestOptions={pageState.requestOptions}
onRefreshData={async (options) => {
- requestOptions = options;
+ pageState.requestOptions = options;
await networksQuery.refetch();
}}
/>
{/snippet}
{#snippet additionalContent()}
- <CreateNetworkSheet bind:open={isCreateDialogOpen} isLoading={createNetworkMutation.isPending} onSubmit={handleCreate} />
+ <CreateNetworkSheet
+ bind:open={pageState.isCreateDialogOpen}
+ isLoading={createNetworkMutation.isPending}
+ onSubmit={handleCreate}
+ />
{/snippet}
</ResourcePageLayout>
diff --git a/frontend/src/routes/(app)/networks/[networkId]/+error.svelte b/frontend/src/routes/(app)/networks/[networkId]/+error.svelte
index 07b158eff..28ec165d2 100644
--- a/frontend/src/routes/(app)/networks/[networkId]/+error.svelte
+++ b/frontend/src/routes/(app)/networks/[networkId]/+error.svelte
@@ -1,36 +1,10 @@
<script lang="ts">
- import { page } from '$app/state';
- import { goto } from '$app/navigation';
- import * as Empty from '$lib/components/ui/empty/index.js';
- import { ArcaneButton } from '$lib/components/arcane-button/index.js';
- import { AlertIcon } from '$lib/icons';
+ import ResourceErrorPage from '$lib/components/resource-error-page.svelte';
import { m } from '$lib/paraglide/messages';
-
- const status = $derived(page.status ?? 500);
- const message = $derived(page.error?.message ?? m.error_generic());
</script>
-<div class="flex h-full flex-1 flex-col items-center justify-center p-8">
- <Empty.Root>
- <Empty.Header>
- <Empty.Media variant="icon">
- <AlertIcon class="text-destructive size-16" aria-hidden="true" />
- </Empty.Media>
- <Empty.Title>
- {status === 404 ? m.error_not_found() : m.error_generic()}
- </Empty.Title>
- <Empty.Description>
- {message}
- </Empty.Description>
- </Empty.Header>
- <Empty.Content>
- <div class="flex flex-col items-center gap-3">
- <ArcaneButton
- action="base"
- customLabel={m.common_back_to({ resource: m.networks_title() })}
- onclick={() => goto('/networks')}
- />
- </div>
- </Empty.Content>
- </Empty.Root>
-</div>
+<ResourceErrorPage
+ fallbackTitle={m.error_generic()}
+ backLabel={m.common_back_to({ resource: m.networks_title() })}
+ backHref="/networks"
+/>
diff --git a/frontend/src/routes/(app)/networks/[networkId]/+page.svelte b/frontend/src/routes/(app)/networks/[networkId]/+page.svelte
index bfba6ece4..bb61d4798 100644
--- a/frontend/src/routes/(app)/networks/[networkId]/+page.svelte
+++ b/frontend/src/routes/(app)/networks/[networkId]/+page.svelte
@@ -28,6 +28,8 @@
import { networkService } from '$lib/services/network-service';
import { ResourceDetailLayout, type DetailAction } from '$lib/layouts';
import { activityToastOptions, extractActivityId } from '$lib/utils/activity-toast';
+ import PropertyItem from '$lib/components/property-item.svelte';
+ import KeyValueGridCard from '$lib/components/key-value-grid-card.svelte';
let { data }: PageProps = $props();
let errorMessage = $state('');
@@ -155,164 +157,81 @@
</Card.Header>
<Card.Content class="p-4">
<div class="grid grid-cols-1 gap-x-4 gap-y-6 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-6">
- <div class="flex items-start gap-3">
- <div class="flex size-10 shrink-0 items-center justify-center rounded-full bg-gray-500/10 p-2">
- <HashIcon class="size-5 text-gray-500" />
- </div>
- <div class="min-w-0 flex-1">
- <p class="text-muted-foreground text-sm font-medium">{m.common_id()}</p>
- <p
- class="mt-1 cursor-pointer font-mono text-xs font-semibold break-all select-all sm:text-sm"
- title={m.common_click_to_select()}
- >
- {network.id}
- </p>
- </div>
- </div>
-
- <div class="flex items-start gap-3">
- <div class="flex size-10 shrink-0 items-center justify-center rounded-full bg-blue-500/10 p-2">
- <NetworksIcon class="size-5 text-blue-500" />
- </div>
- <div class="min-w-0 flex-1">
- <p class="text-muted-foreground text-sm font-medium">{m.common_name()}</p>
- <p
- class="mt-1 cursor-pointer text-sm font-semibold break-all select-all sm:text-base"
- title={m.common_click_to_select()}
- >
- {network.name}
- </p>
- </div>
- </div>
-
- <div class="flex items-start gap-3">
- <div class="flex size-10 shrink-0 items-center justify-center rounded-full bg-orange-500/10 p-2">
- <VolumesIcon class="size-5 text-orange-500" />
- </div>
- <div class="min-w-0 flex-1">
- <p class="text-muted-foreground text-sm font-medium">{m.common_driver()}</p>
- <p class="mt-1 cursor-pointer text-sm font-semibold select-all sm:text-base" title={m.common_click_to_select()}>
- {network.driver}
- </p>
- </div>
- </div>
-
- <div class="flex items-start gap-3">
- <div class="flex size-10 shrink-0 items-center justify-center rounded-full bg-purple-500/10 p-2">
- <GlobeIcon class="size-5 text-purple-500" />
- </div>
- <div class="min-w-0 flex-1">
- <p class="text-muted-foreground text-sm font-medium">{m.common_scope()}</p>
- <p
- class="mt-1 cursor-pointer text-sm font-semibold capitalize select-all sm:text-base"
- title={m.common_click_to_select()}
- >
- {network.scope}
- </p>
- </div>
- </div>
-
- <div class="flex items-start gap-3">
- <div class="flex size-10 shrink-0 items-center justify-center rounded-full bg-green-500/10 p-2">
- <ClockIcon class="size-5 text-green-500" />
- </div>
- <div class="min-w-0 flex-1">
- <p class="text-muted-foreground text-sm font-medium">{m.common_created()}</p>
- <p class="mt-1 cursor-pointer text-sm font-semibold select-all sm:text-base" title={m.common_click_to_select()}>
- {createdDate}
- </p>
- </div>
- </div>
-
- <div class="flex items-start gap-3">
- <div class="flex size-10 shrink-0 items-center justify-center rounded-full bg-yellow-500/10 p-2">
- <LayersIcon class="size-5 text-yellow-500" />
- </div>
- <div class="min-w-0 flex-1">
- <p class="text-muted-foreground text-sm font-medium">{m.attachable()}</p>
- <p class="mt-1 text-base font-semibold">
- <StatusBadge
- variant={network.attachable ? 'green' : 'gray'}
- text={network.attachable ? m.common_yes() : m.common_no()}
- />
- </p>
- </div>
- </div>
-
- <div class="flex items-start gap-3">
- <div class="flex size-10 shrink-0 items-center justify-center rounded-full bg-red-500/10 p-2">
- <SettingsIcon class="size-5 text-red-500" />
- </div>
- <div class="min-w-0 flex-1">
- <p class="text-muted-foreground text-sm font-medium">{m.internal()}</p>
- <p class="mt-1 text-base font-semibold">
- <StatusBadge
- variant={network.internal ? 'blue' : 'gray'}
- text={network.internal ? m.common_yes() : m.common_no()}
- />
- </p>
- </div>
- </div>
-
- <div class="flex items-start gap-3">
- <div class="flex size-10 shrink-0 items-center justify-center rounded-full bg-indigo-500/10 p-2">
- <NetworksIcon class="size-5 text-indigo-500" />
- </div>
- <div class="min-w-0 flex-1">
- <p class="text-muted-foreground text-sm font-medium">{m.ipv6_enabled()}</p>
- <p class="mt-1 text-base font-semibold">
- <StatusBadge
- variant={network.enableIPv6 ? 'indigo' : 'gray'}
- text={network.enableIPv6 ? m.common_yes() : m.common_no()}
- />
- </p>
- </div>
- </div>
-
- <div class="flex items-start gap-3">
- <div class="flex size-10 shrink-0 items-center justify-center rounded-full bg-indigo-500/10 p-2">
- <NetworksIcon class="size-5 text-indigo-500" />
- </div>
- <div class="min-w-0 flex-1">
- <p class="text-muted-foreground text-sm font-medium">{m.ipv4_enabled()}</p>
+ <PropertyItem
+ icon={HashIcon}
+ color="gray"
+ label={m.common_id()}
+ value={network.id}
+ valueClass="mt-1 cursor-pointer font-mono text-xs font-semibold break-all select-all sm:text-sm"
+ />
+
+ <PropertyItem
+ icon={NetworksIcon}
+ color="blue"
+ label={m.common_name()}
+ value={network.name}
+ valueClass="mt-1 cursor-pointer text-sm font-semibold break-all select-all sm:text-base"
+ />
+
+ <PropertyItem icon={VolumesIcon} color="orange" label={m.common_driver()} value={network.driver} />
+
+ <PropertyItem
+ icon={GlobeIcon}
+ color="purple"
+ label={m.common_scope()}
+ value={network.scope}
+ valueClass="mt-1 cursor-pointer text-sm font-semibold capitalize select-all sm:text-base"
+ />
+
+ <PropertyItem icon={ClockIcon} color="green" label={m.common_created()} value={createdDate} />
+
+ <PropertyItem icon={LayersIcon} color="yellow" label={m.attachable()}>
+ <p class="mt-1 text-base font-semibold">
+ <StatusBadge
+ variant={network.attachable ? 'green' : 'gray'}
+ text={network.attachable ? m.common_yes() : m.common_no()}
+ />
+ </p>
+ </PropertyItem>
+
+ <PropertyItem icon={SettingsIcon} color="red" label={m.internal()}>
+ <p class="mt-1 text-base font-semibold">
+ <StatusBadge
+ variant={network.internal ? 'blue' : 'gray'}
+ text={network.internal ? m.common_yes() : m.common_no()}
+ />
+ </p>
+ </PropertyItem>
+
+ {#snippet ipToggleTile(label: string, enabled: boolean | undefined)}
+ <PropertyItem icon={NetworksIcon} color="indigo" {label}>
<p class="mt-1 text-base font-semibold">
- <StatusBadge
- variant={network.enableIPv4 ? 'indigo' : 'gray'}
- text={network.enableIPv4 ? m.common_yes() : m.common_no()}
- />
+ <StatusBadge variant={enabled ? 'indigo' : 'gray'} text={enabled ? m.common_yes() : m.common_no()} />
</p>
- </div>
- </div>
-
- <div class="flex items-start gap-3">
- <div class="flex size-10 shrink-0 items-center justify-center rounded-full bg-cyan-500/10 p-2">
- <SettingsIcon class="size-5 text-cyan-500" />
- </div>
- <div class="min-w-0 flex-1">
- <p class="text-muted-foreground text-sm font-medium">{m.ingress()}</p>
- <p class="mt-1 text-base font-semibold">
- <StatusBadge
- variant={network.ingress ? 'cyan' : 'gray'}
- text={network.ingress ? m.common_yes() : m.common_no()}
- />
- </p>
- </div>
- </div>
-
- <div class="flex items-start gap-3">
- <div class="flex size-10 shrink-0 items-center justify-center rounded-full bg-pink-500/10 p-2">
- <SettingsIcon class="size-5 text-pink-500" />
- </div>
- <div class="min-w-0 flex-1">
- <p class="text-muted-foreground text-sm font-medium">{m.config_only()}</p>
- <p class="mt-1 text-base font-semibold">
- <StatusBadge
- variant={network.configOnly ? 'pink' : 'gray'}
- text={network.configOnly ? m.common_yes() : m.common_no()}
- />
- </p>
- </div>
- </div>
+ </PropertyItem>
+ {/snippet}
+
+ {@render ipToggleTile(m.ipv6_enabled(), network.enableIPv6)}
+
+ {@render ipToggleTile(m.ipv4_enabled(), network.enableIPv4)}
+
+ <PropertyItem icon={SettingsIcon} color="cyan" label={m.ingress()}>
+ <p class="mt-1 text-base font-semibold">
+ <StatusBadge
+ variant={network.ingress ? 'cyan' : 'gray'}
+ text={network.ingress ? m.common_yes() : m.common_no()}
+ />
+ </p>
+ </PropertyItem>
+
+ <PropertyItem icon={SettingsIcon} color="pink" label={m.config_only()}>
+ <p class="mt-1 text-base font-semibold">
+ <StatusBadge
+ variant={network.configOnly ? 'pink' : 'gray'}
+ text={network.configOnly ? m.common_yes() : m.common_no()}
+ />
+ </p>
+ </PropertyItem>
</div>
</Card.Content>
</Card.Root>
@@ -583,59 +502,21 @@
{/if}
{#if network.labels && Object.keys(network.labels).length > 0}
- <Card.Root>
- <Card.Header icon={TagIcon}>
- <div class="flex flex-col space-y-1.5">
- <Card.Title>{m.common_labels()}</Card.Title>
- <Card.Description>{m.networks_labels_description()}</Card.Description>
- </div>
- </Card.Header>
- <Card.Content class="p-4">
- <div class="grid grid-cols-1 gap-3 lg:grid-cols-2 2xl:grid-cols-3">
- {#each Object.entries(network.labels) as [key, value] (key)}
- <Card.Root variant="subtle">
- <Card.Content class="flex flex-col gap-2 p-4">
- <div class="text-muted-foreground text-xs font-semibold tracking-wide break-all uppercase">{key}</div>
- <div
- class="text-foreground cursor-pointer font-mono text-sm font-medium break-all select-all"
- title={m.common_click_to_select()}
- >
- {value}
- </div>
- </Card.Content>
- </Card.Root>
- {/each}
- </div>
- </Card.Content>
- </Card.Root>
+ <KeyValueGridCard
+ icon={TagIcon}
+ title={m.common_labels()}
+ description={m.networks_labels_description()}
+ entries={Object.entries(network.labels)}
+ />
{/if}
{#if network.options && Object.keys(network.options).length > 0}
- <Card.Root>
- <Card.Header icon={SettingsIcon}>
- <div class="flex flex-col space-y-1.5">
- <Card.Title>{m.networks_options_title()}</Card.Title>
- <Card.Description>{m.networks_options_description()}</Card.Description>
- </div>
- </Card.Header>
- <Card.Content class="p-4">
- <div class="grid grid-cols-1 gap-3 lg:grid-cols-2 2xl:grid-cols-3">
- {#each Object.entries(network.options) as [key, value] (key)}
- <Card.Root variant="subtle">
- <Card.Content class="flex flex-col gap-2 p-4">
- <div class="text-muted-foreground text-xs font-semibold tracking-wide break-all uppercase">{key}</div>
- <div
- class="text-foreground cursor-pointer font-mono text-sm font-medium break-all select-all"
- title={m.common_click_to_select()}
- >
- {value}
- </div>
- </Card.Content>
- </Card.Root>
- {/each}
- </div>
- </Card.Content>
- </Card.Root>
+ <KeyValueGridCard
+ icon={SettingsIcon}
+ title={m.networks_options_title()}
+ description={m.networks_options_description()}
+ entries={Object.entries(network.options)}
+ />
{/if}
</div>
{:else}
diff --git a/frontend/src/routes/(app)/networks/network-table.svelte b/frontend/src/routes/(app)/networks/network-table.svelte
index 277d3e21d..814bcf0b1 100644
--- a/frontend/src/routes/(app)/networks/network-table.svelte
+++ b/frontend/src/routes/(app)/networks/network-table.svelte
@@ -1,8 +1,8 @@
<script lang="ts">
import type { NetworkSummaryDto, NetworkUsageCounts } from '$lib/types/docker';
import ArcaneTable from '$lib/components/arcane-table/arcane-table.svelte';
- import { ArcaneButton } from '$lib/components/arcane-button/index.js';
import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
+ import RowActionsMenu from '$lib/components/arcane-table/row-actions-menu.svelte';
import { goto } from '$app/navigation';
import { toast } from 'svelte-sonner';
import { openConfirmDialog } from '$lib/components/confirm-dialog';
@@ -10,13 +10,14 @@
import { handleApiResultWithCallbacks } from '$lib/utils/api';
import { tryCatch } from '$lib/utils/api';
import { DEFAULT_NETWORK_NAMES } from '$lib/constants';
+ import InUseStatus from '$lib/components/arcane-table/cells/in-use-status.svelte';
import type { SearchPaginationSortRequest, Paginated } from '$lib/types/shared';
import { capitalizeFirstLetter } from '$lib/utils/formatting';
import type { ColumnSpec, BulkAction } from '$lib/components/arcane-table';
import { UniversalMobileCard } from '$lib/components/arcane-table';
import { m } from '$lib/paraglide/messages';
import { networkService } from '$lib/services/network-service';
- import { NetworksIcon, GlobeIcon, InspectIcon, TrashIcon, EllipsisIcon } from '$lib/icons';
+ import { NetworksIcon, GlobeIcon, InspectIcon, TrashIcon } from '$lib/icons';
import { activityToastOptions, extractActivityId } from '$lib/utils/activity-toast';
import { bulkConfirmAndRun } from '$lib/utils/bulk-actions';
@@ -185,10 +186,8 @@
{#snippet StatusCell({ item }: { item: NetworkSummaryDto })}
{#if item.isDefault}
<StatusBadge text={m.networks_predefined()} variant="sky" />
- {:else if item.inUse}
- <StatusBadge text={m.common_in_use()} variant="green" />
{:else}
- <StatusBadge text={m.common_unused()} variant="amber" />
+ <InUseStatus inUse={item.inUse} />
{/if}
{/snippet}
@@ -243,35 +242,23 @@
{/snippet}
{#snippet RowActions({ item }: { item: NetworkSummaryDto })}
- <DropdownMenu.Root>
- <DropdownMenu.Trigger>
- {#snippet child({ props })}
- <ArcaneButton {...props} action="base" tone="ghost" size="icon" class="size-8">
- <span class="sr-only">{m.common_open_menu()}</span>
- <EllipsisIcon class="size-4" />
- </ArcaneButton>
- {/snippet}
- </DropdownMenu.Trigger>
- <DropdownMenu.Content align="end">
- <DropdownMenu.Group>
- <DropdownMenu.Item onclick={() => goto(`/networks/${item.id}`)} disabled={isAnyLoading}>
- <InspectIcon class="size-4" />
- {m.common_inspect()}
- </DropdownMenu.Item>
+ <RowActionsMenu>
+ <DropdownMenu.Item onclick={() => goto(`/networks/${item.id}`)} disabled={isAnyLoading}>
+ <InspectIcon class="size-4" />
+ {m.common_inspect()}
+ </DropdownMenu.Item>
- <DropdownMenu.Separator />
+ <DropdownMenu.Separator />
- <DropdownMenu.Item
- variant="destructive"
- onclick={() => handleDeleteNetwork(item.id, item.name)}
- disabled={isAnyLoading || item.isDefault || DEFAULT_NETWORK_NAMES.has(item.name)}
- >
- <TrashIcon class="size-4" />
- {m.common_delete()}
- </DropdownMenu.Item>
- </DropdownMenu.Group>
- </DropdownMenu.Content>
- </DropdownMenu.Root>
+ <DropdownMenu.Item
+ variant="destructive"
+ onclick={() => handleDeleteNetwork(item.id, item.name)}
+ disabled={isAnyLoading || item.isDefault || DEFAULT_NETWORK_NAMES.has(item.name)}
+ >
+ <TrashIcon class="size-4" />
+ {m.common_delete()}
+ </DropdownMenu.Item>
+ </RowActionsMenu>
{/snippet}
<ArcaneTable
diff --git a/frontend/src/routes/(app)/projects/[projectId]/+error.svelte b/frontend/src/routes/(app)/projects/[projectId]/+error.svelte
index e24b3a50f..03e1bb8ea 100644
--- a/frontend/src/routes/(app)/projects/[projectId]/+error.svelte
+++ b/frontend/src/routes/(app)/projects/[projectId]/+error.svelte
@@ -1,32 +1,5 @@
<script lang="ts">
- import { page } from '$app/state';
- import { goto } from '$app/navigation';
- import * as Empty from '$lib/components/ui/empty/index.js';
- import { ArcaneButton } from '$lib/components/arcane-button/index.js';
- import { AlertIcon } from '$lib/icons';
- import { m } from '$lib/paraglide/messages';
-
- const status = $derived(page.status ?? 500);
- const message = $derived(page.error?.message ?? m.error_generic());
+ import ResourceErrorPage from '$lib/components/resource-error-page.svelte';
</script>
-<div class="flex h-full flex-1 flex-col items-center justify-center p-8">
- <Empty.Root>
- <Empty.Header>
- <Empty.Media variant="icon">
- <AlertIcon class="text-destructive size-16" aria-hidden="true" />
- </Empty.Media>
- <Empty.Title>
- {status === 404 ? m.error_not_found() : 'Failed to load project'}
- </Empty.Title>
- <Empty.Description>
- {message}
- </Empty.Description>
- </Empty.Header>
- <Empty.Content>
- <div class="flex flex-col items-center gap-3">
- <ArcaneButton action="base" customLabel="Back to Projects" onclick={() => goto('/projects')} />
- </div>
- </Empty.Content>
- </Empty.Root>
-</div>
+<ResourceErrorPage fallbackTitle="Failed to load project" backLabel="Back to Projects" backHref="/projects" />
diff --git a/frontend/src/routes/(app)/projects/[projectId]/+page.svelte b/frontend/src/routes/(app)/projects/[projectId]/+page.svelte
index 2fe21f7d2..ba528ed41 100644
--- a/frontend/src/routes/(app)/projects/[projectId]/+page.svelte
+++ b/frontend/src/routes/(app)/projects/[projectId]/+page.svelte
@@ -6,11 +6,9 @@
import { ArcaneButton } from '$lib/components/arcane-button/index.js';
import {
ArrowLeftIcon,
- ArrowsUpDownIcon,
BoxIcon,
ProjectsIcon,
LayersIcon,
- SearchIcon,
SettingsIcon,
FileTextIcon,
AlertIcon,
@@ -34,6 +32,7 @@
import { toGitCommitUrl } from '$lib/utils/navigation';
import { toSafeHref } from '$lib/utils/navigation';
import { PersistedState } from 'runed';
+ import ComposeFileEditorPanel from '$lib/components/compose-file-editor-panel.svelte';
import EditableName from '../components/EditableName.svelte';
import ProjectFileTreePanel from '../components/ProjectFileTreePanel.svelte';
import EditorTabStrip from '../components/EditorTabStrip.svelte';
@@ -69,7 +68,7 @@
remapSelectedProjectFileKey,
removeProjectFileRecord
} from '../components/project-file-tree-utils';
- import { extractComposeYamlName } from '$lib/utils/compose-flow';
+ import { composeTreeSplitProps, extractComposeYamlName } from '$lib/utils/compose-flow';
let { data } = $props();
let projectId = $derived(data.projectId);
@@ -250,9 +249,6 @@
let selectedIncludeTabPreference = $state<string | null>(null);
let treePaneWidth = $state(420);
let composeSplitWidth = $state<number | null>(null);
- const minTreePaneWidth = 200;
- const maxTreePaneWidth = 480;
- const minEditorPaneWidth = 360;
const minComposePaneWidth = 360;
const minEnvPaneWidth = 280;
@@ -288,6 +284,7 @@
const valid = openTabsPreference.filter((key) => {
if (key === 'compose' || key === 'env') return true;
if (!key.startsWith('file:')) return false;
+ // fallow-ignore-next-line code-duplication managed-file predicate; script-level, diverges per page
const entry = managedProjectFiles.find((file) => file.relativePath === key.slice(5));
return !!entry && !entry.isDirectory;
});
@@ -1106,9 +1103,51 @@
return '/projects';
});
+
+ function composePanelProps() {
+ return {
+ title: composeFileName,
+ language: 'yaml',
+ validationMode: 'compose',
+ error: $inputs.composeContent.error ?? undefined,
+ readOnly: !canEditCompose,
+ fileId: `project:${projectId}:compose`,
+ originalValue: serverComposeContent,
+ enableDiff: true,
+ editorContext: codeEditorContext
+ } as const;
+ }
+
+ function envPanelProps() {
+ return {
+ title: '.env',
+ language: 'env',
+ validationMode: 'env',
+ error: $inputs.envContent.error ?? undefined,
+ readOnly: !canEditEnv,
+ fileId: `project:${projectId}:env`,
+ originalValue: serverEnvContent,
+ enableDiff: true,
+ editorContext: codeEditorContext
+ } as const;
+ }
</script>
{#if project}
+ {#snippet archiveButton(compact: boolean)}
+ <ArcaneButton
+ action="base"
+ icon={BoxIcon}
+ size={compact ? 'icon' : undefined}
+ showLabel={!compact}
+ loading={isLoading.archiving}
+ onclick={handleArchiveToggle}
+ disabled={archiveRequiresStopped}
+ title={archiveRequiresStopped ? m.projects_archive_requires_stopped() : undefined}
+ customLabel={project?.isArchived ? m.projects_unarchive() : m.projects_archive()}
+ class={compact ? 'xl:hidden' : 'hidden xl:inline-flex'}
+ />
+ {/snippet}
<TabbedPageLayout
{backUrl}
backLabel={m.common_back()}
@@ -1230,28 +1269,8 @@
/>
{/if}
<IfPermitted perm="projects:archive">
- <ArcaneButton
- action="base"
- icon={BoxIcon}
- loading={isLoading.archiving}
- onclick={handleArchiveToggle}
- disabled={archiveRequiresStopped}
- title={archiveRequiresStopped ? m.projects_archive_requires_stopped() : undefined}
- customLabel={project.isArchived ? m.projects_unarchive() : m.projects_archive()}
- class="hidden xl:inline-flex"
- />
- <ArcaneButton
- action="base"
- icon={BoxIcon}
- size="icon"
- showLabel={false}
- loading={isLoading.archiving}
- onclick={handleArchiveToggle}
- disabled={archiveRequiresStopped}
- title={archiveRequiresStopped ? m.projects_archive_requires_stopped() : undefined}
- customLabel={project.isArchived ? m.projects_unarchive() : m.projects_archive()}
- class="xl:hidden"
- />
+ {@render archiveButton(false)}
+ {@render archiveButton(true)}
</IfPermitted>
<ActionButtons
id={project.id}
@@ -1371,15 +1390,8 @@
<div class="bg-card border-border flex h-full min-h-0 flex-col overflow-hidden rounded-lg border">
<ResizableSplit
class="h-full min-h-0 flex-1"
- variant="flush"
- firstClass="bg-muted/20 border-border flex min-h-0 flex-col border-b lg:border-r lg:border-b-0"
- secondClass="flex min-h-0 flex-col"
+ {...composeTreeSplitProps}
bind:size={treePaneWidth}
- minSize={minTreePaneWidth}
- maxSize={maxTreePaneWidth}
- minSecondSize={minEditorPaneWidth}
- defaultRatio={0.22}
- stackBelow={1024}
ariaLabel={m.compose_editor_resize_files_panel()}
persistKey={`arcane.compose.split:${project.id}:tree`}
onResizeEnd={persistPrefs}
@@ -1402,37 +1414,18 @@
{#snippet second()}
<div class="flex h-full min-h-0 flex-1 flex-col">
+ <!-- fallow-ignore-next-line code-duplication compose editor tree panel; per-page bindings/persistKey/file-rendering diverge -->
<EditorTabStrip tabs={treeTabs} activeKey={activeTreeTab} onSelect={openFileTab} onClose={closeFileTab}>
{#snippet actions()}
- <ArcaneButton
- action="base"
- tone={treeOutlineOpen ? 'outline-primary' : 'ghost'}
- size="icon"
- class="size-6"
- showLabel={false}
- icon={FileTextIcon}
- customLabel={m.compose_editor_toggle_outline()}
- onclick={() => (treeOutlineOpen = !treeOutlineOpen)}
- />
- <ArcaneButton
- action="base"
- tone={treeDiffOpen ? 'outline-primary' : 'ghost'}
- size="icon"
- class="size-6"
- showLabel={false}
- icon={ArrowsUpDownIcon}
- customLabel={m.compose_editor_toggle_diff()}
- onclick={() => (treeDiffOpen = !treeDiffOpen)}
- />
- <ArcaneButton
- action="base"
- tone="ghost"
- size="icon"
- class="size-6"
- showLabel={false}
- icon={SearchIcon}
- customLabel={m.compose_editor_command_palette()}
- onclick={() => (treeCommandPaletteOpen = true)}
+ <ComposeFileEditorPanel
+ outlineOpen={treeOutlineOpen}
+ outlineLabel={m.compose_editor_toggle_outline()}
+ onToggleOutline={() => (treeOutlineOpen = !treeOutlineOpen)}
+ diffOpen={treeDiffOpen}
+ diffLabel={m.compose_editor_toggle_diff()}
+ onToggleDiff={() => (treeDiffOpen = !treeDiffOpen)}
+ commandPaletteLabel={m.compose_editor_command_palette()}
+ onOpenCommandPalette={() => (treeCommandPaletteOpen = true)}
/>
{/snippet}
</EditorTabStrip>
@@ -1441,19 +1434,11 @@
{#if activeTreeTab === 'compose'}
<CodePanel
variant="plain"
+ {...composePanelProps()}
bind:open={composeOpen}
- title={composeFileName}
- language="yaml"
- validationMode="compose"
bind:value={$inputs.composeContent.value}
- error={$inputs.composeContent.error ?? undefined}
- readOnly={!canEditCompose}
bind:hasErrors={composeHasErrors}
bind:validationReady={composeValidationReady}
- fileId={`project:${projectId}:compose`}
- originalValue={serverComposeContent}
- enableDiff={true}
- editorContext={codeEditorContext}
bind:outlineOpen={treeOutlineOpen}
bind:diffOpen={treeDiffOpen}
bind:commandPaletteOpen={treeCommandPaletteOpen}
@@ -1461,19 +1446,11 @@
{:else if activeTreeTab === 'env'}
<CodePanel
variant="plain"
+ {...envPanelProps()}
bind:open={envOpen}
- title=".env"
- language="env"
- validationMode="env"
bind:value={$inputs.envContent.value}
- error={$inputs.envContent.error ?? undefined}
- readOnly={!canEditEnv}
bind:hasErrors={envHasErrors}
bind:validationReady={envValidationReady}
- fileId={`project:${projectId}:env`}
- originalValue={serverEnvContent}
- enableDiff={true}
- editorContext={codeEditorContext}
bind:outlineOpen={treeOutlineOpen}
bind:diffOpen={treeDiffOpen}
bind:commandPaletteOpen={treeCommandPaletteOpen}
@@ -1603,19 +1580,11 @@
{#snippet first()}
<div class="flex min-h-0 flex-1 flex-col">
<CodePanel
+ {...composePanelProps()}
bind:open={composeOpen}
- title={composeFileName}
- language="yaml"
- validationMode="compose"
bind:value={$inputs.composeContent.value}
- error={$inputs.composeContent.error ?? undefined}
- readOnly={!canEditCompose}
bind:hasErrors={composeHasErrors}
bind:validationReady={composeValidationReady}
- fileId={`project:${projectId}:compose`}
- originalValue={serverComposeContent}
- enableDiff={true}
- editorContext={codeEditorContext}
/>
</div>
{/snippet}
@@ -1623,19 +1592,11 @@
{#snippet second()}
<div class="flex min-h-0 flex-1 flex-col">
<CodePanel
+ {...envPanelProps()}
bind:open={envOpen}
- title=".env"
- language="env"
- validationMode="env"
bind:value={$inputs.envContent.value}
- error={$inputs.envContent.error ?? undefined}
- readOnly={!canEditEnv}
bind:hasErrors={envHasErrors}
bind:validationReady={envValidationReady}
- fileId={`project:${projectId}:env`}
- originalValue={serverEnvContent}
- enableDiff={true}
- editorContext={codeEditorContext}
/>
</div>
{/snippet}
diff --git a/frontend/src/routes/(app)/projects/components/EditableName.svelte b/frontend/src/routes/(app)/projects/components/EditableName.svelte
index aa9078b69..a6813f8cc 100644
--- a/frontend/src/routes/(app)/projects/components/EditableName.svelte
+++ b/frontend/src/routes/(app)/projects/components/EditableName.svelte
@@ -37,6 +37,13 @@
let isEditing = $state(false);
let wrapperClass = $derived(cn('group', variant === 'block' ? 'w-full' : 'min-w-0', className));
+ let inputClass = $derived(
+ cn(
+ 'h-8 px-2 font-semibold',
+ variant === 'block' ? 'max-w-[280px] min-w-[120px] text-left text-base' : 'max-w-[360px] text-lg',
+ error && 'border-destructive'
+ )
+ );
async function beginEdit() {
if (!canEdit) return;
@@ -48,57 +55,30 @@
<div class={wrapperClass}>
{#if isEditing}
- {#if variant === 'block'}
- <Input
- bind:ref
- bind:value
- {placeholder}
- class="h-8 max-w-[280px] min-w-[120px] px-2 text-left text-base font-semibold {error ? 'border-destructive' : ''}"
- autofocus
- onkeydown={(e) => {
- if (e.key === 'Enter') {
- e.preventDefault();
- onCommit?.();
- isEditing = false;
- }
- if (e.key === 'Escape') {
- value = originalValue;
- isEditing = false;
- }
- }}
- onblur={() => {
- if (!isEditing) return;
+ <Input
+ bind:ref
+ bind:value
+ {placeholder}
+ class={inputClass}
+ autofocus
+ onkeydown={(e) => {
+ if (e.key === 'Enter') {
+ e.preventDefault();
onCommit?.();
isEditing = false;
- }}
- disabled={!canEdit}
- />
- {:else}
- <Input
- bind:ref
- bind:value
- {placeholder}
- class="h-8 max-w-[360px] px-2 text-lg font-semibold {error ? 'border-destructive' : ''}"
- autofocus
- onkeydown={(e) => {
- if (e.key === 'Enter') {
- e.preventDefault();
- onCommit?.();
- isEditing = false;
- }
- if (e.key === 'Escape') {
- value = originalValue;
- isEditing = false;
- }
- }}
- onblur={() => {
- if (!isEditing) return;
- onCommit?.();
+ }
+ if (e.key === 'Escape') {
+ value = originalValue;
isEditing = false;
- }}
- disabled={!canEdit}
- />
- {/if}
+ }
+ }}
+ onblur={() => {
+ if (!isEditing) return;
+ onCommit?.();
+ isEditing = false;
+ }}
+ disabled={!canEdit}
+ />
{:else if variant === 'block'}
<h1 class="m-0 w-full">
<button
diff --git a/frontend/src/routes/(app)/projects/components/ProjectContainersTable.svelte b/frontend/src/routes/(app)/projects/components/ProjectContainersTable.svelte
index ee11b2e2b..156e84176 100644
--- a/frontend/src/routes/(app)/projects/components/ProjectContainersTable.svelte
+++ b/frontend/src/routes/(app)/projects/components/ProjectContainersTable.svelte
@@ -3,6 +3,8 @@
import { ArcaneButton } from '$lib/components/arcane-button/index.js';
import { Spinner } from '$lib/components/ui/spinner/index.js';
import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
+ import RowActionsMenu from '$lib/components/arcane-table/row-actions-menu.svelte';
+ import ContainerActionMenuItem from '$lib/components/arcane-table/cells/container-action-menu-item.svelte';
import * as Empty from '$lib/components/ui/empty/index.js';
import StatusBadge from '$lib/components/badges/status-badge.svelte';
import { PortBadge } from '$lib/components/badges/index.js';
@@ -370,53 +372,42 @@
/>
{/snippet}
+{#snippet NotCreatedTooltip()}
+ <ArcaneTooltip.Root>
+ <ArcaneTooltip.Trigger>
+ <ArcaneButton action="base" tone="ghost" size="icon" class="size-8" disabled>
+ <EllipsisIcon class="size-4" />
+ </ArcaneButton>
+ </ArcaneTooltip.Trigger>
+ <ArcaneTooltip.Content>
+ <p>{m.compose_service_not_created()}</p>
+ </ArcaneTooltip.Content>
+ </ArcaneTooltip.Root>
+{/snippet}
+
{#snippet MobileRowActions({ item }: { item: ServiceWithId })}
{#if item.status === 'running'}
{#if !item.containerId}
- <ArcaneTooltip.Root>
- <ArcaneTooltip.Trigger>
- <ArcaneButton action="base" tone="ghost" size="icon" class="size-8" disabled>
- <EllipsisIcon class="size-4" />
- </ArcaneButton>
- </ArcaneTooltip.Trigger>
- <ArcaneTooltip.Content>
- <p>{m.compose_service_not_created()}</p>
- </ArcaneTooltip.Content>
- </ArcaneTooltip.Root>
+ {@render NotCreatedTooltip()}
{:else}
- <DropdownMenu.Root>
- <DropdownMenu.Trigger>
- {#snippet child({ props })}
- <ArcaneButton {...props} action="base" tone="ghost" size="icon" class="relative size-8 p-0">
- <span class="sr-only">{m.common_open_menu()}</span>
- <EllipsisIcon />
- </ArcaneButton>
- {/snippet}
- </DropdownMenu.Trigger>
- <DropdownMenu.Content align="end">
- <DropdownMenu.Group>
- <DropdownMenu.Item onclick={() => goto(getContainerUrl(item))} disabled={isAnyLoading}>
- <InspectIcon class="size-4" />
- {m.common_inspect()}
- </DropdownMenu.Item>
- {#if canDeleteContainer}
- <DropdownMenu.Separator />
- <DropdownMenu.Item
- variant="destructive"
- onclick={() => handleRemoveContainer(item.containerId!, item.containerName || item.name)}
- disabled={actionStatus[item.id] === 'removing' || isAnyLoading}
- >
- {#if actionStatus[item.id] === 'removing'}
- <Spinner class="size-4" />
- {:else}
- <TrashIcon class="size-4" />
- {/if}
- {m.common_remove()}
- </DropdownMenu.Item>
- {/if}
- </DropdownMenu.Group>
- </DropdownMenu.Content>
- </DropdownMenu.Root>
+ <RowActionsMenu triggerClass="relative size-8 p-0" iconClass="">
+ <DropdownMenu.Item onclick={() => goto(getContainerUrl(item))} disabled={isAnyLoading}>
+ <InspectIcon class="size-4" />
+ {m.common_inspect()}
+ </DropdownMenu.Item>
+ <!-- fallow-ignore-next-line code-duplication mobile vs desktop row-action menus; items already share ContainerActionMenuItem/RemoveMenuItem, the menu shells differ -->
+ {#if canDeleteContainer}
+ <DropdownMenu.Separator />
+ <ContainerActionMenuItem
+ icon={TrashIcon}
+ label={m.common_remove()}
+ onclick={() => handleRemoveContainer(item.containerId!, item.containerName || item.name)}
+ loading={actionStatus[item.id] === 'removing'}
+ disabled={actionStatus[item.id] === 'removing' || isAnyLoading}
+ destructive
+ />
+ {/if}
+ </RowActionsMenu>
{/if}
{/if}
{/snippet}
@@ -426,16 +417,7 @@
{#if item.status === 'running'}
{#if !item.containerId}
- <ArcaneTooltip.Root>
- <ArcaneTooltip.Trigger>
- <ArcaneButton action="base" tone="ghost" size="icon" class="size-8" disabled>
- <EllipsisIcon class="size-4" />
- </ArcaneButton>
- </ArcaneTooltip.Trigger>
- <ArcaneTooltip.Content>
- <p>{m.compose_service_not_created()}</p>
- </ArcaneTooltip.Content>
- </ArcaneTooltip.Root>
+ {@render NotCreatedTooltip()}
{:else}
<DropdownMenu.Root>
<DropdownMenu.Trigger>
@@ -460,48 +442,36 @@
<DropdownMenu.Separator />
{#if canStopContainer}
- <DropdownMenu.Item
+ <ContainerActionMenuItem
+ icon={StopIcon}
+ label={m.common_stop()}
onclick={() => performContainerAction('stop', item.containerId!)}
+ loading={status === 'stopping'}
disabled={status === 'stopping' || isAnyLoading}
- >
- {#if status === 'stopping'}
- <Spinner class="size-4" />
- {:else}
- <StopIcon class="size-4" />
- {/if}
- {m.common_stop()}
- </DropdownMenu.Item>
+ />
{/if}
{#if canRestartContainer}
- <DropdownMenu.Item
+ <ContainerActionMenuItem
+ icon={RefreshIcon}
+ label={m.common_restart()}
onclick={() => performContainerAction('restart', item.containerId!)}
+ loading={status === 'restarting'}
disabled={status === 'restarting' || isAnyLoading}
- >
- {#if status === 'restarting'}
- <Spinner class="size-4" />
- {:else}
- <RefreshIcon class="size-4" />
- {/if}
- {m.common_restart()}
- </DropdownMenu.Item>
+ />
{/if}
{#if canDeleteContainer}
<DropdownMenu.Separator />
- <DropdownMenu.Item
- variant="destructive"
+ <ContainerActionMenuItem
+ icon={TrashIcon}
+ label={m.common_remove()}
onclick={() => handleRemoveContainer(item.containerId!, item.containerName || item.name)}
+ loading={status === 'removing'}
disabled={status === 'removing' || isAnyLoading}
- >
- {#if status === 'removing'}
- <Spinner class="size-4" />
- {:else}
- <TrashIcon class="size-4" />
- {/if}
- {m.common_remove()}
- </DropdownMenu.Item>
+ destructive
+ />
{/if}
</DropdownMenu.Group>
</DropdownMenu.Content>
diff --git a/frontend/src/routes/(app)/projects/components/ProjectLogsPanel.svelte b/frontend/src/routes/(app)/projects/components/ProjectLogsPanel.svelte
index 13761dd7a..71cbdf256 100644
--- a/frontend/src/routes/(app)/projects/components/ProjectLogsPanel.svelte
+++ b/frontend/src/routes/(app)/projects/components/ProjectLogsPanel.svelte
@@ -2,6 +2,7 @@
import * as Card from '$lib/components/ui/card';
import LogViewer from '$lib/components/logs/log-viewer.svelte';
import LogControls from '$lib/components/logs/log-controls.svelte';
+ import LogPanelTitle from '$lib/components/logs/log-panel-title.svelte';
import { m } from '$lib/paraglide/messages';
import { TerminalIcon } from '$lib/icons';
@@ -53,17 +54,7 @@
<div class="flex flex-1 flex-col gap-4 sm:flex-row sm:items-start sm:justify-between">
<div class="flex flex-col gap-1.5">
<div class="flex items-start justify-between gap-3 lg:block">
- <div class="flex items-center gap-2">
- <Card.Title>
- <h2>{m.compose_logs_title()}</h2>
- </Card.Title>
- {#if isStreaming}
- <div class="flex items-center gap-2">
- <div class="size-2 animate-pulse rounded-full bg-green-500"></div>
- <span class="text-xs font-semibold text-green-600 sm:text-sm">{m.common_live()}</span>
- </div>
- {/if}
- </div>
+ <LogPanelTitle title={m.compose_logs_title()} live={isStreaming} />
<LogControls
bind:autoScroll
bind:tailLines
diff --git a/frontend/src/routes/(app)/projects/new/+page.svelte b/frontend/src/routes/(app)/projects/new/+page.svelte
index ad6dc9805..8a097ff39 100644
--- a/frontend/src/routes/(app)/projects/new/+page.svelte
+++ b/frontend/src/routes/(app)/projects/new/+page.svelte
@@ -1,33 +1,20 @@
<script lang="ts">
import { ArcaneButton } from '$lib/components/arcane-button/index.js';
- import {
- ArrowLeftIcon,
- ArrowsUpDownIcon,
- TerminalIcon,
- TemplateIcon,
- AddIcon,
- GitBranchIcon,
- FileTextIcon,
- SearchIcon
- } from '$lib/icons';
- import { Spinner } from '$lib/components/ui/spinner/index.js';
+ import { ArrowLeftIcon } from '$lib/icons';
import { goto, invalidateAll } from '$app/navigation';
import { toast } from 'svelte-sonner';
import { preventDefault, createForm } from '$lib/utils/settings';
- import * as ArcaneTooltip from '$lib/components/arcane-tooltip';
import TemplateSelectionDialog from '$lib/components/dialogs/template-selection-dialog.svelte';
import { m } from '$lib/paraglide/messages';
import { projectService } from '$lib/services/project-service.js';
- import * as ButtonGroup from '$lib/components/ui/button-group/index.js';
- import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
- import { ArrowDownIcon as ChevronDown } from '$lib/icons';
+ import ComposeCreateMenu from '$lib/components/compose-create-menu.svelte';
+ import ComposeFileEditorPanel from '$lib/components/compose-file-editor-panel.svelte';
import CodePanel from '../components/CodePanel.svelte';
import EditableName from '../components/EditableName.svelte';
import ProjectFileTreePanel from '../components/ProjectFileTreePanel.svelte';
import EditorTabStrip from '../components/EditorTabStrip.svelte';
import { environmentStore } from '$lib/stores/environment.store.svelte';
import { hasPermission } from '$lib/utils/auth';
- import IfPermitted from '$lib/components/if-permitted.svelte';
import { ComposeEditorSplit } from '$lib/components/compose';
import ResizableSplit from '$lib/components/resizable-split.svelte';
import { Switch } from '$lib/components/ui/switch';
@@ -50,13 +37,11 @@
type ManagedProjectFileEntry
} from '../components/project-file-tree-utils';
import {
+ composeTreeSplitProps,
createComposeEditorSchema,
createComposeTemplateDialogFlow,
- dropdownContentClass,
- dropdownItemClass,
extractComposeYamlName,
submitComposeResourceForm,
- templateBtnClass,
templateNameSlug
} from '$lib/utils/compose-flow';
import {
@@ -96,9 +81,6 @@
let layoutMode = $state<'classic' | 'tree'>('classic');
let selectedProjectFile = $state<'compose' | 'env' | string>('compose');
let treePaneWidth = $state(420);
- const minTreePaneWidth = 200;
- const maxTreePaneWidth = 480;
- const minEditorPaneWidth = 360;
let newProjectFiles = $state<ProjectFileDraft[]>([]);
let newProjectFileContents = $state<Record<string, string>>({});
let newProjectFileHasErrors = $state<Record<string, boolean>>({});
@@ -208,6 +190,7 @@
m.common_create_success({ resource: `${m.resource_project()} "${name}"` }),
activityToastOptions(extractActivityId(project))
);
+ // fallow-ignore-next-line code-duplication create-success handler; navigation target diverges per page
goto(`/projects/${project.id}`, { invalidateAll: true });
}
});
@@ -299,6 +282,28 @@
content: file.isDirectory ? undefined : (newProjectFileContents[file.relativePath] ?? '')
}));
}
+
+ function composePanelProps() {
+ return {
+ title: m.compose_compose_file_title(),
+ language: 'yaml',
+ validationMode: 'compose',
+ error: $inputs.composeContent.error ?? undefined,
+ fileId: 'projects:new:compose',
+ editorContext: codeEditorContext
+ } as const;
+ }
+
+ function envPanelProps() {
+ return {
+ title: m.compose_env_title(),
+ language: 'env',
+ validationMode: 'env',
+ error: $inputs.envContent.error ?? undefined,
+ fileId: 'projects:new:env',
+ editorContext: codeEditorContext
+ } as const;
+ }
</script>
<div class="bg-background flex h-full min-h-0 flex-col">
@@ -332,103 +337,45 @@
</div>
<div class="flex items-center gap-2">
- <ButtonGroup.Root>
- <ArcaneTooltip.Root
- open={!effectiveName && !ui.saving && !ui.converting && !ui.isLoadingTemplateContent ? undefined : false}
- >
- <ArcaneTooltip.Trigger>
- <span>
- {#if !hasEditorErrors && canCreateProject}
- <ArcaneButton
- action="create"
- tone="ghost"
- disabled={!effectiveName ||
- !$inputs.composeContent.value ||
- hasEditorErrors ||
- ui.saving ||
- ui.converting ||
- ui.isLoadingTemplateContent}
- onclick={() => handleSubmit()}
- class={`${templateBtnClass} gap-2 rounded-r-none`}
- loading={ui.saving}
- customLabel={m.compose_create_project()}
- loadingLabel={m.common_action_creating()}
- />
- {/if}
- </span>
- </ArcaneTooltip.Trigger>
- <ArcaneTooltip.Content class="arcane-tooltip-content max-w-[280px]">
- {#if effectiveName === ''}
- <p class="mb-1 text-sm font-medium">{m.compose_project_name_tooltip_title()}</p>
- <p class="text-muted-foreground text-xs">
- {m.compose_project_name_tooltip_description()}
- </p>
- <p class="bg-muted mt-1.5 inline-block rounded px-1.5 py-0.5 font-mono text-xs">
- {m.compose_project_name_tooltip_example()}
- </p>
- {/if}
- </ArcaneTooltip.Content>
- </ArcaneTooltip.Root>
-
- <DropdownMenu.Root>
- <DropdownMenu.Trigger>
- {#snippet child({ props })}
- <ArcaneButton
- {...props}
- action="base"
- tone="ghost"
- class={`${templateBtnClass} -ml-px rounded-l-none px-2`}
- icon={ChevronDown}
- />
- {/snippet}
- </DropdownMenu.Trigger>
- <DropdownMenu.Content align="end" class={dropdownContentClass}>
- <DropdownMenu.Group>
- <DropdownMenu.Item
- class={dropdownItemClass}
- disabled={ui.saving || ui.converting || ui.isLoadingTemplateContent}
- onclick={() => (ui.showTemplateDialog = true)}
- >
- <TemplateIcon class="size-4" />
- {m.common_use_template()}
- </DropdownMenu.Item>
- <DropdownMenu.Item class={dropdownItemClass} onclick={() => (ui.showConverterDialog = true)}>
- <TerminalIcon class="size-4" />
- {m.compose_convert_from_docker_run()}
- </DropdownMenu.Item>
- <DropdownMenu.Item
- class={dropdownItemClass}
- onclick={async () =>
- goto(`/environments/${await environmentStore.getCurrentEnvironmentId()}/gitops?action=create`)}
- >
- <GitBranchIcon class="size-4" />
- {m.git_from_git_repo()}
- </DropdownMenu.Item>
- <IfPermitted perm="templates:create">
- <DropdownMenu.Separator />
- <DropdownMenu.Item
- class={dropdownItemClass}
- disabled={!$inputs.name.value ||
- !$inputs.composeContent.value ||
- hasEditorErrors ||
- ui.saving ||
- ui.converting ||
- ui.creatingTemplate ||
- ui.isLoadingTemplateContent}
- onclick={handleCreateTemplate}
- >
- {#if ui.creatingTemplate}
- <Spinner class="size-4" />
- {:else}
- <AddIcon class="size-4" />
- {/if}
- {m.templates_create_template()}
- </DropdownMenu.Item>
- </IfPermitted>
- </DropdownMenu.Group>
- </DropdownMenu.Content>
- </DropdownMenu.Root>
- </ButtonGroup.Root>
+ <ComposeCreateMenu
+ tooltipOpen={!effectiveName && !ui.saving && !ui.converting && !ui.isLoadingTemplateContent ? undefined : false}
+ tooltipVisible={effectiveName === ''}
+ tooltipTitle={m.compose_project_name_tooltip_title()}
+ tooltipDescription={m.compose_project_name_tooltip_description()}
+ tooltipExample={m.compose_project_name_tooltip_example()}
+ showCreateButton={!hasEditorErrors && canCreateProject}
+ createDisabled={!effectiveName ||
+ !$inputs.composeContent.value ||
+ hasEditorErrors ||
+ ui.saving ||
+ ui.converting ||
+ ui.isLoadingTemplateContent}
+ createLoading={ui.saving}
+ createLabel={m.compose_create_project()}
+ createLoadingLabel={m.common_action_creating()}
+ onCreate={() => handleSubmit()}
+ itemsDisabled={ui.saving || ui.converting || ui.isLoadingTemplateContent}
+ useTemplateLabel={m.common_use_template()}
+ onUseTemplate={() => {
+ // fallow-ignore-next-line code-duplication shared ComposeCreateMenu wiring with swarm stack create; labels/handlers are page-specific
+ ui.showTemplateDialog = true;
+ }}
+ convertLabel={m.compose_convert_from_docker_run()}
+ onConvert={() => (ui.showConverterDialog = true)}
+ fromGitLabel={m.git_from_git_repo()}
+ onFromGit={async () => goto(`/environments/${await environmentStore.getCurrentEnvironmentId()}/gitops?action=create`)}
+ createTemplateLabel={m.templates_create_template()}
+ createTemplateDisabled={!$inputs.name.value ||
+ !$inputs.composeContent.value ||
+ hasEditorErrors ||
+ ui.saving ||
+ ui.converting ||
+ ui.creatingTemplate ||
+ ui.isLoadingTemplateContent}
+ createTemplateLoading={ui.creatingTemplate}
+ onCreateTemplate={handleCreateTemplate}
+ createTemplatePermission="templates:create"
+ />
</div>
</div>
</div>
@@ -473,15 +420,8 @@
<div class="bg-card border-border flex min-h-0 flex-1 flex-col overflow-hidden rounded-lg border">
<ResizableSplit
class="min-h-0 flex-1"
- variant="flush"
- firstClass="bg-muted/20 border-border flex min-h-0 flex-col border-b lg:border-r lg:border-b-0"
- secondClass="flex min-h-0 flex-col"
+ {...composeTreeSplitProps}
bind:size={treePaneWidth}
- minSize={minTreePaneWidth}
- maxSize={maxTreePaneWidth}
- minSecondSize={minEditorPaneWidth}
- defaultRatio={0.22}
- stackBelow={1024}
ariaLabel={m.compose_editor_resize_files_panel()}
persistKey="arcane.compose.split:new-project:tree"
>
@@ -509,35 +449,15 @@
onClose={closeProjectFileTab}
>
{#snippet actions()}
- <ArcaneButton
- action="base"
- tone={treeOutlineOpen ? 'outline-primary' : 'ghost'}
- size="icon"
- class="size-6"
- showLabel={false}
- icon={FileTextIcon}
- customLabel={m.compose_editor_toggle_outline()}
- onclick={() => (treeOutlineOpen = !treeOutlineOpen)}
- />
- <ArcaneButton
- action="base"
- tone={treeDiffOpen ? 'outline-primary' : 'ghost'}
- size="icon"
- class="size-6"
- showLabel={false}
- icon={ArrowsUpDownIcon}
- customLabel={m.compose_editor_toggle_diff()}
- onclick={() => (treeDiffOpen = !treeDiffOpen)}
- />
- <ArcaneButton
- action="base"
- tone="ghost"
- size="icon"
- class="size-6"
- showLabel={false}
- icon={SearchIcon}
- customLabel={m.compose_editor_command_palette()}
- onclick={() => (treeCommandPaletteOpen = true)}
+ <ComposeFileEditorPanel
+ outlineOpen={treeOutlineOpen}
+ outlineLabel={m.compose_editor_toggle_outline()}
+ onToggleOutline={() => (treeOutlineOpen = !treeOutlineOpen)}
+ diffOpen={treeDiffOpen}
+ diffLabel={m.compose_editor_toggle_diff()}
+ onToggleDiff={() => (treeDiffOpen = !treeDiffOpen)}
+ commandPaletteLabel={m.compose_editor_command_palette()}
+ onOpenCommandPalette={() => (treeCommandPaletteOpen = true)}
/>
{/snippet}
</EditorTabStrip>
@@ -546,16 +466,11 @@
{#if activeProjectTab === 'compose'}
<CodePanel
variant="plain"
+ {...composePanelProps()}
bind:open={composeOpen}
- title={m.compose_compose_file_title()}
- language="yaml"
- validationMode="compose"
bind:value={$inputs.composeContent.value}
- error={$inputs.composeContent.error ?? undefined}
bind:hasErrors={validation.composeHasErrors}
bind:validationReady={validation.composeValidationReady}
- fileId="projects:new:compose"
- editorContext={codeEditorContext}
bind:outlineOpen={treeOutlineOpen}
bind:diffOpen={treeDiffOpen}
bind:commandPaletteOpen={treeCommandPaletteOpen}
@@ -563,16 +478,11 @@
{:else if activeProjectTab === 'env'}
<CodePanel
variant="plain"
+ {...envPanelProps()}
bind:open={envOpen}
- title={m.compose_env_title()}
- language="env"
- validationMode="env"
bind:value={$inputs.envContent.value}
- error={$inputs.envContent.error ?? undefined}
bind:hasErrors={validation.envHasErrors}
bind:validationReady={validation.envValidationReady}
- fileId="projects:new:env"
- editorContext={codeEditorContext}
bind:outlineOpen={treeOutlineOpen}
bind:diffOpen={treeDiffOpen}
bind:commandPaletteOpen={treeCommandPaletteOpen}
@@ -607,35 +517,26 @@
<ComposeEditorSplit onsubmit={preventDefault(handleSubmit)}>
{#snippet compose()}
<CodePanel
+ {...composePanelProps()}
bind:open={composeOpen}
- title={m.compose_compose_file_title()}
- language="yaml"
- validationMode="compose"
bind:value={$inputs.composeContent.value}
- error={$inputs.composeContent.error ?? undefined}
bind:hasErrors={validation.composeHasErrors}
bind:validationReady={validation.composeValidationReady}
- fileId="projects:new:compose"
- editorContext={codeEditorContext}
/>
{/snippet}
{#snippet env()}
<CodePanel
+ {...envPanelProps()}
bind:open={envOpen}
- title={m.compose_env_title()}
- language="env"
- validationMode="env"
bind:value={$inputs.envContent.value}
- error={$inputs.envContent.error ?? undefined}
bind:hasErrors={validation.envHasErrors}
bind:validationReady={validation.envValidationReady}
- fileId="projects:new:env"
- editorContext={codeEditorContext}
/>
{/snippet}
</ComposeEditorSplit>
{/if}
+ <!-- fallow-ignore-next-line code-duplication compose editor panel closing structure; ResizableSplit bindings/persistKey diverge per page -->
</div>
</div>
</div>
diff --git a/frontend/src/routes/(app)/projects/projects-table.svelte b/frontend/src/routes/(app)/projects/projects-table.svelte
index 0cc66117d..d7bba3509 100644
--- a/frontend/src/routes/(app)/projects/projects-table.svelte
+++ b/frontend/src/routes/(app)/projects/projects-table.svelte
@@ -1,9 +1,9 @@
<script lang="ts">
import type { Project } from '$lib/types/swarm';
import ArcaneTable from '$lib/components/arcane-table/arcane-table.svelte';
- import { ArcaneButton } from '$lib/components/arcane-button/index.js';
import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
- import { BoxIcon, EditIcon, StartIcon, RestartIcon, StopIcon, TrashIcon, RedeployIcon, EllipsisIcon } from '$lib/icons';
+ import RowActionsMenu from '$lib/components/arcane-table/row-actions-menu.svelte';
+ import { BoxIcon, EditIcon, StartIcon, RestartIcon, StopIcon, TrashIcon, RedeployIcon } from '$lib/icons';
import { Spinner } from '$lib/components/ui/spinner/index.js';
import { goto } from '$app/navigation';
import { mode } from 'mode-watcher';
@@ -376,155 +376,143 @@
{#snippet RowActions({ item }: { item: Project })}
{@const status = actionStatus[item.id]}
- <DropdownMenu.Root>
- <DropdownMenu.Trigger>
- {#snippet child({ props })}
- <ArcaneButton {...props} action="base" tone="ghost" size="icon" class="size-8">
- <span class="sr-only">{m.common_open_menu()}</span>
- <EllipsisIcon class="size-4" />
- </ArcaneButton>
- {/snippet}
- </DropdownMenu.Trigger>
- <DropdownMenu.Content align="end">
- <DropdownMenu.Group>
- <DropdownMenu.Item onclick={() => goto(`/projects/${item.id}`)} disabled={isAnyLoading}>
- <EditIcon class="size-4" />
- {m.common_edit()}
- </DropdownMenu.Item>
-
- {#if item.gitOpsManagedBy && canUpdateProject}
- <DropdownMenu.Item
- onclick={() => handleSyncFromGit(item.id, item.gitOpsManagedBy!)}
- disabled={status === 'syncing' || isAnyLoading}
- >
- {#if status === 'syncing'}
- <Spinner class="size-4" />
- {:else}
- <RefreshIcon class="size-4" />
- {/if}
- {m.git_sync_from_git()}
- </DropdownMenu.Item>
+ <RowActionsMenu>
+ <DropdownMenu.Item onclick={() => goto(`/projects/${item.id}`)} disabled={isAnyLoading}>
+ <EditIcon class="size-4" />
+ {m.common_edit()}
+ </DropdownMenu.Item>
+
+ {#if item.gitOpsManagedBy && canUpdateProject}
+ <DropdownMenu.Item
+ onclick={() => handleSyncFromGit(item.id, item.gitOpsManagedBy!)}
+ disabled={status === 'syncing' || isAnyLoading}
+ >
+ {#if status === 'syncing'}
+ <Spinner class="size-4" />
+ {:else}
+ <RefreshIcon class="size-4" />
{/if}
+ {m.git_sync_from_git()}
+ </DropdownMenu.Item>
+ {/if}
- <DropdownMenu.Separator />
-
- {#if item.status !== 'running'}
- {#if canDeployProject}
- <DropdownMenu.Item
- onclick={() => performProjectAction('start', item.id)}
- disabled={item.isArchived || status === 'starting' || isAnyLoading}
- title={item.isArchived ? m.projects_archived_badge() : undefined}
- >
- {#if status === 'starting'}
- <Spinner class="size-4" />
- {:else}
- <StartIcon class="size-4" />
- {/if}
- {m.common_up()}
- </DropdownMenu.Item>
+ <DropdownMenu.Separator />
+
+ {#if item.status !== 'running'}
+ {#if canDeployProject}
+ <DropdownMenu.Item
+ onclick={() => performProjectAction('start', item.id)}
+ disabled={item.isArchived || status === 'starting' || isAnyLoading}
+ title={item.isArchived ? m.projects_archived_badge() : undefined}
+ >
+ {#if status === 'starting'}
+ <Spinner class="size-4" />
+ {:else}
+ <StartIcon class="size-4" />
{/if}
- {:else}
- {#if canDownProject}
- <DropdownMenu.Item
- onclick={() => performProjectAction('stop', item.id)}
- disabled={item.isArchived || status === 'stopping' || isAnyLoading}
- title={item.isArchived ? m.projects_archived_badge() : undefined}
- >
- {#if status === 'stopping'}
- <Spinner class="size-4" />
- {:else}
- <StopIcon class="size-4" />
- {/if}
- {m.common_down()}
- </DropdownMenu.Item>
+ {m.common_up()}
+ </DropdownMenu.Item>
+ {/if}
+ {:else}
+ {#if canDownProject}
+ <DropdownMenu.Item
+ onclick={() => performProjectAction('stop', item.id)}
+ disabled={item.isArchived || status === 'stopping' || isAnyLoading}
+ title={item.isArchived ? m.projects_archived_badge() : undefined}
+ >
+ {#if status === 'stopping'}
+ <Spinner class="size-4" />
+ {:else}
+ <StopIcon class="size-4" />
{/if}
+ {m.common_down()}
+ </DropdownMenu.Item>
+ {/if}
+
+ <IfPermitted perm="projects:restart">
+ <DropdownMenu.Item
+ onclick={() => performProjectAction('restart', item.id)}
+ disabled={item.isArchived || status === 'restarting' || isAnyLoading}
+ title={item.isArchived ? m.projects_archived_badge() : undefined}
+ >
+ {#if status === 'restarting'}
+ <Spinner class="size-4" />
+ {:else}
+ <RestartIcon class="size-4" />
+ {/if}
+ {m.common_restart()}
+ </DropdownMenu.Item>
+ </IfPermitted>
+ {/if}
- <IfPermitted perm="projects:restart">
- <DropdownMenu.Item
- onclick={() => performProjectAction('restart', item.id)}
- disabled={item.isArchived || status === 'restarting' || isAnyLoading}
- title={item.isArchived ? m.projects_archived_badge() : undefined}
- >
- {#if status === 'restarting'}
- <Spinner class="size-4" />
- {:else}
- <RestartIcon class="size-4" />
- {/if}
- {m.common_restart()}
- </DropdownMenu.Item>
- </IfPermitted>
- {/if}
-
- {#if canDeployProject}
- {#if item.redeployDisabled}
- <DropdownMenu.Item disabled title={m.common_redeploy_disabled_arcane_self()}>
- <RedeployIcon class="size-4 opacity-50" />
- {m.compose_pull_redeploy()}
- </DropdownMenu.Item>
+ {#if canDeployProject}
+ {#if item.redeployDisabled}
+ <DropdownMenu.Item disabled title={m.common_redeploy_disabled_arcane_self()}>
+ <RedeployIcon class="size-4 opacity-50" />
+ {m.compose_pull_redeploy()}
+ </DropdownMenu.Item>
+ {:else}
+ <DropdownMenu.Item
+ onclick={() => performProjectAction('redeploy', item.id)}
+ disabled={item.isArchived || status === 'redeploying' || isAnyLoading}
+ title={item.isArchived ? m.projects_archived_badge() : undefined}
+ >
+ {#if status === 'redeploying'}
+ <Spinner class="size-4" />
{:else}
- <DropdownMenu.Item
- onclick={() => performProjectAction('redeploy', item.id)}
- disabled={item.isArchived || status === 'redeploying' || isAnyLoading}
- title={item.isArchived ? m.projects_archived_badge() : undefined}
- >
- {#if status === 'redeploying'}
- <Spinner class="size-4" />
- {:else}
- <RedeployIcon class="size-4" />
- {/if}
- {m.compose_pull_redeploy()}
- </DropdownMenu.Item>
+ <RedeployIcon class="size-4" />
{/if}
- {/if}
+ {m.compose_pull_redeploy()}
+ </DropdownMenu.Item>
+ {/if}
+ {/if}
+
+ <DropdownMenu.Separator />
- <DropdownMenu.Separator />
-
- {#if canArchiveProject}
- {#if item.isArchived}
- <DropdownMenu.Item
- onclick={() => performProjectAction('unarchive', item.id)}
- disabled={status === 'unarchiving' || isAnyLoading}
- >
- {#if status === 'unarchiving'}
- <Spinner class="size-4" />
- {:else}
- <BoxIcon class="size-4" />
- {/if}
- {m.projects_unarchive()}
- </DropdownMenu.Item>
+ {#if canArchiveProject}
+ {#if item.isArchived}
+ <DropdownMenu.Item
+ onclick={() => performProjectAction('unarchive', item.id)}
+ disabled={status === 'unarchiving' || isAnyLoading}
+ >
+ {#if status === 'unarchiving'}
+ <Spinner class="size-4" />
{:else}
- <DropdownMenu.Item
- onclick={() => performProjectAction('archive', item.id)}
- disabled={isProjectArchiveBlocked(item) || status === 'archiving' || isAnyLoading}
- title={isProjectArchiveBlocked(item) ? m.projects_archive_requires_stopped() : undefined}
- >
- {#if status === 'archiving'}
- <Spinner class="size-4" />
- {:else}
- <BoxIcon class="size-4" />
- {/if}
- {m.projects_archive()}
- </DropdownMenu.Item>
+ <BoxIcon class="size-4" />
{/if}
- {/if}
+ {m.projects_unarchive()}
+ </DropdownMenu.Item>
+ {:else}
+ <DropdownMenu.Item
+ onclick={() => performProjectAction('archive', item.id)}
+ disabled={isProjectArchiveBlocked(item) || status === 'archiving' || isAnyLoading}
+ title={isProjectArchiveBlocked(item) ? m.projects_archive_requires_stopped() : undefined}
+ >
+ {#if status === 'archiving'}
+ <Spinner class="size-4" />
+ {:else}
+ <BoxIcon class="size-4" />
+ {/if}
+ {m.projects_archive()}
+ </DropdownMenu.Item>
+ {/if}
+ {/if}
- <IfPermitted perm="projects:delete">
- <DropdownMenu.Item
- variant="destructive"
- onclick={() => handleDestroyProject(item.id)}
- disabled={status === 'destroying' || isAnyLoading}
- >
- {#if status === 'destroying'}
- <Spinner class="size-4" />
- {:else}
- <TrashIcon class="size-4" />
- {/if}
- {m.compose_destroy()}
- </DropdownMenu.Item>
- </IfPermitted>
- </DropdownMenu.Group>
- </DropdownMenu.Content>
- </DropdownMenu.Root>
+ <IfPermitted perm="projects:delete">
+ <DropdownMenu.Item
+ variant="destructive"
+ onclick={() => handleDestroyProject(item.id)}
+ disabled={status === 'destroying' || isAnyLoading}
+ >
+ {#if status === 'destroying'}
+ <Spinner class="size-4" />
+ {:else}
+ <TrashIcon class="size-4" />
+ {/if}
+ {m.compose_destroy()}
+ </DropdownMenu.Item>
+ </IfPermitted>
+ </RowActionsMenu>
{/snippet}
{#snippet ArchivedToolbarAction()}
diff --git a/frontend/src/routes/(app)/settings/+page.svelte b/frontend/src/routes/(app)/settings/+page.svelte
index 1d33137b7..f314223a0 100644
--- a/frontend/src/routes/(app)/settings/+page.svelte
+++ b/frontend/src/routes/(app)/settings/+page.svelte
@@ -2,36 +2,29 @@
import { goto } from '$app/navigation';
import { onMount } from 'svelte';
import {
- SearchIcon,
SettingsIcon,
UserIcon,
SecurityIcon,
LockIcon,
NotificationsIcon,
- ArrowRightIcon,
DockerBrandIcon,
ApiKeyIcon,
AppearanceIcon,
- CloseIcon,
JobsIcon,
CodeIcon,
GlobeIcon,
ActivityIcon
} from '$lib/icons';
- import { ArcaneButton } from '$lib/components/arcane-button/index.js';
- import { Card } from '$lib/components/ui/card';
import { m } from '$lib/paraglide/messages';
- import { UiConfigDisabledTag } from '$lib/components/badges/index.js';
import { settingsSearchService } from '$lib/services/settings-search';
import { environmentStore } from '$lib/stores/environment.store.svelte';
import type { SettingsCategory } from '$lib/types/shared';
import { canReachAccessSurface, canReachAccessSurfaceUrl } from '$lib/utils/access-policy';
- import * as InputGroup from '$lib/components/ui/input-group/index.js';
import { getSettingsSubpageUrlsInNavOrder } from '$lib/config/navigation-config';
- import HeaderCard from '$lib/components/header-card.svelte';
- import { Spinner } from '$lib/components/ui/spinner/index.js';
import { useCategorySearch } from '$lib/hooks/use-category-search.svelte';
import { getCategoryIcon, orderCategoriesByNav } from '$lib/utils/category-page';
+ import CategoryIndexPage from '$lib/components/category-index-page.svelte';
+ import type { NormalizedCategory } from '$lib/components/category-index-page.types';
let { data }: PageProps = $props();
@@ -92,169 +85,65 @@
function getIconComponent(iconName: string) {
return getCategoryIcon(iconMap, iconName, SettingsIcon);
}
-</script>
-
-<div class="space-y-6 pb-5 md:space-y-8 md:pb-5">
- <HeaderCard>
- <div class="flex items-center justify-between gap-4">
- <div class="flex min-w-64 flex-1 items-center gap-3 sm:gap-4">
- <div
- class="bg-primary/10 text-primary ring-primary/20 flex size-8 shrink-0 items-center justify-center rounded-lg ring-1 sm:size-10"
- >
- <SettingsIcon class="size-4 sm:size-5" />
- </div>
- <div class="min-w-0">
- <h1 class="text-3xl font-semibold tracking-tight">{m.sidebar_settings()}</h1>
- <p class="text-muted-foreground mt-1 text-sm sm:text-base">{m.settings_subtitle()}</p>
- </div>
- </div>
- <div class="flex items-center gap-3">
- <UiConfigDisabledTag />
- </div>
- </div>
-
- <div class="relative mt-4 w-full sm:mt-6 sm:max-w-md">
- <InputGroup.Root>
- <InputGroup.Input
- placeholder={m.settings_search_placeholder()}
- value={categorySearch.searchQuery}
- oninput={(e) => {
- categorySearch.searchQuery = e.currentTarget.value;
- categorySearch.debouncedSearch(e.currentTarget.value);
- }}
- onkeydown={(e) => {
- if (e.key === 'Enter') {
- categorySearch.performSearch((e.currentTarget as HTMLInputElement).value);
- }
- }}
- />
- <InputGroup.Addon>
- {#if categorySearch.showSearchResults}
- <ArcaneButton
- action="base"
- tone="ghost"
- size="sm"
- onclick={categorySearch.clearSearch}
- class="h-6 w-6 p-0"
- icon={CloseIcon}
- showLabel={false}
- customLabel={m.settings_clear_search()}
- />
- {:else}
- <SearchIcon />
- {/if}
- </InputGroup.Addon>
- </InputGroup.Root>
- </div>
- </HeaderCard>
- {#if !categorySearch.showSearchResults}
- <div class="grid grid-cols-1 gap-4 sm:grid-cols-2 sm:gap-6 xl:grid-cols-3">
- {#each settingsCategories as category (category.id)}
- {@const Icon = getIconComponent(category.icon)}
- <Card class="hover:border-primary/30 group cursor-pointer transition-colors duration-200">
- <button onclick={() => navigateToCategory(getCategoryUrl(category))} class="w-full p-4 text-left sm:p-6">
- <div class="flex items-start justify-between gap-3">
- <div class="flex min-w-0 flex-1 items-start gap-3 sm:gap-4">
- <div
- class="bg-primary/5 text-primary ring-primary/10 group-hover:bg-primary/10 flex size-10 shrink-0 items-center justify-center rounded-lg ring-1 transition-colors sm:size-12"
- >
- <Icon class="size-5 sm:size-6" />
- </div>
- <div class="min-w-0 flex-1">
- <h2 class="text-sm leading-tight font-semibold sm:text-base">{category.title}</h2>
- <p class="text-muted-foreground mt-1 text-xs leading-relaxed sm:text-sm">{category.description}</p>
- </div>
- </div>
- <ArrowRightIcon class="text-muted-foreground group-hover:text-foreground mt-1 size-4 shrink-0 transition-colors" />
- </div>
- </button>
- </Card>
- {/each}
- </div>
- {:else}
- <div class="space-y-6 sm:space-y-8">
- <div class="flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between">
- <h2 class="text-base font-semibold sm:text-lg">
- {m.settings_search_results({ query: categorySearch.searchQuery, count: categorySearch.searchResults.length })}
- </h2>
- </div>
+ function normalize(category: SettingsCategory): NormalizedCategory {
+ return {
+ id: category.id,
+ title: category.title,
+ description: category.description,
+ icon: getIconComponent(category.icon),
+ href: getCategoryUrl(category),
+ matchingItems: category.matchingSettings
+ };
+ }
- {#if categorySearch.isSearching}
- <div class="py-8 text-center sm:py-12">
- <Spinner class="text-primary mx-auto mb-3 size-8 sm:mb-4 sm:size-12" />
- <p class="text-muted-foreground text-sm sm:text-base">{m.settings_searching()}</p>
- </div>
- {:else if categorySearch.searchResults.length === 0}
- <div class="py-8 text-center sm:py-12">
- <SearchIcon class="text-muted-foreground mx-auto mb-3 size-8 sm:mb-4 sm:size-12" />
- <h3 class="mb-2 text-base font-medium sm:text-lg">{m.settings_no_results()}</h3>
- <p class="text-muted-foreground text-sm sm:text-base">{m.settings_no_results_description()}</p>
- </div>
- {:else}
- <div class="space-y-4 sm:space-y-6">
- {#each categorySearch.searchResults as result (result.id)}
- {@const Icon = getIconComponent(result.icon)}
- <div class="bg-background/40 rounded-lg border">
- <div class="border-b p-4 sm:p-6">
- <div class="flex items-center justify-between">
- <div class="flex items-center gap-3">
- <Icon class="text-primary size-4 shrink-0 sm:size-5" />
- <div>
- <h3 class="text-base font-semibold sm:text-lg">{result.title}</h3>
- <p class="text-muted-foreground text-xs sm:text-sm">{result.description}</p>
- </div>
- </div>
- <ArcaneButton
- action="base"
- tone="outline"
- size="sm"
- onclick={() => navigateToCategory(getCategoryUrl(result))}
- class="shrink-0"
- customLabel={m.settings_go_to_page()}
- />
- </div>
- </div>
+ const normalizedCategories = $derived(settingsCategories.map(normalize));
+ const searchAdapter = {
+ get searchQuery() {
+ return categorySearch.searchQuery;
+ },
+ set searchQuery(value: string) {
+ categorySearch.searchQuery = value;
+ },
+ get showSearchResults() {
+ return categorySearch.showSearchResults;
+ },
+ get searchResults() {
+ return categorySearch.searchResults.map(normalize);
+ },
+ get isSearching() {
+ return categorySearch.isSearching;
+ },
+ performSearch: categorySearch.performSearch,
+ debouncedSearch: categorySearch.debouncedSearch,
+ clearSearch: categorySearch.clearSearch
+ };
+</script>
- <!-- Show matching settings with descriptions -->
- {#if result.matchingSettings && result.matchingSettings.length > 0}
- <div class="space-y-3 p-4 sm:p-6">
- <h4 class="text-muted-foreground mb-3 text-sm font-medium">{m.settings_matching_settings()}</h4>
- {#each result.matchingSettings as setting (setting.key)}
- <div class="bg-background/60 border-primary/20 rounded-md border-l-2 p-3">
- <div class="flex items-start justify-between gap-3">
- <div class="min-w-0 flex-1">
- <h5 class="text-sm font-medium">{setting.label}</h5>
- {#if setting.description}
- <p class="text-muted-foreground mt-1 text-xs">{setting.description}</p>
- {/if}
- {#if setting.keywords && setting.keywords.length > 0}
- <div class="mt-2 flex flex-wrap gap-1">
- {#each setting.keywords.slice(0, 6) as keyword (keyword)}
- <span class="bg-muted/50 text-muted-foreground rounded px-2 py-0.5 text-xs">
- {keyword}
- </span>
- {/each}
- {#if setting.keywords.length > 6}
- <span class="text-muted-foreground px-2 py-0.5 text-xs">
- {m.settings_more_keywords({ count: setting.keywords.length - 6 })}
- </span>
- {/if}
- </div>
- {/if}
- </div>
- <div class="bg-muted/30 text-muted-foreground shrink-0 rounded px-2 py-1 font-mono text-xs">
- {setting.type}
- </div>
- </div>
- </div>
- {/each}
- </div>
- {/if}
- </div>
- {/each}
- </div>
- {/if}
- </div>
- {/if}
-</div>
+<CategoryIndexPage
+ headerIcon={SettingsIcon}
+ title={m.sidebar_settings()}
+ subtitle={m.settings_subtitle()}
+ searchPlaceholder={m.settings_search_placeholder()}
+ clearSearchLabel={m.settings_clear_search()}
+ searchingLabel={m.settings_searching()}
+ noResultsTitle={m.settings_no_results()}
+ noResultsDescription={m.settings_no_results_description()}
+ matchingItemsLabel={m.settings_matching_settings()}
+ goToPageLabel={m.settings_go_to_page()}
+ goToPageButtonTone="outline"
+ rootClass="space-y-6 pb-5 md:space-y-8 md:pb-5"
+ cardClass="hover:border-primary/30 group cursor-pointer transition-colors duration-200"
+ resultCardClass="bg-background/40 rounded-lg border"
+ searchIconClass=""
+ categories={normalizedCategories}
+ categorySearch={searchAdapter}
+ navigate={navigateToCategory}
+>
+ {#snippet resultsHeading()}
+ {m.settings_search_results({ query: categorySearch.searchQuery, count: categorySearch.searchResults.length })}
+ {/snippet}
+ {#snippet moreKeywords(count: number)}
+ {m.settings_more_keywords({ count })}
+ {/snippet}
+</CategoryIndexPage>
diff --git a/frontend/src/routes/(app)/settings/api-keys/api-key-table.svelte b/frontend/src/routes/(app)/settings/api-keys/api-key-table.svelte
index 7f79811ca..ddc07b910 100644
--- a/frontend/src/routes/(app)/settings/api-keys/api-key-table.svelte
+++ b/frontend/src/routes/(app)/settings/api-keys/api-key-table.svelte
@@ -1,7 +1,7 @@
<script lang="ts">
import ArcaneTable from '$lib/components/arcane-table/arcane-table.svelte';
- import { ArcaneButton } from '$lib/components/arcane-button/index.js';
import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
+ import RowActionsMenu from '$lib/components/arcane-table/row-actions-menu.svelte';
import { CopyButton } from '$lib/components/ui/copy-button';
import { toast } from 'svelte-sonner';
import { openConfirmDialog } from '$lib/components/confirm-dialog';
@@ -15,7 +15,7 @@
import { apiKeyService } from '$lib/services/api-key-service';
import { formatOptionalDateTime, isPastDate } from '$lib/utils/formatting';
import * as m from '$lib/paraglide/messages.js';
- import { ApiKeyIcon, TrashIcon, EditIcon, EllipsisIcon } from '$lib/icons';
+ import { ApiKeyIcon, TrashIcon, EditIcon } from '$lib/icons';
import IfPermitted from '$lib/components/if-permitted.svelte';
let {
@@ -249,38 +249,26 @@
{/snippet}
{#snippet RowActions({ item }: { item: ApiKey })}
- <DropdownMenu.Root>
- <DropdownMenu.Trigger>
- {#snippet child({ props })}
- <ArcaneButton {...props} action="base" tone="ghost" size="icon" class="size-8">
- <span class="sr-only">{m.common_open_menu()}</span>
- <EllipsisIcon class="size-4" />
- </ArcaneButton>
- {/snippet}
- </DropdownMenu.Trigger>
- <DropdownMenu.Content align="end">
- <DropdownMenu.Group>
- <IfPermitted perm="apikeys:update">
- <DropdownMenu.Item onclick={() => onEditApiKey(item)} disabled={isStaticApiKey(item) || isBootstrapApiKey(item)}>
- <EditIcon class="size-4" />
- {m.common_edit()}
- </DropdownMenu.Item>
- </IfPermitted>
- <DropdownMenu.Separator />
+ <RowActionsMenu>
+ <IfPermitted perm="apikeys:update">
+ <DropdownMenu.Item onclick={() => onEditApiKey(item)} disabled={isStaticApiKey(item) || isBootstrapApiKey(item)}>
+ <EditIcon class="size-4" />
+ {m.common_edit()}
+ </DropdownMenu.Item>
+ </IfPermitted>
+ <DropdownMenu.Separator />
- <IfPermitted perm="apikeys:delete">
- <DropdownMenu.Item
- variant="destructive"
- onclick={() => handleDeleteApiKey(item.id, item.name)}
- disabled={isStaticApiKey(item) || isBootstrapApiKey(item)}
- >
- <TrashIcon class="size-4" />
- {m.common_delete()}
- </DropdownMenu.Item>
- </IfPermitted>
- </DropdownMenu.Group>
- </DropdownMenu.Content>
- </DropdownMenu.Root>
+ <IfPermitted perm="apikeys:delete">
+ <DropdownMenu.Item
+ variant="destructive"
+ onclick={() => handleDeleteApiKey(item.id, item.name)}
+ disabled={isStaticApiKey(item) || isBootstrapApiKey(item)}
+ >
+ <TrashIcon class="size-4" />
+ {m.common_delete()}
+ </DropdownMenu.Item>
+ </IfPermitted>
+ </RowActionsMenu>
{/snippet}
<ArcaneTable
diff --git a/frontend/src/routes/(app)/settings/authentication/federated-credential-table.svelte b/frontend/src/routes/(app)/settings/authentication/federated-credential-table.svelte
index 77bee0c64..f058bad06 100644
--- a/frontend/src/routes/(app)/settings/authentication/federated-credential-table.svelte
+++ b/frontend/src/routes/(app)/settings/authentication/federated-credential-table.svelte
@@ -1,7 +1,7 @@
<script lang="ts">
import ArcaneTable from '$lib/components/arcane-table/arcane-table.svelte';
- import { ArcaneButton } from '$lib/components/arcane-button/index.js';
import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
+ import RowActionsMenu from '$lib/components/arcane-table/row-actions-menu.svelte';
import StatusBadge from '$lib/components/badges/status-badge.svelte';
import { toast } from 'svelte-sonner';
import { openConfirmDialog } from '$lib/components/confirm-dialog';
@@ -14,7 +14,7 @@
import { federatedCredentialService } from '$lib/services/federated-credential-service';
import { formatOptionalDateTime, isPastDate } from '$lib/utils/formatting';
import * as m from '$lib/paraglide/messages.js';
- import { LockIcon, TrashIcon, EditIcon, EllipsisIcon } from '$lib/icons';
+ import { LockIcon, TrashIcon, EditIcon } from '$lib/icons';
import { isGlobalAdmin } from '$lib/utils/auth';
let {
@@ -236,29 +236,17 @@
{#snippet RowActions({ item }: { item: FederatedCredential })}
{#if canManageFederatedCredentials}
- <DropdownMenu.Root>
- <DropdownMenu.Trigger>
- {#snippet child({ props })}
- <ArcaneButton {...props} action="base" tone="ghost" size="icon" class="size-8">
- <span class="sr-only">{m.common_open_menu()}</span>
- <EllipsisIcon class="size-4" />
- </ArcaneButton>
- {/snippet}
- </DropdownMenu.Trigger>
- <DropdownMenu.Content align="end">
- <DropdownMenu.Group>
- <DropdownMenu.Item onclick={() => onEditFederatedCredential(item)}>
- <EditIcon class="size-4" />
- {m.common_edit()}
- </DropdownMenu.Item>
- <DropdownMenu.Separator />
- <DropdownMenu.Item variant="destructive" onclick={() => handleDeleteFederatedCredential(item.id, item.name)}>
- <TrashIcon class="size-4" />
- {m.common_delete()}
- </DropdownMenu.Item>
- </DropdownMenu.Group>
- </DropdownMenu.Content>
- </DropdownMenu.Root>
+ <RowActionsMenu>
+ <DropdownMenu.Item onclick={() => onEditFederatedCredential(item)}>
+ <EditIcon class="size-4" />
+ {m.common_edit()}
+ </DropdownMenu.Item>
+ <DropdownMenu.Separator />
+ <DropdownMenu.Item variant="destructive" onclick={() => handleDeleteFederatedCredential(item.id, item.name)}>
+ <TrashIcon class="size-4" />
+ {m.common_delete()}
+ </DropdownMenu.Item>
+ </RowActionsMenu>
{/if}
{/snippet}
diff --git a/frontend/src/routes/(app)/settings/authentication/oidc-mapping-table.svelte b/frontend/src/routes/(app)/settings/authentication/oidc-mapping-table.svelte
index 7147d6d29..8802d20fd 100644
--- a/frontend/src/routes/(app)/settings/authentication/oidc-mapping-table.svelte
+++ b/frontend/src/routes/(app)/settings/authentication/oidc-mapping-table.svelte
@@ -1,8 +1,8 @@
<script lang="ts">
import ArcaneTable from '$lib/components/arcane-table/arcane-table.svelte';
- import { ArcaneButton } from '$lib/components/arcane-button/index.js';
import { toast } from 'svelte-sonner';
import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
+ import RowActionsMenu from '$lib/components/arcane-table/row-actions-menu.svelte';
import { openConfirmDialog } from '$lib/components/confirm-dialog';
import StatusBadge from '$lib/components/badges/status-badge.svelte';
import { handleApiResultWithCallbacks } from '$lib/utils/api';
@@ -15,7 +15,7 @@
import { UniversalMobileCard } from '$lib/components/arcane-table';
import { m } from '$lib/paraglide/messages';
import { oidcMappingService } from '$lib/services/oidc-mapping-service';
- import { ShieldAlertIcon, TrashIcon, EditIcon, EllipsisIcon } from '$lib/icons';
+ import { ShieldAlertIcon, TrashIcon, EditIcon } from '$lib/icons';
let {
mappings,
@@ -200,35 +200,23 @@
{/snippet}
{#snippet RowActions({ item }: { item: OidcRoleMapping })}
- <DropdownMenu.Root>
- <DropdownMenu.Trigger>
- {#snippet child({ props })}
- <ArcaneButton {...props} action="base" tone="ghost" size="icon" class="size-8">
- <span class="sr-only">{m.common_open_menu()}</span>
- <EllipsisIcon class="size-4" />
- </ArcaneButton>
- {/snippet}
- </DropdownMenu.Trigger>
- <DropdownMenu.Content align="end">
- <DropdownMenu.Group>
- <DropdownMenu.Item disabled={item.source === 'env'} onclick={() => onEdit(item)}>
- <EditIcon class="size-4" />
- {m.common_edit()}
- </DropdownMenu.Item>
-
- <DropdownMenu.Separator />
-
- <DropdownMenu.Item
- variant="destructive"
- disabled={isLoading.removing || item.source === 'env'}
- onclick={() => handleDeleteMapping(item)}
- >
- <TrashIcon class="size-4" />
- {m.common_delete()}
- </DropdownMenu.Item>
- </DropdownMenu.Group>
- </DropdownMenu.Content>
- </DropdownMenu.Root>
+ <RowActionsMenu>
+ <DropdownMenu.Item disabled={item.source === 'env'} onclick={() => onEdit(item)}>
+ <EditIcon class="size-4" />
+ {m.common_edit()}
+ </DropdownMenu.Item>
+
+ <DropdownMenu.Separator />
+
+ <DropdownMenu.Item
+ variant="destructive"
+ disabled={isLoading.removing || item.source === 'env'}
+ onclick={() => handleDeleteMapping(item)}
+ >
+ <TrashIcon class="size-4" />
+ {m.common_delete()}
+ </DropdownMenu.Item>
+ </RowActionsMenu>
{/snippet}
<ArcaneTable
diff --git a/frontend/src/routes/(app)/settings/notifications/providers/BuiltInProviderForm.svelte b/frontend/src/routes/(app)/settings/notifications/providers/BuiltInProviderForm.svelte
index 982cd03ec..29286ae76 100644
--- a/frontend/src/routes/(app)/settings/notifications/providers/BuiltInProviderForm.svelte
+++ b/frontend/src/routes/(app)/settings/notifications/providers/BuiltInProviderForm.svelte
@@ -5,7 +5,10 @@
import ProviderFormWrapper from './ProviderFormWrapper.svelte';
import EventSubscriptions from './EventSubscriptions.svelte';
import DynamicProviderFormBuilder from './DynamicProviderFormBuilder.svelte';
- import NotificationProviderTestMenu, { type NotificationProviderTestOption } from './NotificationProviderTestMenu.svelte';
+ import NotificationProviderTestMenu, {
+ type NotificationProviderTestOption,
+ getDefaultNotificationProviderTestOptions
+ } from './NotificationProviderTestMenu.svelte';
import { mapZodFieldErrors } from './provider-form-validation';
import type { ProviderFormSchema } from './provider-form-schema';
@@ -1040,14 +1043,7 @@
]
};
- const testOptions: NotificationProviderTestOption[] = [
- { label: m.notifications_email_test_simple(), testType: 'simple' },
- { label: m.notifications_email_test_image_update(), testType: 'image-update' },
- { label: m.notifications_email_test_batch_image_update(), testType: 'batch-image-update' },
- { label: m.notifications_test_vulnerability_notification(), testType: 'vulnerability-found' },
- { label: m.notifications_test_prune_report_notification(), testType: 'prune-report' },
- { label: m.notifications_test_auto_heal_notification(), testType: 'auto-heal' }
- ];
+ const testOptions: NotificationProviderTestOption[] = getDefaultNotificationProviderTestOptions();
const validation = $derived.by(() => providerSchemas[provider].safeParse(values));
const fieldErrors = $derived.by(() =>
diff --git a/frontend/src/routes/(app)/settings/notifications/providers/DynamicProviderFormBuilder.svelte b/frontend/src/routes/(app)/settings/notifications/providers/DynamicProviderFormBuilder.svelte
index 624112a5b..9279867b7 100644
--- a/frontend/src/routes/(app)/settings/notifications/providers/DynamicProviderFormBuilder.svelte
+++ b/frontend/src/routes/(app)/settings/notifications/providers/DynamicProviderFormBuilder.svelte
@@ -67,17 +67,10 @@
setValue(key, value);
}
- function setNativeSelectValue(field: ProviderNativeSelectField<T>, value: string): void {
- const currentValue = values[field.key];
- if (field.valueType === 'number' || typeof currentValue === 'number') {
- setValue(field.key, Number(value));
- return;
- }
-
- setValue(field.key, value);
- }
-
- function setSelectValue(field: Extract<ProviderFormField<T>, { kind: 'select' }>, value: string): void {
+ function setSelectValue(
+ field: ProviderNativeSelectField<T> | Extract<ProviderFormField<T>, { kind: 'select' }>,
+ value: string
+ ): void {
const currentValue = values[field.key];
if (field.valueType === 'number' || typeof currentValue === 'number') {
setValue(field.key, Number(value));
@@ -149,7 +142,7 @@
<select
id={getFieldId(field)}
value={getStringValue(field.key)}
- onchange={(event) => setNativeSelectValue(field, (event.target as HTMLSelectElement).value)}
+ onchange={(event) => setSelectValue(field, (event.target as HTMLSelectElement).value)}
{disabled}
class="border-input bg-background ring-offset-background placeholder:text-muted-foreground focus-visible:ring-ring flex h-10 rounded-md border px-3 py-2 text-base focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm"
>
diff --git a/frontend/src/routes/(app)/settings/notifications/providers/NotificationProviderTestMenu.svelte b/frontend/src/routes/(app)/settings/notifications/providers/NotificationProviderTestMenu.svelte
index 17d8b15ec..8b13d6582 100644
--- a/frontend/src/routes/(app)/settings/notifications/providers/NotificationProviderTestMenu.svelte
+++ b/frontend/src/routes/(app)/settings/notifications/providers/NotificationProviderTestMenu.svelte
@@ -1,14 +1,26 @@
<script module lang="ts">
+ import { m } from '$lib/paraglide/messages';
+
export interface NotificationProviderTestOption {
label: string;
testType?: string;
}
+
+ export function getDefaultNotificationProviderTestOptions(): NotificationProviderTestOption[] {
+ return [
+ { label: m.notifications_email_test_simple(), testType: 'simple' },
+ { label: m.notifications_email_test_image_update(), testType: 'image-update' },
+ { label: m.notifications_email_test_batch_image_update(), testType: 'batch-image-update' },
+ { label: m.notifications_test_vulnerability_notification(), testType: 'vulnerability-found' },
+ { label: m.notifications_test_prune_report_notification(), testType: 'prune-report' },
+ { label: m.notifications_test_auto_heal_notification(), testType: 'auto-heal' }
+ ];
+ }
</script>
<script lang="ts">
import * as DropdownMenu from '$lib/components/ui/dropdown-menu';
import { ArcaneButton } from '$lib/components/arcane-button/index.js';
- import { m } from '$lib/paraglide/messages';
import { ArrowDownIcon, SendEmailIcon } from '$lib/icons';
interface Props {
@@ -18,19 +30,7 @@
options?: NotificationProviderTestOption[];
}
- let {
- disabled = false,
- isTesting = false,
- onTest,
- options = [
- { label: m.notifications_email_test_simple(), testType: 'simple' },
- { label: m.notifications_email_test_image_update(), testType: 'image-update' },
- { label: m.notifications_email_test_batch_image_update(), testType: 'batch-image-update' },
- { label: m.notifications_test_vulnerability_notification(), testType: 'vulnerability-found' },
- { label: m.notifications_test_prune_report_notification(), testType: 'prune-report' },
- { label: m.notifications_test_auto_heal_notification(), testType: 'auto-heal' }
- ]
- }: Props = $props();
+ let { disabled = false, isTesting = false, onTest, options = getDefaultNotificationProviderTestOptions() }: Props = $props();
</script>
{#if onTest}
diff --git a/frontend/src/routes/(app)/settings/roles/roles-table.svelte b/frontend/src/routes/(app)/settings/roles/roles-table.svelte
index 14fbf6b0f..b5e138bbe 100644
--- a/frontend/src/routes/(app)/settings/roles/roles-table.svelte
+++ b/frontend/src/routes/(app)/settings/roles/roles-table.svelte
@@ -1,8 +1,8 @@
<script lang="ts">
import ArcaneTable from '$lib/components/arcane-table/arcane-table.svelte';
- import { ArcaneButton } from '$lib/components/arcane-button/index.js';
import { toast } from 'svelte-sonner';
import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
+ import RowActionsMenu from '$lib/components/arcane-table/row-actions-menu.svelte';
import * as ArcaneTooltip from '$lib/components/arcane-tooltip';
import { openConfirmDialog } from '$lib/components/confirm-dialog';
import StatusBadge from '$lib/components/badges/status-badge.svelte';
@@ -16,7 +16,7 @@
import { UniversalMobileCard } from '$lib/components/arcane-table';
import { m } from '$lib/paraglide/messages';
import { roleService } from '$lib/services/role-service';
- import { ShieldAlertIcon, TrashIcon, EditIcon, EllipsisIcon } from '$lib/icons';
+ import { ShieldAlertIcon, TrashIcon, EditIcon } from '$lib/icons';
import userStore from '$lib/stores/user-store';
import IfPermitted from '$lib/components/if-permitted.svelte';
@@ -250,37 +250,25 @@
{#snippet RowActions({ item }: { item: Role })}
{#if isAdmin}
- <DropdownMenu.Root>
- <DropdownMenu.Trigger>
- {#snippet child({ props })}
- <ArcaneButton {...props} action="base" tone="ghost" size="icon" class="size-8">
- <span class="sr-only">{m.common_open_menu()}</span>
- <EllipsisIcon class="size-4" />
- </ArcaneButton>
- {/snippet}
- </DropdownMenu.Trigger>
- <DropdownMenu.Content align="end">
- <DropdownMenu.Group>
- <IfPermitted adminOnly>
- <DropdownMenu.Item onclick={() => goto(`/settings/roles/${item.id}`)}>
- <EditIcon class="size-4" />
- {m.common_edit()}
- </DropdownMenu.Item>
-
- <DropdownMenu.Separator />
-
- <DropdownMenu.Item
- variant="destructive"
- disabled={item.builtIn || isLoading.removing}
- onclick={() => handleDeleteRole(item)}
- >
- <TrashIcon class="size-4" />
- {m.common_delete()}
- </DropdownMenu.Item>
- </IfPermitted>
- </DropdownMenu.Group>
- </DropdownMenu.Content>
- </DropdownMenu.Root>
+ <RowActionsMenu>
+ <IfPermitted adminOnly>
+ <DropdownMenu.Item onclick={() => goto(`/settings/roles/${item.id}`)}>
+ <EditIcon class="size-4" />
+ {m.common_edit()}
+ </DropdownMenu.Item>
+
+ <DropdownMenu.Separator />
+
+ <DropdownMenu.Item
+ variant="destructive"
+ disabled={item.builtIn || isLoading.removing}
+ onclick={() => handleDeleteRole(item)}
+ >
+ <TrashIcon class="size-4" />
+ {m.common_delete()}
+ </DropdownMenu.Item>
+ </IfPermitted>
+ </RowActionsMenu>
{/if}
{/snippet}
diff --git a/frontend/src/routes/(app)/settings/users/user-table.svelte b/frontend/src/routes/(app)/settings/users/user-table.svelte
index 8e427a6b0..d9977e2d9 100644
--- a/frontend/src/routes/(app)/settings/users/user-table.svelte
+++ b/frontend/src/routes/(app)/settings/users/user-table.svelte
@@ -1,8 +1,8 @@
<script lang="ts">
import ArcaneTable from '$lib/components/arcane-table/arcane-table.svelte';
- import { ArcaneButton } from '$lib/components/arcane-button/index.js';
import { toast } from 'svelte-sonner';
import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
+ import RowActionsMenu from '$lib/components/arcane-table/row-actions-menu.svelte';
import { openConfirmDialog } from '$lib/components/confirm-dialog';
import StatusBadge from '$lib/components/badges/status-badge.svelte';
import { handleApiResultWithCallbacks } from '$lib/utils/api';
@@ -15,7 +15,7 @@
import { UniversalMobileCard } from '$lib/components/arcane-table';
import { m } from '$lib/paraglide/messages';
import { userService } from '$lib/services/user-service';
- import { UserIcon, TrashIcon, EditIcon, EllipsisIcon } from '$lib/icons';
+ import { UserIcon, TrashIcon, EditIcon } from '$lib/icons';
import IfPermitted from '$lib/components/if-permitted.svelte';
let {
@@ -262,41 +262,29 @@
{/snippet}
{#snippet RowActions({ item }: { item: User })}
- <DropdownMenu.Root>
- <DropdownMenu.Trigger>
- {#snippet child({ props })}
- <ArcaneButton {...props} action="base" tone="ghost" size="icon" class="size-8">
- <span class="sr-only">{m.common_open_menu()}</span>
- <EllipsisIcon class="size-4" />
- </ArcaneButton>
- {/snippet}
- </DropdownMenu.Trigger>
- <DropdownMenu.Content align="end">
- <DropdownMenu.Group>
- {#if !item.oidcSubjectId}
- <IfPermitted perm="users:update">
- <DropdownMenu.Item onclick={() => onEditUser(item)}>
- <EditIcon class="size-4" />
- {m.common_edit()}
- </DropdownMenu.Item>
-
- <DropdownMenu.Separator />
- </IfPermitted>
- {/if}
-
- <IfPermitted perm="users:delete">
- <DropdownMenu.Item
- variant="destructive"
- disabled={!canDeleteUser(item) || isLoading.removing}
- onclick={() => handleDeleteUser(item)}
- >
- <TrashIcon class="size-4" />
- {m.common_delete()}
- </DropdownMenu.Item>
- </IfPermitted>
- </DropdownMenu.Group>
- </DropdownMenu.Content>
- </DropdownMenu.Root>
+ <RowActionsMenu>
+ {#if !item.oidcSubjectId}
+ <IfPermitted perm="users:update">
+ <DropdownMenu.Item onclick={() => onEditUser(item)}>
+ <EditIcon class="size-4" />
+ {m.common_edit()}
+ </DropdownMenu.Item>
+
+ <DropdownMenu.Separator />
+ </IfPermitted>
+ {/if}
+
+ <IfPermitted perm="users:delete">
+ <DropdownMenu.Item
+ variant="destructive"
+ disabled={!canDeleteUser(item) || isLoading.removing}
+ onclick={() => handleDeleteUser(item)}
+ >
+ <TrashIcon class="size-4" />
+ {m.common_delete()}
+ </DropdownMenu.Item>
+ </IfPermitted>
+ </RowActionsMenu>
{/snippet}
<ArcaneTable
diff --git a/frontend/src/routes/(app)/settings/webhooks/webhook-table.svelte b/frontend/src/routes/(app)/settings/webhooks/webhook-table.svelte
index 2b2d35837..277c04f3a 100644
--- a/frontend/src/routes/(app)/settings/webhooks/webhook-table.svelte
+++ b/frontend/src/routes/(app)/settings/webhooks/webhook-table.svelte
@@ -2,9 +2,9 @@
import ArcaneTable from '$lib/components/arcane-table/arcane-table.svelte';
import { UniversalMobileCard } from '$lib/components/arcane-table';
import type { ColumnSpec, MobileFieldVisibility } from '$lib/components/arcane-table';
- import { ArcaneButton } from '$lib/components/arcane-button/index.js';
import StatusBadge from '$lib/components/badges/status-badge.svelte';
import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
+ import RowActionsMenu from '$lib/components/arcane-table/row-actions-menu.svelte';
import { CopyButton } from '$lib/components/ui/copy-button';
import { toast } from 'svelte-sonner';
import { openConfirmDialog } from '$lib/components/confirm-dialog';
@@ -13,7 +13,7 @@
import type { Webhook } from '$lib/types/environment';
import type { Paginated, SearchPaginationSortRequest } from '$lib/types/shared';
import { webhookService } from '$lib/services/webhook-service';
- import { TrashIcon, EllipsisIcon, GlobeIcon } from '$lib/icons';
+ import { TrashIcon, GlobeIcon } from '$lib/icons';
import * as m from '$lib/paraglide/messages.js';
import IfPermitted from '$lib/components/if-permitted.svelte';
@@ -288,30 +288,18 @@
{/snippet}
{#snippet RowActions({ item }: { item: Webhook })}
- <DropdownMenu.Root>
- <DropdownMenu.Trigger>
- {#snippet child({ props })}
- <ArcaneButton {...props} action="base" tone="ghost" size="icon" class="size-8">
- <span class="sr-only">{m.common_open_menu()}</span>
- <EllipsisIcon class="size-4" />
- </ArcaneButton>
- {/snippet}
- </DropdownMenu.Trigger>
- <DropdownMenu.Content align="end">
- <DropdownMenu.Group>
- <IfPermitted perm="webhooks:update">
- <DropdownMenu.Item onclick={() => handleToggleWebhook(item)} disabled={isLoading.toggling}>
- {item.enabled ? m.webhook_disable() : m.webhook_enable()}
- </DropdownMenu.Item>
- </IfPermitted>
- <DropdownMenu.Separator />
- <IfPermitted perm="webhooks:delete">
- <DropdownMenu.Item variant="destructive" onclick={() => handleDeleteWebhook(item.id, item.name)}>
- <TrashIcon class="size-4" />
- {m.common_delete()}
- </DropdownMenu.Item>
- </IfPermitted>
- </DropdownMenu.Group>
- </DropdownMenu.Content>
- </DropdownMenu.Root>
+ <RowActionsMenu>
+ <IfPermitted perm="webhooks:update">
+ <DropdownMenu.Item onclick={() => handleToggleWebhook(item)} disabled={isLoading.toggling}>
+ {item.enabled ? m.webhook_disable() : m.webhook_enable()}
+ </DropdownMenu.Item>
+ </IfPermitted>
+ <DropdownMenu.Separator />
+ <IfPermitted perm="webhooks:delete">
+ <DropdownMenu.Item variant="destructive" onclick={() => handleDeleteWebhook(item.id, item.name)}>
+ <TrashIcon class="size-4" />
+ {m.common_delete()}
+ </DropdownMenu.Item>
+ </IfPermitted>
+ </RowActionsMenu>
{/snippet}
diff --git a/frontend/src/routes/(app)/swarm/nodes/nodes-table.svelte b/frontend/src/routes/(app)/swarm/nodes/nodes-table.svelte
index 2503f4253..222d8813a 100644
--- a/frontend/src/routes/(app)/swarm/nodes/nodes-table.svelte
+++ b/frontend/src/routes/(app)/swarm/nodes/nodes-table.svelte
@@ -5,7 +5,6 @@
import {
UsersIcon,
EnvironmentsIcon,
- EllipsisIcon,
InspectIcon,
TrashIcon,
EdgeConnectionIcon,
@@ -20,7 +19,7 @@
import StatusBadge from '$lib/components/badges/status-badge.svelte';
import { capitalizeFirstLetter } from '$lib/utils/formatting';
import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
- import { ArcaneButton } from '$lib/components/arcane-button/index.js';
+ import RowActionsMenu from '$lib/components/arcane-table/row-actions-menu.svelte';
import { openConfirmDialog } from '$lib/components/confirm-dialog';
import { toast } from 'svelte-sonner';
import { tryCatch } from '$lib/utils/api';
@@ -362,52 +361,40 @@
{/snippet}
{#snippet RowActions({ item }: { item: SwarmNodeSummary })}
- <DropdownMenu.Root>
- <DropdownMenu.Trigger>
- {#snippet child({ props })}
- <ArcaneButton {...props} action="base" tone="ghost" size="icon" class="relative size-8 p-0">
- <span class="sr-only">{m.common_open_menu()}</span>
- <EllipsisIcon />
- </ArcaneButton>
- {/snippet}
- </DropdownMenu.Trigger>
- <DropdownMenu.Content align="end">
- <DropdownMenu.Group>
- <DropdownMenu.Item onclick={() => inspectNodeTasks(item)}>
- <InspectIcon class="size-4" />
- {m.common_inspect()}
- </DropdownMenu.Item>
- <DropdownMenu.Item onclick={() => openAgentDialog(item)} disabled={!canManageNodes}>
- <EdgeConnectionIcon class="size-4" />
- {getSwarmNodeAgentActionLabel(item.agent?.state)}
- </DropdownMenu.Item>
- <DropdownMenu.Separator />
- <DropdownMenu.Item onclick={() => promoteNode(item)} disabled={!canManageNodes || isLoading || item.role === 'manager'}>
- {m.swarm_node_promote()}
- </DropdownMenu.Item>
- <DropdownMenu.Item onclick={() => demoteNode(item)} disabled={!canManageNodes || isLoading || item.role !== 'manager'}>
- {m.swarm_node_demote()}
- </DropdownMenu.Item>
- <DropdownMenu.Item
- onclick={() => setAvailability(item, 'drain')}
- disabled={!canManageNodes || isLoading || item.availability === 'drain'}
- >
- {m.swarm_node_drain()}
- </DropdownMenu.Item>
- <DropdownMenu.Item
- onclick={() => setAvailability(item, 'active')}
- disabled={!canManageNodes || isLoading || item.availability === 'active'}
- >
- {m.swarm_node_activate()}
- </DropdownMenu.Item>
- <DropdownMenu.Separator />
- <DropdownMenu.Item variant="destructive" onclick={() => removeNode(item)} disabled={!canManageNodes || isLoading}>
- <TrashIcon class="size-4" />
- {m.common_delete()}
- </DropdownMenu.Item>
- </DropdownMenu.Group>
- </DropdownMenu.Content>
- </DropdownMenu.Root>
+ <RowActionsMenu triggerClass="relative size-8 p-0" iconClass="">
+ <DropdownMenu.Item onclick={() => inspectNodeTasks(item)}>
+ <InspectIcon class="size-4" />
+ {m.common_inspect()}
+ </DropdownMenu.Item>
+ <DropdownMenu.Item onclick={() => openAgentDialog(item)} disabled={!canManageNodes}>
+ <EdgeConnectionIcon class="size-4" />
+ {getSwarmNodeAgentActionLabel(item.agent?.state)}
+ </DropdownMenu.Item>
+ <DropdownMenu.Separator />
+ <DropdownMenu.Item onclick={() => promoteNode(item)} disabled={!canManageNodes || isLoading || item.role === 'manager'}>
+ {m.swarm_node_promote()}
+ </DropdownMenu.Item>
+ <DropdownMenu.Item onclick={() => demoteNode(item)} disabled={!canManageNodes || isLoading || item.role !== 'manager'}>
+ {m.swarm_node_demote()}
+ </DropdownMenu.Item>
+ <DropdownMenu.Item
+ onclick={() => setAvailability(item, 'drain')}
+ disabled={!canManageNodes || isLoading || item.availability === 'drain'}
+ >
+ {m.swarm_node_drain()}
+ </DropdownMenu.Item>
+ <DropdownMenu.Item
+ onclick={() => setAvailability(item, 'active')}
+ disabled={!canManageNodes || isLoading || item.availability === 'active'}
+ >
+ {m.swarm_node_activate()}
+ </DropdownMenu.Item>
+ <DropdownMenu.Separator />
+ <DropdownMenu.Item variant="destructive" onclick={() => removeNode(item)} disabled={!canManageNodes || isLoading}>
+ <TrashIcon class="size-4" />
+ {m.common_delete()}
+ </DropdownMenu.Item>
+ </RowActionsMenu>
{/snippet}
<ArcaneTable
diff --git a/frontend/src/routes/(app)/swarm/nodes/swarm-node-agent-dialog.svelte b/frontend/src/routes/(app)/swarm/nodes/swarm-node-agent-dialog.svelte
index a12a8a9f2..4e6eec9cc 100644
--- a/frontend/src/routes/(app)/swarm/nodes/swarm-node-agent-dialog.svelte
+++ b/frontend/src/routes/(app)/swarm/nodes/swarm-node-agent-dialog.svelte
@@ -1,7 +1,7 @@
<script lang="ts">
import * as Alert from '$lib/components/ui/alert';
import { ArcaneButton } from '$lib/components/arcane-button';
- import { CopyButton } from '$lib/components/ui/copy-button';
+ import AgentCommandBlock from '$lib/components/agent-command-block.svelte';
import * as ResponsiveDialog from '$lib/components/ui/responsive-dialog';
import { Spinner } from '$lib/components/ui/spinner';
import StatusBadge from '$lib/components/badges/status-badge.svelte';
@@ -79,25 +79,13 @@
</div>
{:else if isReady && deployment}
<div class="space-y-4">
- <div class="space-y-2">
- <div class="text-sm font-medium">{m.environments_docker_run_command()}</div>
- <div class="relative">
- <pre class="bg-muted overflow-x-auto rounded-md p-3 pr-12 text-xs"><code>{deployment.dockerRun}</code></pre>
- <div class="absolute top-2 right-2">
- <CopyButton text={deployment.dockerRun} size="icon" class="size-7" />
- </div>
- </div>
- </div>
-
- <div class="space-y-2">
- <div class="text-sm font-medium">{m.environments_docker_compose()}</div>
- <div class="relative">
- <pre class="bg-muted overflow-x-auto rounded-md p-3 pr-12 text-xs"><code>{deployment.dockerCompose}</code></pre>
- <div class="absolute top-2 right-2">
- <CopyButton text={deployment.dockerCompose} size="icon" class="size-7" />
- </div>
- </div>
- </div>
+ <AgentCommandBlock
+ dockerRunLabel={m.environments_docker_run_command()}
+ dockerRun={deployment.dockerRun}
+ dockerComposeLabel={m.environments_docker_compose()}
+ dockerCompose={deployment.dockerCompose}
+ preClass="pr-12"
+ />
</div>
{/if}
</div>
diff --git a/frontend/src/routes/(app)/swarm/services/+page.svelte b/frontend/src/routes/(app)/swarm/services/+page.svelte
index 6b34bcdc6..f6cd9b4d7 100644
--- a/frontend/src/routes/(app)/swarm/services/+page.svelte
+++ b/frontend/src/routes/(app)/swarm/services/+page.svelte
@@ -12,7 +12,7 @@
import { createRefreshActionButtons } from '$lib/utils/resource-actions';
import type { SwarmServiceCreateSpec } from '$lib/types/swarm';
import SwarmServicesTable from './services-table.svelte';
- import CreateServiceDialog from '$lib/components/dialogs/create-service-dialog.svelte';
+ import ServiceEditorDialog from '$lib/components/dialogs/service-editor-dialog.svelte';
import { hasPermission } from '$lib/utils/auth';
import { environmentStore } from '$lib/stores/environment.store.svelte';
@@ -45,7 +45,8 @@
const currentEnvId = $derived(environmentStore.selected?.id);
const canCreateService = $derived(hasPermission('swarm:services', currentEnvId));
- async function handleCreateService(spec: SwarmServiceCreateSpec) {
+ async function handleCreateService(payload: { spec: Record<string, unknown>; options?: Record<string, unknown> }) {
+ const spec = payload.spec as unknown as SwarmServiceCreateSpec;
handleApiResultWithCallbacks({
result: await tryCatch(swarmService.createService({ spec })),
message: m.common_create_failed({ resource: `${m.swarm_service()} "${spec.Name}"` }),
@@ -79,7 +80,18 @@
]);
</script>
-<CreateServiceDialog bind:open={showCreateDialog} onSubmit={handleCreateService} isLoading={isLoading.creating} />
+{#if showCreateDialog}
+ <ServiceEditorDialog
+ bind:open={showCreateDialog}
+ title={m.swarm_service_create_title()}
+ description={m.swarm_service_create_description()}
+ submitLabel={m.common_create()}
+ submitAction="create"
+ initialSpec=""
+ isLoading={isLoading.creating}
+ onSubmit={handleCreateService}
+ />
+{/if}
<ResourcePageLayout title={m.swarm_services_title()} subtitle={m.swarm_services_subtitle()} {actionButtons} {statCards}>
{#snippet mainContent()}
diff --git a/frontend/src/routes/(app)/swarm/services/[serviceId]/+page.svelte b/frontend/src/routes/(app)/swarm/services/[serviceId]/+page.svelte
index 66523367f..494364e74 100644
--- a/frontend/src/routes/(app)/swarm/services/[serviceId]/+page.svelte
+++ b/frontend/src/routes/(app)/swarm/services/[serviceId]/+page.svelte
@@ -24,7 +24,7 @@
SwarmServicePort,
SwarmServiceModeSpec
} from '$lib/types/swarm';
- import ServiceEditorDialog from '../service-editor-dialog.svelte';
+ import ServiceEditorDialog from '$lib/components/dialogs/service-editor-dialog.svelte';
import ServiceOverview from '../components/ServiceOverview.svelte';
import ServiceLogsPanel from '../components/ServiceLogsPanel.svelte';
import ServiceTasksPanel from '../components/ServiceTasksPanel.svelte';
@@ -32,9 +32,8 @@
import ServiceNetwork from '../components/ServiceNetwork.svelte';
import ServiceStorage from '../components/ServiceStorage.svelte';
import { Input } from '$lib/components/ui/input/index.js';
+ import ResourceNotFound from '$lib/components/resource-not-found.svelte';
import {
- ArrowLeftIcon,
- AlertIcon,
DockIcon,
FileTextIcon,
JobsIcon,
@@ -400,26 +399,10 @@
/>
{/if}
{:else}
- <div class="flex min-h-screen items-center justify-center">
- <div class="text-center">
- <div class="bg-muted/50 mb-6 inline-flex rounded-full p-6">
- <AlertIcon class="text-muted-foreground size-10" />
- </div>
- <h2 class="mb-3 text-2xl font-medium">
- {m.common_not_found_title({ resource: m.swarm_service() })}
- </h2>
- <p class="text-muted-foreground mb-8 max-w-md text-center">
- {m.common_not_found_description({ resource: m.swarm_service().toLowerCase() })}
- </p>
- <div class="flex justify-center gap-4">
- <ArcaneButton action="base" href="/swarm/services">
- <ArrowLeftIcon class="size-4" />
- {m.common_back_to({ resource: m.swarm_services_title() })}
- </ArcaneButton>
- <ArcaneButton action="refresh" onclick={refreshData}>
- {m.common_retry()}
- </ArcaneButton>
- </div>
- </div>
- </div>
+ <ResourceNotFound
+ resource={m.swarm_service()}
+ resourceListTitle={m.swarm_services_title()}
+ backHref="/swarm/services"
+ onRetry={refreshData}
+ />
{/if}
diff --git a/frontend/src/routes/(app)/swarm/services/components/ServiceConfiguration.svelte b/frontend/src/routes/(app)/swarm/services/components/ServiceConfiguration.svelte
index e9c722389..ce18f8e82 100644
--- a/frontend/src/routes/(app)/swarm/services/components/ServiceConfiguration.svelte
+++ b/frontend/src/routes/(app)/swarm/services/components/ServiceConfiguration.svelte
@@ -3,6 +3,7 @@
import { m } from '$lib/paraglide/messages';
import { SettingsIcon, TagIcon } from '$lib/icons';
import { KeyValueCard, KeyValueGrid } from '$lib/components/resource-detail';
+ import EnvVarsList from '$lib/components/env-vars-list.svelte';
interface Props {
envVars: string[];
@@ -31,22 +32,7 @@
</div>
</Card.Header>
<Card.Content class="p-4">
- <KeyValueGrid>
- {#each envVars as env, index (index)}
- {#if env.includes('=')}
- {@const [key, ...valueParts] = env.split('=')}
- {@const value = valueParts.join('=')}
- <KeyValueCard label={key ?? ''}>{value}</KeyValueCard>
- {:else}
- <KeyValueCard
- label={m.common_name()}
- labelClass="text-muted-foreground text-xs font-semibold tracking-wide uppercase"
- >
- {env}
- </KeyValueCard>
- {/if}
- {/each}
- </KeyValueGrid>
+ <EnvVarsList {envVars} nameOnlyLabel={m.common_name()} />
</Card.Content>
</Card.Root>
{/if}
diff --git a/frontend/src/routes/(app)/swarm/services/components/ServiceLogsPanel.svelte b/frontend/src/routes/(app)/swarm/services/components/ServiceLogsPanel.svelte
index 1e041bbca..30bd73d97 100644
--- a/frontend/src/routes/(app)/swarm/services/components/ServiceLogsPanel.svelte
+++ b/frontend/src/routes/(app)/swarm/services/components/ServiceLogsPanel.svelte
@@ -2,6 +2,7 @@
import * as Card from '$lib/components/ui/card';
import LogViewer from '$lib/components/logs/log-viewer.svelte';
import LogControls from '$lib/components/logs/log-controls.svelte';
+ import LogPanelTitle from '$lib/components/logs/log-panel-title.svelte';
import { m } from '$lib/paraglide/messages';
import { refreshLogViewerStream, startLogViewerStream, stopLogViewerStream } from '$lib/utils/log-viewer';
import { FileTextIcon } from '$lib/icons';
@@ -49,17 +50,7 @@
<Card.Header icon={FileTextIcon}>
<div class="flex flex-1 flex-col gap-4 sm:flex-row sm:items-start sm:justify-between">
<div class="flex flex-col gap-1.5">
- <div class="flex items-center gap-2">
- <Card.Title>
- <h2>{m.swarm_service_logs_title()}</h2>
- </Card.Title>
- {#if isStreaming}
- <div class="flex items-center gap-2">
- <div class="size-2 animate-pulse rounded-full bg-green-500"></div>
- <span class="text-xs font-semibold text-green-600 sm:text-sm">{m.common_live()}</span>
- </div>
- {/if}
- </div>
+ <LogPanelTitle title={m.swarm_service_logs_title()} live={isStreaming} />
</div>
<LogControls
bind:autoScroll
diff --git a/frontend/src/routes/(app)/swarm/services/components/ServiceNetwork.svelte b/frontend/src/routes/(app)/swarm/services/components/ServiceNetwork.svelte
index 07f99b8d7..d21cbe7d3 100644
--- a/frontend/src/routes/(app)/swarm/services/components/ServiceNetwork.svelte
+++ b/frontend/src/routes/(app)/swarm/services/components/ServiceNetwork.svelte
@@ -46,6 +46,47 @@
});
</script>
+{#snippet IpamConfigList(
+ configs: NonNullable<NonNullable<ServiceNetworkDetail['configNetwork']>['ipv4Configs']>,
+ heading: string
+)}
+ {#each configs as cfg (`${cfg.subnet ?? ''}:${cfg.gateway ?? ''}:${cfg.ipRange ?? ''}`)}
+ <div class="bg-muted/30 space-y-1 rounded-lg p-2.5">
+ <div class="text-muted-foreground mb-1 text-xs font-semibold">{heading}</div>
+ {#if cfg.subnet}
+ <div class="flex flex-col sm:flex-row sm:items-center">
+ <span class="text-muted-foreground w-full text-sm font-medium sm:w-16">{m.common_subnet()}:</span>
+ <code
+ class="bg-muted text-muted-foreground cursor-pointer rounded px-1.5 py-0.5 font-mono text-xs break-all select-all sm:text-sm"
+ >
+ {cfg.subnet}
+ </code>
+ </div>
+ {/if}
+ {#if cfg.gateway}
+ <div class="flex flex-col sm:flex-row sm:items-center">
+ <span class="text-muted-foreground w-full text-sm font-medium sm:w-16">{m.common_gateway()}:</span>
+ <code
+ class="bg-muted text-muted-foreground cursor-pointer rounded px-1.5 py-0.5 font-mono text-xs break-all select-all sm:text-sm"
+ >
+ {cfg.gateway}
+ </code>
+ </div>
+ {/if}
+ {#if cfg.ipRange}
+ <div class="flex flex-col sm:flex-row sm:items-center">
+ <span class="text-muted-foreground w-full text-sm font-medium sm:w-16">{m.networks_ipam_iprange_label()}:</span>
+ <code
+ class="bg-muted text-muted-foreground cursor-pointer rounded px-1.5 py-0.5 font-mono text-xs break-all select-all sm:text-sm"
+ >
+ {cfg.ipRange}
+ </code>
+ </div>
+ {/if}
+ </div>
+ {/each}
+{/snippet}
+
<div class="space-y-6">
<Card.Root>
<Card.Header icon={GlobeIcon}>
@@ -203,90 +244,10 @@
</div>
<div class="grid grid-cols-1 gap-3 sm:grid-cols-2">
{#if info.configNetwork.ipv4Configs && info.configNetwork.ipv4Configs.length > 0}
- {#each info.configNetwork.ipv4Configs as cfg (`${cfg.subnet ?? ''}:${cfg.gateway ?? ''}:${cfg.ipRange ?? ''}`)}
- <div class="bg-muted/30 space-y-1 rounded-lg p-2.5">
- <div class="text-muted-foreground mb-1 text-xs font-semibold">{m.ipv4_enabled()}</div>
- {#if cfg.subnet}
- <div class="flex flex-col sm:flex-row sm:items-center">
- <span class="text-muted-foreground w-full text-sm font-medium sm:w-16"
- >{m.common_subnet()}:</span
- >
- <code
- class="bg-muted text-muted-foreground cursor-pointer rounded px-1.5 py-0.5 font-mono text-xs break-all select-all sm:text-sm"
- >
- {cfg.subnet}
- </code>
- </div>
- {/if}
- {#if cfg.gateway}
- <div class="flex flex-col sm:flex-row sm:items-center">
- <span class="text-muted-foreground w-full text-sm font-medium sm:w-16"
- >{m.common_gateway()}:</span
- >
- <code
- class="bg-muted text-muted-foreground cursor-pointer rounded px-1.5 py-0.5 font-mono text-xs break-all select-all sm:text-sm"
- >
- {cfg.gateway}
- </code>
- </div>
- {/if}
- {#if cfg.ipRange}
- <div class="flex flex-col sm:flex-row sm:items-center">
- <span class="text-muted-foreground w-full text-sm font-medium sm:w-16"
- >{m.networks_ipam_iprange_label()}:</span
- >
- <code
- class="bg-muted text-muted-foreground cursor-pointer rounded px-1.5 py-0.5 font-mono text-xs break-all select-all sm:text-sm"
- >
- {cfg.ipRange}
- </code>
- </div>
- {/if}
- </div>
- {/each}
+ {@render IpamConfigList(info.configNetwork.ipv4Configs, m.ipv4_enabled())}
{/if}
{#if info.configNetwork.ipv6Configs && info.configNetwork.ipv6Configs.length > 0}
- {#each info.configNetwork.ipv6Configs as cfg (`${cfg.subnet ?? ''}:${cfg.gateway ?? ''}:${cfg.ipRange ?? ''}`)}
- <div class="bg-muted/30 space-y-1 rounded-lg p-2.5">
- <div class="text-muted-foreground mb-1 text-xs font-semibold">{m.ipv6_enabled()}</div>
- {#if cfg.subnet}
- <div class="flex flex-col sm:flex-row sm:items-center">
- <span class="text-muted-foreground w-full text-sm font-medium sm:w-16"
- >{m.common_subnet()}:</span
- >
- <code
- class="bg-muted text-muted-foreground cursor-pointer rounded px-1.5 py-0.5 font-mono text-xs break-all select-all sm:text-sm"
- >
- {cfg.subnet}
- </code>
- </div>
- {/if}
- {#if cfg.gateway}
- <div class="flex flex-col sm:flex-row sm:items-center">
- <span class="text-muted-foreground w-full text-sm font-medium sm:w-16"
- >{m.common_gateway()}:</span
- >
- <code
- class="bg-muted text-muted-foreground cursor-pointer rounded px-1.5 py-0.5 font-mono text-xs break-all select-all sm:text-sm"
- >
- {cfg.gateway}
- </code>
- </div>
- {/if}
- {#if cfg.ipRange}
- <div class="flex flex-col sm:flex-row sm:items-center">
- <span class="text-muted-foreground w-full text-sm font-medium sm:w-16"
- >{m.networks_ipam_iprange_label()}:</span
- >
- <code
- class="bg-muted text-muted-foreground cursor-pointer rounded px-1.5 py-0.5 font-mono text-xs break-all select-all sm:text-sm"
- >
- {cfg.ipRange}
- </code>
- </div>
- {/if}
- </div>
- {/each}
+ {@render IpamConfigList(info.configNetwork.ipv6Configs, m.ipv6_enabled())}
{/if}
</div>
</Card.Content>
diff --git a/frontend/src/routes/(app)/swarm/services/components/ServiceOverview.svelte b/frontend/src/routes/(app)/swarm/services/components/ServiceOverview.svelte
index 003e58739..430d8ce4d 100644
--- a/frontend/src/routes/(app)/swarm/services/components/ServiceOverview.svelte
+++ b/frontend/src/routes/(app)/swarm/services/components/ServiceOverview.svelte
@@ -7,6 +7,7 @@
import { InfoIcon, ConnectionIcon } from '$lib/icons';
import { truncateImageDigest } from '$lib/utils/formatting';
import { getSwarmServiceModeLabel, getSwarmServiceModeVariant, isSwarmServiceModeScalable } from '$lib/utils/docker';
+ import { KeyValueCard } from '$lib/components/resource-detail';
interface Props {
service: SwarmServiceInspect;
@@ -112,16 +113,7 @@
</Card.Content>
</Card.Root>
- <Card.Root variant="subtle">
- <Card.Content class="flex flex-col gap-2 p-4">
- <div class="text-muted-foreground text-xs font-semibold tracking-wide uppercase">
- {m.common_id()}
- </div>
- <div class="text-foreground cursor-pointer font-mono text-sm font-medium break-all select-all">
- {service.id}
- </div>
- </Card.Content>
- </Card.Root>
+ <KeyValueCard label={m.common_id()}>{service.id}</KeyValueCard>
<Card.Root variant="subtle">
<Card.Content class="flex flex-col gap-2 p-4">
diff --git a/frontend/src/routes/(app)/swarm/services/services-table.svelte b/frontend/src/routes/(app)/swarm/services/services-table.svelte
index 562c96bcc..58bf0631e 100644
--- a/frontend/src/routes/(app)/swarm/services/services-table.svelte
+++ b/frontend/src/routes/(app)/swarm/services/services-table.svelte
@@ -2,14 +2,14 @@
import ArcaneTable from '$lib/components/arcane-table/arcane-table.svelte';
import type { ColumnSpec, MobileFieldVisibility } from '$lib/components/arcane-table';
import { UniversalMobileCard } from '$lib/components/arcane-table';
- import { DockIcon, GlobeIcon, EllipsisIcon, TrashIcon, NetworksIcon, InspectIcon } from '$lib/icons';
+ import { DockIcon, GlobeIcon, TrashIcon, NetworksIcon, InspectIcon } from '$lib/icons';
import { m } from '$lib/paraglide/messages';
import { swarmService } from '$lib/services/swarm-service';
import type { SwarmServiceSummary, SwarmServicePort } from '$lib/types/swarm';
import type { Paginated, SearchPaginationSortRequest } from '$lib/types/shared';
import StatusBadge from '$lib/components/badges/status-badge.svelte';
import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
- import { ArcaneButton } from '$lib/components/arcane-button/index.js';
+ import RowActionsMenu from '$lib/components/arcane-table/row-actions-menu.svelte';
import { openConfirmDialog } from '$lib/components/confirm-dialog';
import { toast } from 'svelte-sonner';
import { tryCatch } from '$lib/utils/api';
@@ -233,31 +233,19 @@
{/snippet}
{#snippet RowActions({ item }: { item: SwarmServiceSummary })}
- <DropdownMenu.Root>
- <DropdownMenu.Trigger>
- {#snippet child({ props })}
- <ArcaneButton {...props} action="base" tone="ghost" size="icon" class="relative size-8 p-0">
- <span class="sr-only">{m.common_open_menu()}</span>
- <EllipsisIcon />
- </ArcaneButton>
- {/snippet}
- </DropdownMenu.Trigger>
- <DropdownMenu.Content align="end">
- <DropdownMenu.Group>
- <DropdownMenu.Item onclick={() => inspectService(item)}>
- <InspectIcon class="size-4" />
- {m.common_inspect()}
- </DropdownMenu.Item>
- <DropdownMenu.Separator />
- <IfPermitted perm="swarm:services">
- <DropdownMenu.Item variant="destructive" onclick={() => handleDelete(item)} disabled={isAnyLoading}>
- <TrashIcon class="size-4" />
- {m.common_delete()}
- </DropdownMenu.Item>
- </IfPermitted>
- </DropdownMenu.Group>
- </DropdownMenu.Content>
- </DropdownMenu.Root>
+ <RowActionsMenu triggerClass="relative size-8 p-0" iconClass="">
+ <DropdownMenu.Item onclick={() => inspectService(item)}>
+ <InspectIcon class="size-4" />
+ {m.common_inspect()}
+ </DropdownMenu.Item>
+ <DropdownMenu.Separator />
+ <IfPermitted perm="swarm:services">
+ <DropdownMenu.Item variant="destructive" onclick={() => handleDelete(item)} disabled={isAnyLoading}>
+ <TrashIcon class="size-4" />
+ {m.common_delete()}
+ </DropdownMenu.Item>
+ </IfPermitted>
+ </RowActionsMenu>
{/snippet}
<ArcaneTable
diff --git a/frontend/src/routes/(app)/swarm/stacks/new/+page.svelte b/frontend/src/routes/(app)/swarm/stacks/new/+page.svelte
index 52c412818..fa7729716 100644
--- a/frontend/src/routes/(app)/swarm/stacks/new/+page.svelte
+++ b/frontend/src/routes/(app)/swarm/stacks/new/+page.svelte
@@ -1,25 +1,14 @@
<script lang="ts">
import { ArcaneButton } from '$lib/components/arcane-button/index.js';
- import { Spinner } from '$lib/components/ui/spinner/index.js';
import { goto, invalidateAll } from '$app/navigation';
import { toast } from 'svelte-sonner';
import { preventDefault, createForm } from '$lib/utils/settings';
- import * as ArcaneTooltip from '$lib/components/arcane-tooltip';
import TemplateSelectionDialog from '$lib/components/dialogs/template-selection-dialog.svelte';
import { m } from '$lib/paraglide/messages';
import { swarmService } from '$lib/services/swarm-service.js';
- import * as ButtonGroup from '$lib/components/ui/button-group/index.js';
- import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
- import {
- ArrowLeftIcon,
- TerminalIcon,
- TemplateIcon,
- AddIcon,
- ArrowDownIcon as ChevronDown,
- FileTextIcon,
- GitBranchIcon,
- SearchIcon
- } from '$lib/icons';
+ import ComposeCreateMenu from '$lib/components/compose-create-menu.svelte';
+ import ComposeFileEditorPanel from '$lib/components/compose-file-editor-panel.svelte';
+ import { ArrowLeftIcon } from '$lib/icons';
import CodePanel from '../../../projects/components/CodePanel.svelte';
import EditableName from '../../../projects/components/EditableName.svelte';
import EditorTabStrip from '../../../projects/components/EditorTabStrip.svelte';
@@ -31,10 +20,7 @@
import {
createComposeEditorSchema,
createComposeTemplateDialogFlow,
- dropdownContentClass,
- dropdownItemClass,
submitComposeResourceForm,
- templateBtnClass,
templateNameSlug
} from '$lib/utils/compose-flow';
@@ -194,88 +180,30 @@
</div>
<div class="flex items-center gap-2">
- <ButtonGroup.Root>
- <ArcaneTooltip.Root
- open={!$inputs.name.value && !ui.saving && !ui.converting && !ui.isLoadingTemplateContent ? undefined : false}
- >
- <ArcaneTooltip.Trigger>
- <span>
- <ArcaneButton
- action="create"
- tone="ghost"
- disabled={!canSubmit}
- onclick={() => handleSubmit()}
- class={`${templateBtnClass} gap-2 rounded-r-none`}
- loading={ui.saving}
- customLabel={submitLabel}
- loadingLabel={submitLoadingLabel}
- />
- </span>
- </ArcaneTooltip.Trigger>
- <ArcaneTooltip.Content class="arcane-tooltip-content max-w-[280px]">
- {#if $inputs.name.value === ''}
- <p class="mb-1 text-sm font-medium">{m.compose_project_name_tooltip_title()}</p>
- <p class="text-muted-foreground text-xs">{m.compose_project_name_tooltip_description()}</p>
- <p class="bg-muted mt-1.5 inline-block rounded px-1.5 py-0.5 font-mono text-xs">
- {m.compose_project_name_tooltip_example()}
- </p>
- {/if}
- </ArcaneTooltip.Content>
- </ArcaneTooltip.Root>
-
- <DropdownMenu.Root>
- <DropdownMenu.Trigger>
- {#snippet child({ props })}
- <ArcaneButton
- {...props}
- action="base"
- tone="ghost"
- class={`${templateBtnClass} -ml-px rounded-l-none px-2`}
- icon={ChevronDown}
- />
- {/snippet}
- </DropdownMenu.Trigger>
- <DropdownMenu.Content align="end" class={dropdownContentClass}>
- <DropdownMenu.Group>
- <DropdownMenu.Item
- class={dropdownItemClass}
- disabled={ui.saving || ui.converting || ui.isLoadingTemplateContent}
- onclick={() => (ui.showTemplateDialog = true)}
- >
- <TemplateIcon class="size-4" />
- {m.common_use_template()}
- </DropdownMenu.Item>
- <DropdownMenu.Item class={dropdownItemClass} onclick={() => (ui.showConverterDialog = true)}>
- <TerminalIcon class="size-4" />
- {m.compose_convert_from_docker_run()}
- </DropdownMenu.Item>
- <DropdownMenu.Item
- class={dropdownItemClass}
- onclick={async () =>
- goto(
- `/environments/${await environmentStore.getCurrentEnvironmentId()}/gitops?action=create&targetType=swarm_stack`
- )}
- >
- <GitBranchIcon class="size-4" />
- {m.git_from_git_repo()}
- </DropdownMenu.Item>
- <DropdownMenu.Separator />
- <DropdownMenu.Item
- class={dropdownItemClass}
- disabled={!canSubmit || ui.creatingTemplate}
- onclick={handleCreateTemplate}
- >
- {#if ui.creatingTemplate}
- <Spinner class="size-4" />
- {:else}
- <AddIcon class="size-4" />
- {/if}
- {m.templates_create_template()}
- </DropdownMenu.Item>
- </DropdownMenu.Group>
- </DropdownMenu.Content>
- </DropdownMenu.Root>
- </ButtonGroup.Root>
+ <ComposeCreateMenu
+ tooltipOpen={!$inputs.name.value && !ui.saving && !ui.converting && !ui.isLoadingTemplateContent ? undefined : false}
+ tooltipVisible={$inputs.name.value === ''}
+ tooltipTitle={m.compose_project_name_tooltip_title()}
+ tooltipDescription={m.compose_project_name_tooltip_description()}
+ tooltipExample={m.compose_project_name_tooltip_example()}
+ createDisabled={!canSubmit}
+ createLoading={ui.saving}
+ createLabel={submitLabel}
+ createLoadingLabel={submitLoadingLabel}
+ onCreate={() => handleSubmit()}
+ itemsDisabled={ui.saving || ui.converting || ui.isLoadingTemplateContent}
+ useTemplateLabel={m.common_use_template()}
+ onUseTemplate={() => (ui.showTemplateDialog = true)}
+ convertLabel={m.compose_convert_from_docker_run()}
+ onConvert={() => (ui.showConverterDialog = true)}
+ fromGitLabel={m.git_from_git_repo()}
+ onFromGit={async () =>
+ goto(`/environments/${await environmentStore.getCurrentEnvironmentId()}/gitops?action=create&targetType=swarm_stack`)}
+ createTemplateLabel={m.templates_create_template()}
+ createTemplateDisabled={!canSubmit || ui.creatingTemplate}
+ createTemplateLoading={ui.creatingTemplate}
+ onCreateTemplate={handleCreateTemplate}
+ />
</div>
</div>
</div>
@@ -325,25 +253,13 @@
<div class="flex h-full min-h-0 flex-1 flex-col">
<EditorTabStrip tabs={stackTabs} activeKey={activeStackTab} onSelect={openStackTab} onClose={closeStackTab}>
{#snippet actions()}
- <ArcaneButton
- action="base"
- tone={treeOutlineOpen ? 'outline-primary' : 'ghost'}
- size="icon"
- class="size-6"
- showLabel={false}
- icon={FileTextIcon}
- customLabel={m.compose_editor_toggle_outline()}
- onclick={() => (treeOutlineOpen = !treeOutlineOpen)}
- />
- <ArcaneButton
- action="base"
- tone="ghost"
- size="icon"
- class="size-6"
- showLabel={false}
- icon={SearchIcon}
- customLabel={m.compose_editor_command_palette()}
- onclick={() => (treeCommandPaletteOpen = true)}
+ <ComposeFileEditorPanel
+ outlineOpen={treeOutlineOpen}
+ outlineLabel={m.compose_editor_toggle_outline()}
+ onToggleOutline={() => (treeOutlineOpen = !treeOutlineOpen)}
+ showDiff={false}
+ commandPaletteLabel={m.compose_editor_command_palette()}
+ onOpenCommandPalette={() => (treeCommandPaletteOpen = true)}
/>
{/snippet}
</EditorTabStrip>
diff --git a/frontend/src/routes/(app)/swarm/stacks/stacks-table.svelte b/frontend/src/routes/(app)/swarm/stacks/stacks-table.svelte
index d6d04a469..b20ec8796 100644
--- a/frontend/src/routes/(app)/swarm/stacks/stacks-table.svelte
+++ b/frontend/src/routes/(app)/swarm/stacks/stacks-table.svelte
@@ -2,14 +2,14 @@
import ArcaneTable from '$lib/components/arcane-table/arcane-table.svelte';
import type { ColumnSpec, MobileFieldVisibility } from '$lib/components/arcane-table';
import { UniversalMobileCard } from '$lib/components/arcane-table';
- import { LayersIcon, EllipsisIcon, InspectIcon, TrashIcon } from '$lib/icons';
+ import { LayersIcon, InspectIcon, TrashIcon } from '$lib/icons';
import { m } from '$lib/paraglide/messages';
import { swarmService } from '$lib/services/swarm-service';
import type { SwarmStackSummary } from '$lib/types/swarm';
import type { Paginated, SearchPaginationSortRequest } from '$lib/types/shared';
import { formatDistanceToNow } from 'date-fns';
import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
- import { ArcaneButton } from '$lib/components/arcane-button/index.js';
+ import RowActionsMenu from '$lib/components/arcane-table/row-actions-menu.svelte';
import { openConfirmDialog } from '$lib/components/confirm-dialog';
import { toast } from 'svelte-sonner';
import { tryCatch } from '$lib/utils/api';
@@ -126,31 +126,19 @@
{/snippet}
{#snippet RowActions({ item }: { item: SwarmStackSummary })}
- <DropdownMenu.Root>
- <DropdownMenu.Trigger>
- {#snippet child({ props })}
- <ArcaneButton {...props} action="base" tone="ghost" size="icon" class="relative size-8 p-0">
- <span class="sr-only">{m.common_open_menu()}</span>
- <EllipsisIcon />
- </ArcaneButton>
- {/snippet}
- </DropdownMenu.Trigger>
- <DropdownMenu.Content align="end">
- <DropdownMenu.Group>
- <DropdownMenu.Item onclick={() => inspectStack(item)}>
- <InspectIcon class="size-4" />
- {m.common_inspect()}
- </DropdownMenu.Item>
- <DropdownMenu.Separator />
- <IfPermitted perm="swarm:stacks">
- <DropdownMenu.Item variant="destructive" onclick={() => handleDelete(item)} disabled={isLoading}>
- <TrashIcon class="size-4" />
- {m.common_delete()}
- </DropdownMenu.Item>
- </IfPermitted>
- </DropdownMenu.Group>
- </DropdownMenu.Content>
- </DropdownMenu.Root>
+ <RowActionsMenu triggerClass="relative size-8 p-0" iconClass="">
+ <DropdownMenu.Item onclick={() => inspectStack(item)}>
+ <InspectIcon class="size-4" />
+ {m.common_inspect()}
+ </DropdownMenu.Item>
+ <DropdownMenu.Separator />
+ <IfPermitted perm="swarm:stacks">
+ <DropdownMenu.Item variant="destructive" onclick={() => handleDelete(item)} disabled={isLoading}>
+ <TrashIcon class="size-4" />
+ {m.common_delete()}
+ </DropdownMenu.Item>
+ </IfPermitted>
+ </RowActionsMenu>
{/snippet}
<ArcaneTable
diff --git a/frontend/src/routes/(app)/updates/container-updates-table.svelte b/frontend/src/routes/(app)/updates/container-updates-table.svelte
index a8e71c06d..66b5adf8d 100644
--- a/frontend/src/routes/(app)/updates/container-updates-table.svelte
+++ b/frontend/src/routes/(app)/updates/container-updates-table.svelte
@@ -2,6 +2,8 @@
import ArcaneTable from '$lib/components/arcane-table/arcane-table.svelte';
import { ArcaneButton } from '$lib/components/arcane-button/index.js';
import { UniversalMobileCard, type ColumnSpec, type MobileFieldVisibility } from '$lib/components/arcane-table';
+ import DigestCell from '$lib/components/arcane-table/cells/digest-cell.svelte';
+ import CheckedAtCell from '$lib/components/arcane-table/cells/checked-at-cell.svelte';
import { m } from '$lib/paraglide/messages';
import type { SearchPaginationSortRequest, Paginated } from '$lib/types/shared';
import type { ContainerSummaryDto } from '$lib/types/docker';
@@ -59,9 +61,9 @@
const columns = [
{ accessorKey: 'name', title: m.common_name(), sortable: true, cell: NameCell },
{ accessorKey: 'imageRef', title: m.common_image(), sortable: true, cell: ImageCell },
- { accessorKey: 'currentValue', title: m.image_update_current_label(), sortable: false, cell: DigestCell },
- { accessorKey: 'latestValue', title: m.image_update_latest_digest_label(), sortable: false, cell: DigestCell },
- { accessorKey: 'checkedAt', title: m.common_updated(), sortable: false, cell: CheckedAtCell },
+ { accessorKey: 'currentValue', title: m.image_update_current_label(), sortable: false, cell: DigestCol },
+ { accessorKey: 'latestValue', title: m.image_update_latest_digest_label(), sortable: false, cell: DigestCol },
+ { accessorKey: 'checkedAt', title: m.common_updated(), sortable: false, cell: CheckedAtCol },
{ id: 'actions', title: m.common_actions(), sortable: false, cell: ActionsCell }
] satisfies ColumnSpec<ContainerUpdateRow>[];
@@ -98,18 +100,16 @@
{/snippet}
{#snippet ImageCell({ item }: { item: ContainerUpdateRow })}
+ <!-- fallow-ignore-next-line code-duplication parallel container/project update tables; cells shared via components, thin column wrappers differ by row type -->
<code class="text-xs">{item.imageRef}</code>
{/snippet}
-{#snippet DigestCell({ value }: { value: unknown })}
- {@const text = typeof value === 'string' ? value : '-'}
- <span class="font-mono text-xs break-all whitespace-normal" title={text !== '-' ? text : undefined}>
- {text}
- </span>
+{#snippet DigestCol({ value }: { value: unknown })}
+ <DigestCell {value} />
{/snippet}
-{#snippet CheckedAtCell({ value }: { value: unknown })}
- <span class="text-sm">{formatImageUpdateCheckedAt(typeof value === 'string' ? value : '')}</span>
+{#snippet CheckedAtCol({ value }: { value: unknown })}
+ <CheckedAtCell {value} />
{/snippet}
{#snippet ActionsCell({ item }: { item: ContainerUpdateRow })}
diff --git a/frontend/src/routes/(app)/updates/project-updates-table.svelte b/frontend/src/routes/(app)/updates/project-updates-table.svelte
index fc5407f5e..b6e3d01b6 100644
--- a/frontend/src/routes/(app)/updates/project-updates-table.svelte
+++ b/frontend/src/routes/(app)/updates/project-updates-table.svelte
@@ -1,6 +1,8 @@
<script lang="ts">
import ArcaneTable from '$lib/components/arcane-table/arcane-table.svelte';
import { UniversalMobileCard, type ColumnSpec, type MobileFieldVisibility } from '$lib/components/arcane-table';
+ import DigestCell from '$lib/components/arcane-table/cells/digest-cell.svelte';
+ import CheckedAtCell from '$lib/components/arcane-table/cells/checked-at-cell.svelte';
import { m } from '$lib/paraglide/messages';
import type { Paginated, SearchPaginationSortRequest } from '$lib/types/shared';
import type { Project } from '$lib/types/swarm';
@@ -82,9 +84,9 @@
const columns = [
{ accessorKey: 'name', title: m.common_name(), sortable: true, cell: NameCell },
{ accessorKey: 'imageSummary', title: m.common_image(), sortable: false, cell: ImageCell },
- { accessorKey: 'currentValue', title: m.image_update_current_label(), sortable: false, cell: DigestCell },
- { accessorKey: 'latestValue', title: m.image_update_latest_digest_label(), sortable: false, cell: DigestCell },
- { accessorKey: 'checkedAt', title: m.common_updated(), sortable: false, cell: CheckedAtCell }
+ { accessorKey: 'currentValue', title: m.image_update_current_label(), sortable: false, cell: DigestCol },
+ { accessorKey: 'latestValue', title: m.image_update_latest_digest_label(), sortable: false, cell: DigestCol },
+ { accessorKey: 'checkedAt', title: m.common_updated(), sortable: false, cell: CheckedAtCol }
] satisfies ColumnSpec<ProjectUpdateRow>[];
const mobileFields = [
@@ -114,15 +116,12 @@
</div>
{/snippet}
-{#snippet DigestCell({ value }: { value: unknown })}
- {@const text = typeof value === 'string' ? value : '-'}
- <span class="font-mono text-xs break-all whitespace-normal" title={text !== '-' ? text : undefined}>
- {text}
- </span>
+{#snippet DigestCol({ value }: { value: unknown })}
+ <DigestCell {value} />
{/snippet}
-{#snippet CheckedAtCell({ value }: { value: unknown })}
- <span class="text-sm">{formatImageUpdateCheckedAt(typeof value === 'string' ? value : '')}</span>
+{#snippet CheckedAtCol({ value }: { value: unknown })}
+ <CheckedAtCell {value} />
{/snippet}
{#snippet ProjectUpdatesMobileCard({ item }: { item: ProjectUpdateRow })}
diff --git a/frontend/src/routes/(app)/volumes/+page.svelte b/frontend/src/routes/(app)/volumes/+page.svelte
index 0cf3ea7d5..e69129887 100644
--- a/frontend/src/routes/(app)/volumes/+page.svelte
+++ b/frontend/src/routes/(app)/volumes/+page.svelte
@@ -6,7 +6,7 @@
import VolumeTable from './volume-table.svelte';
import { m } from '$lib/paraglide/messages';
import { volumeService } from '$lib/services/volume-service';
- import { environmentStore } from '$lib/stores/environment.store.svelte';
+ import { ResourceListPageState } from '$lib/utils/resource-list-page.svelte';
import { hasPermission } from '$lib/utils/auth';
import { queryKeys } from '$lib/query/query-keys';
import { untrack } from 'svelte';
@@ -17,21 +17,20 @@
let { data } = $props();
const queryClient = useQueryClient();
- let volumes = $state(untrack(() => data.volumes));
- let requestOptions = $state(untrack(() => data.volumeRequestOptions));
- let selectedIds = $state<string[]>([]);
- let isCreateDialogOpen = $state(false);
- const envId = $derived(environmentStore.selected?.id || '0');
+ const pageState = new ResourceListPageState(
+ untrack(() => data.volumes),
+ untrack(() => data.volumeRequestOptions)
+ );
const countsFallback: VolumeUsageCounts = { inuse: 0, unused: 0, total: 0 };
const volumesQuery = createQuery(() => ({
- queryKey: queryKeys.volumes.table(envId, requestOptions),
- queryFn: () => volumeService.getVolumesForEnvironment(envId, requestOptions),
+ queryKey: queryKeys.volumes.table(pageState.envId, pageState.requestOptions),
+ queryFn: () => volumeService.getVolumesForEnvironment(pageState.envId, pageState.requestOptions),
initialData: data.volumes
}));
const createVolumeMutation = createMutation(() => ({
- mutationKey: ['volumes', 'create', envId],
+ mutationKey: ['volumes', 'create', pageState.envId],
mutationFn: (options: VolumeCreateRequest) => volumeService.createVolume(options),
onSuccess: async (data, options) => {
const name = options.name?.trim() || m.common_unknown();
@@ -40,7 +39,7 @@
activityToastOptions(extractActivityId(data))
);
await loadVolumes();
- isCreateDialogOpen = false;
+ pageState.isCreateDialogOpen = false;
},
onError: (_error, options) => {
const name = options.name?.trim() || m.common_unknown();
@@ -50,7 +49,7 @@
$effect(() => {
if (volumesQuery.data) {
- volumes = volumesQuery.data;
+ pageState.items = volumesQuery.data;
}
});
@@ -58,11 +57,11 @@
await createVolumeMutation.mutateAsync(options);
}
- async function loadVolumes(options = requestOptions) {
- requestOptions = options;
- volumes = await queryClient.fetchQuery({
- queryKey: queryKeys.volumes.table(envId, options),
- queryFn: () => volumeService.getVolumesForEnvironment(envId, options)
+ async function loadVolumes(options = pageState.requestOptions) {
+ pageState.requestOptions = options;
+ pageState.items = await queryClient.fetchQuery({
+ queryKey: queryKeys.volumes.table(pageState.envId, options),
+ queryFn: () => volumeService.getVolumesForEnvironment(pageState.envId, options)
});
}
@@ -71,9 +70,9 @@
}
const isRefreshing = $derived(volumesQuery.isFetching && !volumesQuery.isPending);
- const volumeUsageCounts = $derived(volumes.counts ?? countsFallback);
+ const volumeUsageCounts = $derived(pageState.items.counts ?? countsFallback);
- const canCreateVolume = $derived(hasPermission('volumes:create', envId));
+ const canCreateVolume = $derived(hasPermission('volumes:create', pageState.envId));
const actionButtons: ActionButton[] = $derived.by(() => {
const buttons: ActionButton[] = [];
@@ -82,7 +81,7 @@
id: 'create',
action: 'create',
label: m.common_create_button({ resource: m.resource_volume_cap() }),
- onclick: () => (isCreateDialogOpen = true),
+ onclick: () => (pageState.isCreateDialogOpen = true),
loading: createVolumeMutation.isPending,
disabled: createVolumeMutation.isPending
});
@@ -116,10 +115,19 @@
<ResourcePageLayout title={m.volumes_title()} subtitle={m.volumes_subtitle()} {actionButtons} {statCards}>
{#snippet mainContent()}
- <VolumeTable bind:volumes bind:selectedIds bind:requestOptions onRefreshData={loadVolumes} />
+ <VolumeTable
+ bind:volumes={pageState.items}
+ bind:selectedIds={pageState.selectedIds}
+ bind:requestOptions={pageState.requestOptions}
+ onRefreshData={loadVolumes}
+ />
{/snippet}
{#snippet additionalContent()}
- <CreateVolumeSheet bind:open={isCreateDialogOpen} isLoading={createVolumeMutation.isPending} onSubmit={handleCreate} />
+ <CreateVolumeSheet
+ bind:open={pageState.isCreateDialogOpen}
+ isLoading={createVolumeMutation.isPending}
+ onSubmit={handleCreate}
+ />
{/snippet}
</ResourcePageLayout>
diff --git a/frontend/src/routes/(app)/volumes/[volumeName]/+error.svelte b/frontend/src/routes/(app)/volumes/[volumeName]/+error.svelte
index abd3e52a3..ba1fa301e 100644
--- a/frontend/src/routes/(app)/volumes/[volumeName]/+error.svelte
+++ b/frontend/src/routes/(app)/volumes/[volumeName]/+error.svelte
@@ -1,36 +1,10 @@
<script lang="ts">
- import { page } from '$app/state';
- import { goto } from '$app/navigation';
- import * as Empty from '$lib/components/ui/empty/index.js';
- import { ArcaneButton } from '$lib/components/arcane-button/index.js';
- import { AlertIcon } from '$lib/icons';
+ import ResourceErrorPage from '$lib/components/resource-error-page.svelte';
import { m } from '$lib/paraglide/messages';
-
- const status = $derived(page.status ?? 500);
- const message = $derived(page.error?.message ?? m.error_generic());
</script>
-<div class="flex h-full flex-1 flex-col items-center justify-center p-8">
- <Empty.Root>
- <Empty.Header>
- <Empty.Media variant="icon">
- <AlertIcon class="text-destructive size-16" aria-hidden="true" />
- </Empty.Media>
- <Empty.Title>
- {status === 404 ? m.error_not_found() : m.error_generic()}
- </Empty.Title>
- <Empty.Description>
- {message}
- </Empty.Description>
- </Empty.Header>
- <Empty.Content>
- <div class="flex flex-col items-center gap-3">
- <ArcaneButton
- action="base"
- customLabel={m.common_back_to({ resource: m.volumes_title() })}
- onclick={() => goto('/volumes')}
- />
- </div>
- </Empty.Content>
- </Empty.Root>
-</div>
+<ResourceErrorPage
+ fallbackTitle={m.error_generic()}
+ backLabel={m.common_back_to({ resource: m.volumes_title() })}
+ backHref="/volumes"
+/>
diff --git a/frontend/src/routes/(app)/volumes/[volumeName]/+page.svelte b/frontend/src/routes/(app)/volumes/[volumeName]/+page.svelte
index 8c4879a0f..db6b09731 100644
--- a/frontend/src/routes/(app)/volumes/[volumeName]/+page.svelte
+++ b/frontend/src/routes/(app)/volumes/[volumeName]/+page.svelte
@@ -21,6 +21,8 @@
import { environmentStore } from '$lib/stores/environment.store.svelte';
import { hasPermission } from '$lib/utils/auth';
import { activityToastOptions, extractActivityId } from '$lib/utils/activity-toast';
+ import PropertyItem from '$lib/components/property-item.svelte';
+ import KeyValueGridCard from '$lib/components/key-value-grid-card.svelte';
let { data } = $props();
let volume = $state(untrack(() => data.volume));
@@ -138,96 +140,49 @@
</Card.Header>
<Card.Content class="p-4">
<div class="grid grid-cols-1 gap-x-4 gap-y-6 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-6">
- <div class="flex items-start gap-3">
- <div class="flex size-10 shrink-0 items-center justify-center rounded-full bg-gray-500/10 p-2">
- <BoxIcon class="size-5 text-gray-500" />
- </div>
- <div class="min-w-0 flex-1">
- <p class="text-muted-foreground text-sm font-medium">{m.common_name()}</p>
- <p
- class="mt-1 cursor-pointer text-sm font-semibold break-all select-all sm:text-base"
- title={m.common_click_to_select()}
- >
- {volume.name}
- </p>
- </div>
- </div>
+ <PropertyItem
+ icon={BoxIcon}
+ color="gray"
+ label={m.common_name()}
+ value={volume.name}
+ valueClass="mt-1 cursor-pointer text-sm font-semibold break-all select-all sm:text-base"
+ />
- <div class="flex items-start gap-3">
- <div class="flex size-10 shrink-0 items-center justify-center rounded-full bg-blue-500/10 p-2">
- <VolumesIcon class="size-5 text-blue-500" />
- </div>
- <div class="min-w-0 flex-1">
- <p class="text-muted-foreground text-sm font-medium">{m.common_driver()}</p>
- <p
- class="mt-1 cursor-pointer text-sm font-semibold select-all sm:text-base"
- title={m.common_click_to_select()}
- >
- {volume.driver}
- </p>
- </div>
- </div>
+ <PropertyItem icon={VolumesIcon} color="blue" label={m.common_driver()} value={volume.driver} />
- <div class="flex items-start gap-3">
- <div class="flex size-10 shrink-0 items-center justify-center rounded-full bg-green-500/10 p-2">
- <ClockIcon class="size-5 text-green-500" />
- </div>
- <div class="min-w-0 flex-1">
- <p class="text-muted-foreground text-sm font-medium">{m.common_created()}</p>
- <p
- class="mt-1 cursor-pointer text-sm font-semibold select-all sm:text-base"
- title={m.common_click_to_select()}
- >
- {createdDate}
- </p>
- </div>
- </div>
+ <PropertyItem icon={ClockIcon} color="green" label={m.common_created()} value={createdDate} />
- <div class="flex items-start gap-3">
- <div class="flex size-10 shrink-0 items-center justify-center rounded-full bg-purple-500/10 p-2">
- <GlobeIcon class="size-5 text-purple-500" />
- </div>
- <div class="min-w-0 flex-1">
- <p class="text-muted-foreground text-sm font-medium">{m.common_scope()}</p>
- <p
- class="mt-1 cursor-pointer text-sm font-semibold capitalize select-all sm:text-base"
- title={m.common_click_to_select()}
- >
- {volume.scope}
- </p>
- </div>
- </div>
+ <PropertyItem
+ icon={GlobeIcon}
+ color="purple"
+ label={m.common_scope()}
+ value={volume.scope}
+ valueClass="mt-1 cursor-pointer text-sm font-semibold capitalize select-all sm:text-base"
+ />
- <div class="flex items-start gap-3">
- <div class="flex size-10 shrink-0 items-center justify-center rounded-full bg-amber-500/10 p-2">
- <InfoIcon class="size-5 text-amber-500" />
- </div>
- <div class="min-w-0 flex-1">
- <p class="text-muted-foreground text-sm font-medium">{m.common_status()}</p>
- <p class="mt-1 text-base font-semibold">
- {#if volume.inUse}
- <StatusBadge variant="green" text={m.common_in_use()} />
- {:else}
- <StatusBadge variant="amber" text={m.common_unused()} />
- {/if}
- </p>
- </div>
- </div>
+ <PropertyItem icon={InfoIcon} color="amber" label={m.common_status()}>
+ <p class="mt-1 text-base font-semibold">
+ {#if volume.inUse}
+ <StatusBadge variant="green" text={m.common_in_use()} />
+ {:else}
+ <StatusBadge variant="amber" text={m.common_unused()} />
+ {/if}
+ </p>
+ </PropertyItem>
- <div class="col-span-1 flex items-start gap-3 sm:col-span-2 lg:col-span-3 xl:col-span-4 2xl:col-span-6">
- <div class="flex size-10 shrink-0 items-center justify-center rounded-full bg-teal-500/10 p-2">
- <LayersIcon class="size-5 text-teal-500" />
+ <PropertyItem
+ icon={LayersIcon}
+ color="teal"
+ label={m.common_mountpoint()}
+ class="col-span-1 flex items-start gap-3 sm:col-span-2 lg:col-span-3 xl:col-span-4 2xl:col-span-6"
+ >
+ <div
+ class="bg-muted/50 mt-2 cursor-pointer rounded-lg border p-3 select-all"
+ title={m.common_click_to_select()}
+ >
+ <code class="font-mono text-sm break-all">{volume.mountpoint}</code>
</div>
- <div class="min-w-0 flex-1">
- <p class="text-muted-foreground text-sm font-medium">{m.common_mountpoint()}</p>
- <div
- class="bg-muted/50 mt-2 cursor-pointer rounded-lg border p-3 select-all"
- title={m.common_click_to_select()}
- >
- <code class="font-mono text-sm break-all">{volume.mountpoint}</code>
- </div>
- </div>
- </div>
+ </PropertyItem>
</div>
</Card.Content>
</Card.Root>
@@ -282,63 +237,21 @@
</Card.Root>
{#if volume.labels && Object.keys(volume.labels).length > 0}
- <Card.Root>
- <Card.Header icon={TagIcon}>
- <div class="flex flex-col space-y-1.5">
- <Card.Title>{m.common_labels()}</Card.Title>
- <Card.Description>{m.volumes_labels_description()}</Card.Description>
- </div>
- </Card.Header>
- <Card.Content class="p-4">
- <div class="grid grid-cols-1 gap-3 lg:grid-cols-2 2xl:grid-cols-3">
- {#each Object.entries(volume.labels) as [key, value] (key)}
- <Card.Root variant="subtle">
- <Card.Content class="flex flex-col gap-2 p-4">
- <div class="text-muted-foreground text-xs font-semibold tracking-wide break-all uppercase">
- {key}
- </div>
- <div
- class="text-foreground cursor-pointer font-mono text-sm font-medium break-all select-all"
- title={m.common_click_to_select()}
- >
- {value}
- </div>
- </Card.Content>
- </Card.Root>
- {/each}
- </div>
- </Card.Content>
- </Card.Root>
+ <KeyValueGridCard
+ icon={TagIcon}
+ title={m.common_labels()}
+ description={m.volumes_labels_description()}
+ entries={Object.entries(volume.labels)}
+ />
{/if}
{#if volume.options && Object.keys(volume.options).length > 0}
- <Card.Root>
- <Card.Header icon={VolumesIcon}>
- <div class="flex flex-col space-y-1.5">
- <Card.Title>{m.common_driver_options()}</Card.Title>
- <Card.Description>{m.volumes_driver_options_description()}</Card.Description>
- </div>
- </Card.Header>
- <Card.Content class="p-4">
- <div class="grid grid-cols-1 gap-3 lg:grid-cols-2 2xl:grid-cols-3">
- {#each Object.entries(volume.options) as [key, value] (key)}
- <Card.Root variant="subtle">
- <Card.Content class="flex flex-col gap-2 p-4">
- <div class="text-muted-foreground text-xs font-semibold tracking-wide break-all uppercase">
- {key}
- </div>
- <div
- class="text-foreground cursor-pointer font-mono text-sm font-medium break-all select-all"
- title={m.common_click_to_select()}
- >
- {value}
- </div>
- </Card.Content>
- </Card.Root>
- {/each}
- </div>
- </Card.Content>
- </Card.Root>
+ <KeyValueGridCard
+ icon={VolumesIcon}
+ title={m.common_driver_options()}
+ description={m.volumes_driver_options_description()}
+ entries={Object.entries(volume.options)}
+ />
{/if}
{#if (!volume.labels || Object.keys(volume.labels).length === 0) && (!volume.options || Object.keys(volume.options).length === 0)}
diff --git a/frontend/src/routes/(app)/volumes/components/volume-backup-table.svelte b/frontend/src/routes/(app)/volumes/components/volume-backup-table.svelte
index 8389ef619..a4526904f 100644
--- a/frontend/src/routes/(app)/volumes/components/volume-backup-table.svelte
+++ b/frontend/src/routes/(app)/volumes/components/volume-backup-table.svelte
@@ -13,7 +13,6 @@
InfoIcon,
DownloadIcon,
RestartIcon,
- EllipsisIcon,
FileTextIcon,
AlertIcon
} from '$lib/icons';
@@ -25,6 +24,7 @@
import type { SearchPaginationSortRequest } from '$lib/types/shared';
import { UniversalMobileCard, type ColumnSpec, type MobileFieldVisibility } from '$lib/components/arcane-table';
import * as DropdownMenu from '$lib/components/ui/dropdown-menu';
+ import RowActionsMenu from '$lib/components/file-browser/row-actions-menu.svelte';
import { openConfirmDialog } from '$lib/components/confirm-dialog';
import { ResponsiveDialog } from '$lib/components/ui/responsive-dialog';
import { Input } from '$lib/components/ui/input';
@@ -236,47 +236,29 @@
{/snippet}
{#snippet RowActions({ item }: { item: BackupEntry })}
- <DropdownMenu.Root>
- <DropdownMenu.Trigger>
- {#snippet child({ props })}
- <ArcaneButton
- {...props}
- action="base"
- tone="ghost"
- size="icon"
- class="relative size-8 p-0"
- icon={EllipsisIcon}
- showLabel={false}
- customLabel={m.common_open_menu()}
- />
- {/snippet}
- </DropdownMenu.Trigger>
- <DropdownMenu.Content align="end">
- <DropdownMenu.Group>
- {#if canBackupVolume}
- <DropdownMenu.Item onclick={() => handleRestore(item)}>
- <RestartIcon class="size-4" />
- Restore
- </DropdownMenu.Item>
- <DropdownMenu.Item onclick={() => openRestoreFilesDialog(item)}>
- <FileTextIcon class="size-4" />
- Restore files
- </DropdownMenu.Item>
- {/if}
- <DropdownMenu.Item onclick={() => volumeBackupService.downloadBackup(item.id)}>
- <DownloadIcon class="size-4" />
- {m.templates_download()}
- </DropdownMenu.Item>
- <IfPermitted perm="volumes:delete">
- <DropdownMenu.Separator />
- <DropdownMenu.Item variant="destructive" onclick={() => handleDelete(item)}>
- <TrashIcon class="size-4" />
- {m.common_remove()}
- </DropdownMenu.Item>
- </IfPermitted>
- </DropdownMenu.Group>
- </DropdownMenu.Content>
- </DropdownMenu.Root>
+ <RowActionsMenu openMenuLabel={m.common_open_menu()}>
+ {#if canBackupVolume}
+ <DropdownMenu.Item onclick={() => handleRestore(item)}>
+ <RestartIcon class="size-4" />
+ Restore
+ </DropdownMenu.Item>
+ <DropdownMenu.Item onclick={() => openRestoreFilesDialog(item)}>
+ <FileTextIcon class="size-4" />
+ Restore files
+ </DropdownMenu.Item>
+ {/if}
+ <DropdownMenu.Item onclick={() => volumeBackupService.downloadBackup(item.id)}>
+ <DownloadIcon class="size-4" />
+ {m.templates_download()}
+ </DropdownMenu.Item>
+ <IfPermitted perm="volumes:delete">
+ <DropdownMenu.Separator />
+ <DropdownMenu.Item variant="destructive" onclick={() => handleDelete(item)}>
+ <TrashIcon class="size-4" />
+ {m.common_remove()}
+ </DropdownMenu.Item>
+ </IfPermitted>
+ </RowActionsMenu>
{/snippet}
{#snippet ToolbarActions()}
diff --git a/frontend/src/routes/(app)/volumes/volume-table.svelte b/frontend/src/routes/(app)/volumes/volume-table.svelte
index 65ee33dd3..a7ff6d3cf 100644
--- a/frontend/src/routes/(app)/volumes/volume-table.svelte
+++ b/frontend/src/routes/(app)/volumes/volume-table.svelte
@@ -1,11 +1,11 @@
<script lang="ts">
import ArcaneTable from '$lib/components/arcane-table/arcane-table.svelte';
- import { ArcaneButton } from '$lib/components/arcane-button/index.js';
import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
+ import RowActionsMenu from '$lib/components/arcane-table/row-actions-menu.svelte';
import { goto } from '$app/navigation';
import { toast } from 'svelte-sonner';
import { openConfirmDialog } from '$lib/components/confirm-dialog';
- import StatusBadge from '$lib/components/badges/status-badge.svelte';
+ import InUseStatus from '$lib/components/arcane-table/cells/in-use-status.svelte';
import { handleApiResultWithCallbacks } from '$lib/utils/api';
import { tryCatch } from '$lib/utils/api';
import { format } from 'date-fns';
@@ -17,7 +17,8 @@
import { m } from '$lib/paraglide/messages';
import { volumeService } from '$lib/services/volume-service';
import { bytes } from '$lib/utils/formatting';
- import { TrashIcon, InspectIcon, VolumesIcon, CalendarIcon, EllipsisIcon } from '$lib/icons';
+ import { inUseBadge } from '$lib/utils/mobile-card-badges';
+ import { TrashIcon, InspectIcon, VolumesIcon, CalendarIcon } from '$lib/icons';
import { Spinner } from '$lib/components/ui/spinner';
import settingsStore from '$lib/stores/config-store';
import { onMount } from 'svelte';
@@ -209,11 +210,7 @@
{/snippet}
{#snippet StatusCell({ item }: { item: VolumeSummaryDto })}
- {#if item.inUse}
- <StatusBadge text={m.common_in_use()} variant="green" />
- {:else}
- <StatusBadge text={m.common_unused()} variant="amber" />
- {/if}
+ <InUseStatus inUse={item.inUse} />
{/snippet}
{#snippet SizeCell({ item }: { item: VolumeSummaryDto })}
@@ -254,14 +251,7 @@
})}
title={(item) => item.name}
subtitle={(item) => ((mobileFieldVisibility['id'] ?? true) ? item.id : null)}
- badges={[
- (item) =>
- (mobileFieldVisibility['inUse'] ?? true)
- ? item.inUse
- ? { variant: 'green' as const, text: m.common_in_use() }
- : { variant: 'amber' as const, text: m.common_unused() }
- : null
- ]}
+ badges={[inUseBadge(mobileFieldVisibility['inUse'] ?? true)]}
fields={[
{
label: m.common_driver(),
@@ -284,37 +274,25 @@
{/snippet}
{#snippet RowActions({ item }: { item: VolumeSummaryDto })}
- <DropdownMenu.Root>
- <DropdownMenu.Trigger>
- {#snippet child({ props })}
- <ArcaneButton {...props} action="base" tone="ghost" size="icon" class="size-8">
- <span class="sr-only">{m.common_open_menu()}</span>
- <EllipsisIcon class="size-4" />
- </ArcaneButton>
- {/snippet}
- </DropdownMenu.Trigger>
- <DropdownMenu.Content align="end">
- <DropdownMenu.Group>
- <DropdownMenu.Item onclick={() => goto(`/volumes/${item.id}`)}>
- <InspectIcon class="size-4" />
- {m.common_inspect()}
- </DropdownMenu.Item>
+ <RowActionsMenu>
+ <DropdownMenu.Item onclick={() => goto(`/volumes/${item.id}`)}>
+ <InspectIcon class="size-4" />
+ {m.common_inspect()}
+ </DropdownMenu.Item>
- {#if canDeleteVolume}
- <DropdownMenu.Separator />
+ {#if canDeleteVolume}
+ <DropdownMenu.Separator />
- <DropdownMenu.Item
- variant="destructive"
- onclick={() => handleRemoveVolumeConfirm(item.name)}
- disabled={item.inUse || isBackupVolume(item)}
- >
- <TrashIcon class="size-4" />
- {m.common_remove()}
- </DropdownMenu.Item>
- {/if}
- </DropdownMenu.Group>
- </DropdownMenu.Content>
- </DropdownMenu.Root>
+ <DropdownMenu.Item
+ variant="destructive"
+ onclick={() => handleRemoveVolumeConfirm(item.name)}
+ disabled={item.inUse || isBackupVolume(item)}
+ >
+ <TrashIcon class="size-4" />
+ {m.common_remove()}
+ </DropdownMenu.Item>
+ {/if}
+ </RowActionsMenu>
{/snippet}
<ArcaneTable
diff --git a/frontend/src/routes/(auth)/login/+page.svelte b/frontend/src/routes/(auth)/login/+page.svelte
index d3dc34aa4..abbec1bb9 100644
--- a/frontend/src/routes/(auth)/login/+page.svelte
+++ b/frontend/src/routes/(auth)/login/+page.svelte
@@ -213,7 +213,7 @@
</Alert.Root>
{/if}
- {#if showOidcLoginButton && !showLocalLoginForm}
+ {#snippet oidcLoginButton()}
<ArcaneButton
hoverEffect="none"
action="oidc_login"
@@ -230,6 +230,10 @@
{/if}
{oidcButtonLabel}
</ArcaneButton>
+ {/snippet}
+
+ {#if showOidcLoginButton && !showLocalLoginForm}
+ {@render oidcLoginButton()}
{/if}
{#if showLocalLoginForm}
@@ -291,22 +295,7 @@
{/if}
{#if showOidcLoginButton && showDivider}
- <ArcaneButton
- action="oidc_login"
- hoverEffect="none"
- onclick={() => handleOidcLogin()}
- loading={isOidcLoading}
- disabled={isLocalLoading}
- icon={null}
- customLabel=""
- >
- {#if oidcProviderLogoUrl}
- <img src={oidcProviderLogoUrl} alt="" class="size-4 object-contain" />
- {:else}
- <OpenIdIcon class="size-4" />
- {/if}
- {oidcButtonLabel}
- </ArcaneButton>
+ {@render oidcLoginButton()}
{/if}
{/if}
</div>
diff --git a/frontend/src/routes/(auth)/oidc/callback/+page.svelte b/frontend/src/routes/(auth)/oidc/callback/+page.svelte
index d7cd80c6a..91a3526ae 100644
--- a/frontend/src/routes/(auth)/oidc/callback/+page.svelte
+++ b/frontend/src/routes/(auth)/oidc/callback/+page.svelte
@@ -12,7 +12,7 @@
import { authService } from '$lib/services/auth-service';
import { environmentStore } from '$lib/stores/environment.store.svelte';
import { getAuthRedirectPath } from '$lib/utils/auth';
- import { Spinner } from '$lib/components/ui/spinner/index.js';
+ import OidcStatusPanel from '$lib/components/oidc-status-panel.svelte';
import { createMutation, useQueryClient } from '@tanstack/svelte-query';
let {}: PageProps = $props();
@@ -175,34 +175,15 @@
});
</script>
-<div class="bg-background flex min-h-screen items-center justify-center">
- <div class="w-full max-w-md space-y-8">
- <div class="flex flex-col items-center text-center">
- {#if isProcessing}
- <Spinner class="text-primary size-12" />
- <h2 class="mt-6 text-2xl font-semibold">{m.auth_processing_login()}</h2>
- <p class="text-muted-foreground mt-2 text-sm">{m.auth_processing_login_description()}</p>
- {:else if error}
- <div class="text-destructive flex flex-col items-center">
- <svg class="h-12 w-12" fill="none" viewBox="0 0 24 24" stroke="currentColor">
- <path
- stroke-linecap="round"
- stroke-linejoin="round"
- stroke-width="2"
- d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.732-.833-2.5 0L3.341 16.5c-.77.833.192 2.5 1.732 2.5z"
- />
- </svg>
- <h2 class="mt-6 text-2xl font-semibold">{m.auth_authentication_error_title()}</h2>
- <p class="mt-2 text-sm">{error}</p>
- <p class="text-muted-foreground mt-4 text-xs">{m.auth_redirecting_to_login()}</p>
- </div>
- {:else}
- <!-- Defensive fallback: if neither branch matches (e.g. an
- unexpected throw inside onSuccess), the user would otherwise
- see a blank page with no way out. Always show a logout link. -->
- <p class="text-muted-foreground text-sm">{m.auth_processing_login()}</p>
- <a href="/logout" class="text-primary mt-6 text-xs underline">{m.common_logout()}</a>
- {/if}
- </div>
- </div>
-</div>
+<OidcStatusPanel
+ busy={isProcessing}
+ busyTitle={m.auth_processing_login()}
+ busyDescription={m.auth_processing_login_description()}
+ {error}
+>
+ <!-- Defensive fallback: if neither branch matches (e.g. an
+ unexpected throw inside onSuccess), the user would otherwise
+ see a blank page with no way out. Always show a logout link. -->
+ <p class="text-muted-foreground text-sm">{m.auth_processing_login()}</p>
+ <a href="/logout" class="text-primary mt-6 text-xs underline">{m.common_logout()}</a>
+</OidcStatusPanel>
diff --git a/frontend/src/routes/(auth)/oidc/login/+page.svelte b/frontend/src/routes/(auth)/oidc/login/+page.svelte
index 4505db967..132fe3c2f 100644
--- a/frontend/src/routes/(auth)/oidc/login/+page.svelte
+++ b/frontend/src/routes/(auth)/oidc/login/+page.svelte
@@ -4,7 +4,7 @@
import { page } from '$app/state';
import { m } from '$lib/paraglide/messages';
import { authService } from '$lib/services/auth-service';
- import { Spinner } from '$lib/components/ui/spinner/index.js';
+ import OidcStatusPanel from '$lib/components/oidc-status-panel.svelte';
import { createMutation } from '@tanstack/svelte-query';
let {}: PageProps = $props();
@@ -54,28 +54,9 @@
<svelte:head><title>{m.layout_title()}</title></svelte:head>
-<div class="bg-background flex min-h-screen items-center justify-center">
- <div class="w-full max-w-md space-y-8">
- <div class="flex flex-col items-center text-center">
- {#if isRedirecting && !error}
- <Spinner class="text-primary size-12" />
- <h2 class="mt-6 text-2xl font-semibold">{m.auth_oidc_redirecting_title()}</h2>
- <p class="text-muted-foreground mt-2 text-sm">{m.auth_oidc_redirecting_description()}</p>
- {:else if error}
- <div class="text-destructive flex flex-col items-center">
- <svg class="h-12 w-12" fill="none" viewBox="0 0 24 24" stroke="currentColor">
- <path
- stroke-linecap="round"
- stroke-linejoin="round"
- stroke-width="2"
- d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.732-.833-2.5 0L3.341 16.5c-.77.833.192 2.5 1.732 2.5z"
- />
- </svg>
- <h2 class="mt-6 text-2xl font-semibold">{m.auth_authentication_error_title()}</h2>
- <p class="mt-2 text-sm">{error}</p>
- <p class="text-muted-foreground mt-4 text-xs">{m.auth_redirecting_to_login()}</p>
- </div>
- {/if}
- </div>
- </div>
-</div>
+<OidcStatusPanel
+ busy={isRedirecting && !error}
+ busyTitle={m.auth_oidc_redirecting_title()}
+ busyDescription={m.auth_oidc_redirecting_description()}
+ {error}
+/>