Skip to content

Modern Docker Management, Designed for Everyone

refactor: cleanup crowded action button ui (#4233)

Kyle Mendell7146c0c812a0
diff --git a/frontend/messages/en.json b/frontend/messages/en.json
index 872c9d530..2bb97922c 100644
--- a/frontend/messages/en.json
+++ b/frontend/messages/en.json
@@ -112,6 +112,11 @@
"common_exposed_ports": "Exposed Ports",
"common_open_menu": "Open menu",
"common_more_actions": "More actions",
+ "lifecycle": "Lifecycle",
+ "deploy": "Deploy",
+ "manage": "Manage",
+ "danger_zone": "Danger zone",
+ "pull_and_watch_output": "Pull and watch output",
"common_more": "More",
"common_more_pages": "More pages",
"common_actions": "Actions",
@@ -1675,7 +1680,6 @@
"security_password_policy_standard_tooltip": "10+ chars with upper, lower, and a number.",
"security_password_policy_strong_tooltip": "12+ chars with upper, lower, number, and symbol.",
"security_trivy_tab": "Trivy",
- "security_lifecycle_tab": "Lifecycle",
"security_vulnerability_scanning_heading": "Vulnerability Scanning",
"trivy_db_registry_label": "Trivy DB Registry",
"trivy_db_registry_description": "Registry used to pull the Trivy database artifacts.",
@@ -3389,7 +3393,6 @@
"account_time_format_desc": "Time display format for this account",
"account_roles": "Your assigned roles",
"account_no_roles": "No roles assigned.",
- "account_danger_zone": "Danger zone",
"account_danger_zone_desc": "Session-level actions that affect every device",
"account_signout_other": "Sign out other sessions",
"account_signout_this": "Sign out of this device.",
@@ -3799,6 +3802,10 @@
"back_up_to_git_description": "Configuration lives in Arcane; saved changes are committed to the repository",
"deployments": "Deployments",
"backups": "Backups",
+ "recent_backups": "Recent backups",
+ "files_in_last_backup": "Files in last backup",
+ "file_limit": "{limit} limit",
+ "on_save": "On save",
"pull_from_git": "Pull from Git",
"backup_state": "Backup state",
"backup_completed": "Backup completed",
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 5a5486056..7f12cf58d 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
@@ -1,303 +1,359 @@
<script lang="ts">
+ import { flushSync } from 'svelte';
+ import { goto } from '$app/navigation';
import * as ButtonGroup from '#lib/components/ui/button-group/index.js';
- import { ArcaneButton } from '#lib/components/arcane-button/index.js';
import * as DropdownMenu from '#lib/components/ui/dropdown-menu/index.js';
- import type { ArcaneButtonSize } from '#lib/components/arcane-button/index.js';
- import { EllipsisIcon } from '#lib/icons/index.js';
+ import * as ArcaneTooltip from '#lib/components/arcane-tooltip/index.js';
+ import { Spinner } from '#lib/components/ui/spinner/index.js';
+ import {
+ ArcaneButton,
+ actionConfigs,
+ type ActionConfig,
+ type ArcaneButtonSize,
+ type ArcaneButtonTone
+ } from '#lib/components/arcane-button/index.js';
+ import { ArrowDownIcon, EllipsisIcon } from '#lib/icons/index.js';
import { cn } from '#lib/utils.js';
import { m } from '#lib/paraglide/messages.js';
- import { ArrowDownIcon } from '#lib/icons/index.js';
- import type { ActionButton, ActionButtonMenuItem } from './types.js';
+ import type { ActionButton, ActionGroup } from './types.js';
interface Props {
buttons?: ActionButton[];
size?: ArcaneButtonSize;
class?: string;
- inlineClass?: string;
- menuClass?: string;
}
- let { buttons = [], size = 'default', class: className = '', inlineClass = '', menuClass = '' }: Props = $props();
+ let { buttons = [], size = 'default', class: className = '' }: Props = $props();
- const DROPDOWN_WIDTH = $derived(size === 'sm' ? 44 : 48);
- const GAP = 8;
+ const GROUP_ORDER: ActionGroup[] = ['lifecycle', 'deploy', 'manage', 'danger'];
- let containerWidth = $state(0);
- let buttonWidths = $state<number[]>([]);
-
- const visibleCount = $derived.by(() => {
- const total = buttons.length;
- if (total === 0 || buttonWidths.length === 0 || containerWidth === 0) {
- return total;
- }
+ const groupLabels = $derived<Record<ActionGroup, string>>({
+ lifecycle: m.lifecycle(),
+ deploy: m.deploy(),
+ manage: m.manage(),
+ danger: m.danger_zone()
+ });
- const totalWidth = buttonWidths.reduce((sum, w, i) => sum + w + (i > 0 ? GAP : 0), 0);
- if (totalWidth <= containerWidth) {
- return total;
- }
+ // Compact mode drops inline labels when the natural row is wider than the host column.
+ // The host column's width never depends on this content, so measuring it cannot loop.
+ let compact = $state(false);
- let usedWidth = DROPDOWN_WIDTH;
- for (let i = 0; i < total; i++) {
- const needed = (buttonWidths[i] ?? 0) + (i > 0 ? GAP : 0);
- if (usedWidth + needed > containerWidth) {
- return i;
- }
- usedWidth += needed;
- }
- return total;
- });
+ const primary = $derived(buttons.filter((b) => b.placement === 'primary'));
+ const menuOnly = $derived(buttons.filter((b) => (b.placement ?? 'menu') === 'menu'));
+ // A lone menu item is promoted inline rather than hiding behind a one-entry menu.
+ const promoted = $derived(menuOnly.length === 1 ? menuOnly : []);
+ const secondary = $derived([...buttons.filter((b) => b.placement === 'secondary'), ...promoted]);
+ // Icon-only secondaries (Refresh) sit after the Actions menu at the far right.
+ const secondaryLabelled = $derived(secondary.filter((b) => !b.iconOnly));
+ const secondaryIcons = $derived(secondary.filter((b) => b.iconOnly));
+ const menuGroups = $derived(
+ GROUP_ORDER.map((key) => ({
+ key,
+ items: promoted.length > 0 ? [] : menuOnly.filter((b) => (b.group ?? 'manage') === key)
+ })).filter((g) => g.items.length > 0)
+ );
+ const showMenu = $derived(secondary.length > 0 || menuGroups.length > 0);
+ // With no menu-only items the trigger exists solely to fold secondaries on narrow screens.
+ const menuIsMobileOnly = $derived(menuGroups.length === 0);
+ const foldBreakpoint = $derived(secondaryLabelled.length > 0 ? 'lg' : 'sm');
+ // Labelled secondaries fold into the menu below lg, or whenever the row is compact.
+ const secondariesInline = $derived(!compact);
+ const iconSize = $derived(size === 'sm' ? 'size-8' : 'size-9');
- const visibleButtons = $derived(buttons.slice(0, visibleCount));
- const overflowButtons = $derived(buttons.slice(visibleCount));
+ let rootEl: HTMLElement | undefined;
+ let rowEl: HTMLElement | undefined;
- function handleOverflowAction(button: ActionButton) {
- if (button.disabled || button.loading) return;
- if (button.href) {
- window.location.assign(button.href);
- return;
- }
- button.onclick?.();
+ function overflows() {
+ if (!rootEl || !rowEl) return false;
+ return rowEl.scrollWidth > rootEl.clientWidth + 0.5;
}
- function handleMenuItemAction(item: ActionButtonMenuItem) {
- if (item.disabled) return;
- if (item.href) {
- window.location.assign(item.href);
- return;
- }
- item.onclick?.();
+ function remeasure() {
+ compact = false;
+ flushSync();
+ compact = overflows();
}
- function measureButtons(actionButtons: ActionButton[], currentSize: ArcaneButtonSize) {
- void currentSize;
- return (node: HTMLElement) => {
- if (actionButtons.length === 0) {
- buttonWidths = [];
- return;
- }
-
- let rafId: number | null = null;
- const timeoutId = setTimeout(() => {
- rafId = requestAnimationFrame(() => {
- const widths: number[] = [];
- for (const child of node.children) {
- widths.push((child as HTMLElement).offsetWidth);
- }
- if (widths.length > 0 && widths.length === actionButtons.length) {
- buttonWidths = widths;
- }
- });
- }, 0);
-
- return () => {
- clearTimeout(timeoutId);
- if (rafId) cancelAnimationFrame(rafId);
- };
+ function observeRoot(node: HTMLElement) {
+ rootEl = node;
+ const ro = new ResizeObserver(remeasure);
+ ro.observe(node);
+ return () => {
+ ro.disconnect();
+ rootEl = undefined;
};
}
- function observeWidth(node: HTMLElement) {
- let rafId: number | null = null;
- const ro = new ResizeObserver((entries) => {
- if (rafId) cancelAnimationFrame(rafId);
- rafId = requestAnimationFrame(() => {
- const width = entries[0]?.contentRect.width ?? 0;
- if (width > 0 && width !== containerWidth) {
- containerWidth = width;
- }
- });
+ // Content growth (loading labels, new items) may only tighten, never re-expand.
+ function observeRow(node: HTMLElement) {
+ rowEl = node;
+ const ro = new ResizeObserver(() => {
+ if (!compact && overflows()) compact = true;
});
ro.observe(node);
return () => {
- if (rafId) cancelAnimationFrame(rafId);
ro.disconnect();
+ rowEl = undefined;
};
}
+
+ function hasMenu(button: ActionButton) {
+ return (button.menuItems?.length ?? 0) > 0 || !!button.menuContent;
+ }
+
+ function toneFor(button: ActionButton): ArcaneButtonTone {
+ if (button.destructive) return 'outline-destructive';
+ return (actionConfigs[button.action] as ActionConfig).tone;
+ }
+
+ function iconFor(button: ActionButton) {
+ if (button.icon === null) return null;
+ return button.icon ?? (actionConfigs[button.action] as ActionConfig).IconComponent;
+ }
+
+ function activate(target: { onclick?: () => void; href?: string }) {
+ if (target.href) {
+ void goto(target.href);
+ return;
+ }
+ target.onclick?.();
+ }
</script>
-{#snippet menuItemsList(items: ActionButtonMenuItem[])}
- {#each items as item (item.id)}
- <DropdownMenu.Item onclick={() => handleMenuItemAction(item)} disabled={item.disabled}>
+{#snippet itemBody(button: ActionButton)}
+ {@const Icon = iconFor(button)}
+ {#if button.loading}
+ <Spinner class="size-4" />
+ {:else if Icon}
+ <Icon class="size-4" />
+ {/if}
+ <span class="flex-1">{button.loading ? (button.loadingLabel ?? button.label) : button.label}</span>
+ {#if button.badge !== undefined}
+ <span class="text-3xs text-muted-foreground">({button.badge})</span>
+ {/if}
+{/snippet}
+
+{#snippet menuEntries(button: ActionButton)}
+ {@const parentDisabled = !!(button.disabled || button.loading)}
+ {#each button.menuItems ?? [] as item (item.id)}
+ {@const ItemIcon = item.icon}
+ <DropdownMenu.Item
+ variant={item.destructive ? 'destructive' : 'default'}
+ disabled={parentDisabled || item.disabled}
+ onclick={() => activate(item)}
+ >
+ {#if ItemIcon}
+ <ItemIcon class="size-4" />
+ {/if}
{item.label}
</DropdownMenu.Item>
{/each}
+ {@render button.menuContent?.(parentDisabled)}
{/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 menuItem(button: ActionButton)}
+ {#if button.onclick || button.href}
+ <DropdownMenu.Item
+ variant={button.destructive ? 'destructive' : 'default'}
+ disabled={button.disabled || button.loading}
+ title={button.disabledReason}
+ onclick={() => activate(button)}
+ >
+ {@render itemBody(button)}
+ </DropdownMenu.Item>
+ {/if}
+ {#if hasMenu(button)}
+ {@render menuEntries(button)}
+ {/if}
{/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>
+{#snippet plainButton(button: ActionButton)}
+ <ArcaneButton
+ action={button.action}
+ tone={toneFor(button)}
+ {size}
+ showLabel={!compact}
+ aria-label={button.label}
+ customLabel={button.label}
+ loadingLabel={button.loadingLabel}
+ loading={button.loading}
+ disabled={button.disabled}
+ title={button.disabledReason}
+ onclick={button.onclick}
+ href={button.href}
+ rel={button.rel}
+ icon={button.icon}
+ >
{#if button.badge !== undefined}
- <span class="text-3xs text-muted-foreground">({button.badge})</span>
+ <span class="rounded-full border px-1 py-0.5 text-3xs text-muted-foreground">{button.badge}</span>
{/if}
- </div>
+ </ArcaneButton>
{/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-45">
- <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 dropdownContent(button: ActionButton)}
+ <DropdownMenu.Content align="end" class={cn('z-(--arcane-z-surface)', button.menuContent ? 'w-72' : 'min-w-45')}>
+ {@render menuEntries(button)}
+ </DropdownMenu.Content>
{/snippet}
-{#snippet buttonContent(button: ActionButton)}
- {#if button.badge !== undefined}
- <span class="rounded-full border px-1 py-0.5 text-3xs text-muted-foreground">
- {button.badge}
- </span>
- {/if}
-{/snippet}
-
-{#snippet splitButton(button: ActionButton, inert: boolean)}
- <ButtonGroup.Root>
- <ArcaneButton
- action={button.action}
- customLabel={button.label}
- loadingLabel={button.loadingLabel}
- loading={button.loading}
- disabled={button.disabled}
- onclick={inert ? () => {} : button.onclick}
- href={button.href}
- rel={button.rel}
- {size}
- icon={button.icon}
- >
- {@render buttonContent(button)}
- </ArcaneButton>
-
- {#if inert}
- <ArcaneButton action="base" tone="outline" size="icon" onclick={() => {}} class={cn(size === 'sm' ? 'size-8' : 'size-9')}>
- <ArrowDownIcon class="size-4" />
- </ArcaneButton>
- {:else}
+{#snippet inlineButton(button: ActionButton)}
+ {#if button.iconOnly}
+ <ArcaneTooltip.Root>
+ <ArcaneTooltip.Trigger>
+ {#snippet child({ props })}
+ <ArcaneButton
+ {...props}
+ action={button.action}
+ tone={toneFor(button)}
+ size="icon"
+ class={iconSize}
+ customLabel={button.label}
+ loadingLabel={button.loadingLabel}
+ loading={button.loading}
+ disabled={button.disabled}
+ title={button.disabledReason}
+ onclick={button.onclick}
+ href={button.href}
+ rel={button.rel}
+ icon={button.icon}
+ />
+ {/snippet}
+ </ArcaneTooltip.Trigger>
+ <ArcaneTooltip.Content>{button.label}</ArcaneTooltip.Content>
+ </ArcaneTooltip.Root>
+ {:else if hasMenu(button) && (button.onclick || button.href)}
+ <ButtonGroup.Root>
+ {@render plainButton(button)}
<DropdownMenu.Root>
- <DropdownMenu.Trigger>
+ <DropdownMenu.Trigger disabled={button.disabled || button.loading}>
{#snippet child({ props })}
<ArcaneButton
{...props}
action="base"
- tone="outline"
+ tone={toneFor(button)}
size="icon"
+ class={cn(iconSize, size === 'sm' && 'rounded-lg')}
icon={ArrowDownIcon}
- class={size === 'sm' ? 'size-8 rounded-lg' : undefined}
aria-label={m.common_open_menu()}
/>
{/snippet}
</DropdownMenu.Trigger>
-
- <DropdownMenu.Content align="end" class="min-w-45">
- {@render menuItemsList(button.menuItems ?? [])}
- </DropdownMenu.Content>
+ {@render dropdownContent(button)}
</DropdownMenu.Root>
- {/if}
- </ButtonGroup.Root>
-{/snippet}
-
-{#if buttons.length > 0}
- <div class={cn('relative flex min-w-0 flex-1 items-center justify-end gap-2', className)} {@attach observeWidth}>
- <div
- {@attach measureButtons(buttons, size)}
- class="pointer-events-none invisible absolute top-0 left-0 flex items-center gap-2"
- aria-hidden="true"
- inert
- >
- {#each buttons as button (button.id)}
- {#if button.menuItems && button.menuItems.length > 0}
- {@render splitButton(button, true)}
- {:else}
+ </ButtonGroup.Root>
+ {:else if hasMenu(button)}
+ <DropdownMenu.Root>
+ <DropdownMenu.Trigger disabled={button.disabled || button.loading}>
+ {#snippet child({ props })}
<ArcaneButton
+ {...props}
action={button.action}
- customLabel={button.label}
- loadingLabel={button.loadingLabel}
- loading={button.loading}
- disabled={button.disabled}
- onclick={() => {}}
- href={button.href}
- rel={button.rel}
+ tone={toneFor(button)}
{size}
- icon={button.icon}
- >
- {@render buttonContent(button)}
- </ArcaneButton>
- {/if}
- {/each}
- </div>
-
- <div class={cn('hidden items-center gap-2 lg:flex', inlineClass)}>
- {#each visibleButtons as button (button.id)}
- {#if button.menuItems && button.menuItems.length > 0}
- {@render splitButton(button, false)}
- {:else}
- <ArcaneButton
- action={button.action}
+ showLabel={!compact}
+ aria-label={button.label}
customLabel={button.label}
- loadingLabel={button.loadingLabel}
loading={button.loading}
- disabled={button.disabled}
- onclick={button.onclick}
- href={button.href}
- rel={button.rel}
- {size}
icon={button.icon}
>
- {@render buttonContent(button)}
+ <ArrowDownIcon class="size-3.5 opacity-60" />
</ArcaneButton>
- {/if}
+ {/snippet}
+ </DropdownMenu.Trigger>
+ {@render dropdownContent(button)}
+ </DropdownMenu.Root>
+ {:else}
+ {@render plainButton(button)}
+ {/if}
+{/snippet}
+
+{#if buttons.length > 0}
+ <div class={cn('flex min-w-0 items-center justify-end', className)} {@attach observeRoot}>
+ <div class="flex shrink-0 items-center gap-2" {@attach observeRow}>
+ {#each primary as button (button.id)}
+ {@render inlineButton(button)}
{/each}
- {#if overflowButtons.length > 0}
+ {#if secondaryLabelled.length > 0 && secondariesInline}
+ <div class="hidden items-center gap-2 lg:flex">
+ {#each secondaryLabelled as button (button.id)}
+ {@render inlineButton(button)}
+ {/each}
+ </div>
+ {/if}
+
+ {#if showMenu}
<DropdownMenu.Root>
- {@render ellipsisTrigger(m.common_more_actions())}
+ <DropdownMenu.Trigger>
+ {#snippet child({ props })}
+ <ArcaneButton
+ {...props}
+ action="base"
+ tone="outline-primary"
+ {size}
+ class={cn(
+ 'max-sm:size-9 max-sm:p-0',
+ compact && 'size-9 p-0',
+ menuIsMobileOnly && !compact && `${foldBreakpoint}:hidden`
+ )}
+ aria-label={m.common_more_actions()}
+ >
+ {#if compact}
+ <EllipsisIcon class="size-4" />
+ {:else}
+ <span class="hidden sm:inline">{m.common_actions()}</span>
+ <ArrowDownIcon class="hidden size-4 sm:block" />
+ <EllipsisIcon class="size-4 sm:hidden" />
+ {/if}
+ </ArcaneButton>
+ {/snippet}
+ </DropdownMenu.Trigger>
+
+ <DropdownMenu.Content align="end" class="z-(--arcane-z-surface) min-w-52">
+ {#if secondaryLabelled.length > 0}
+ <DropdownMenu.Group class={secondariesInline ? 'lg:hidden' : undefined}>
+ {#each secondaryLabelled as button (button.id)}
+ {@render menuItem(button)}
+ {/each}
+ </DropdownMenu.Group>
+ {/if}
+ {#if secondaryIcons.length > 0}
+ <DropdownMenu.Group class="sm:hidden">
+ {#each secondaryIcons as button (button.id)}
+ {@render menuItem(button)}
+ {/each}
+ </DropdownMenu.Group>
+ {/if}
+ {#if secondary.length > 0 && menuGroups.length > 0}
+ <DropdownMenu.Separator class={secondaryLabelled.length > 0 && secondariesInline ? 'lg:hidden' : 'sm:hidden'} />
+ {/if}
- <DropdownMenu.Content align="end" class="min-w-40">
- {@render menuButtons(overflowButtons)}
+ {#each menuGroups as group, i (group.key)}
+ {#if i > 0}
+ <DropdownMenu.Separator />
+ {/if}
+ <DropdownMenu.Group>
+ {#if menuGroups.length > 1}
+ <DropdownMenu.GroupHeading>
+ {groupLabels[group.key]}
+ </DropdownMenu.GroupHeading>
+ {/if}
+ {#each group.items as button (button.id)}
+ {@render menuItem(button)}
+ {/each}
+ </DropdownMenu.Group>
+ {/each}
</DropdownMenu.Content>
</DropdownMenu.Root>
{/if}
- </div>
-
- <div class={cn('flex items-center gap-2 lg:hidden', menuClass)}>
- <DropdownMenu.Root>
- {@render ellipsisTrigger('More actions')}
- <DropdownMenu.Content align="end" class="min-w-40">
- {@render menuButtons(buttons)}
- </DropdownMenu.Content>
- </DropdownMenu.Root>
+ {#if secondaryIcons.length > 0}
+ <div class="hidden items-center gap-2 sm:flex">
+ {#each secondaryIcons as button (button.id)}
+ {@render inlineButton(button)}
+ {/each}
+ </div>
+ {/if}
</div>
</div>
{/if}
diff --git a/frontend/src/lib/components/action-button-group/types.ts b/frontend/src/lib/components/action-button-group/types.ts
index 9b25ed5ac..b419e6b84 100644
--- a/frontend/src/lib/components/action-button-group/types.ts
+++ b/frontend/src/lib/components/action-button-group/types.ts
@@ -1,9 +1,15 @@
import type { Action } from '#lib/components/arcane-button/index.js';
import type { IconType } from '#lib/icons/index.js';
+import type { Snippet } from 'svelte';
+
+export type ActionPlacement = 'primary' | 'secondary' | 'menu';
+export type ActionGroup = 'lifecycle' | 'deploy' | 'manage' | 'danger';
export interface ActionButtonMenuItem {
id: string;
label: string;
+ icon?: IconType;
+ destructive?: boolean;
disabled?: boolean;
onclick?: () => void;
href?: string;
@@ -16,11 +22,20 @@ export interface ActionButton {
loadingLabel?: string;
loading?: boolean;
disabled?: boolean;
+ disabledReason?: string;
onclick?: () => void;
href?: string;
rel?: string;
- showOnMobile?: boolean;
- badge?: string | number;
icon?: IconType | null;
+ badge?: string | number;
+ // Inline placement; defaults to the Actions menu.
+ placement?: ActionPlacement;
+ // Menu section; defaults to "manage".
+ group?: ActionGroup;
+ destructive?: boolean;
+ // Inline icon button with a tooltip instead of a label.
+ iconOnly?: boolean;
menuItems?: ActionButtonMenuItem[];
+ // Rich dropdown entries rendered after menuItems; receives the parent's disabled state.
+ menuContent?: Snippet<[boolean]>;
}
diff --git a/frontend/src/lib/components/action-buttons.svelte b/frontend/src/lib/components/action-buttons.svelte
index 4cec95a2f..5fd4ac91b 100644
--- a/frontend/src/lib/components/action-buttons.svelte
+++ b/frontend/src/lib/components/action-buttons.svelte
@@ -1,17 +1,13 @@
<script lang="ts">
- import { flushSync } from 'svelte';
- import type { Snippet } from 'svelte';
import { openConfirmDialog } from './confirm-dialog';
import { goto, refreshAll } from '$app/navigation';
import { toast } from 'svelte-sonner';
import { tryCatch } from '#lib/utils/try-catch.js';
import { handleApiResultWithCallbacks } from '#lib/utils/api.js';
- import { ArcaneButton, type ArcaneButtonSize } from '#lib/components/arcane-button/index.js';
- import DeploySplitButton from '#lib/components/deploy-split-button/deploy-split-button.svelte';
+ import ActionButtonGroup from '#lib/components/action-button-group/action-button-group.svelte';
+ import type { ActionButton } from '#lib/components/action-button-group/types.js';
import DeployOptionsMenuItems from '#lib/components/deploy-split-button/deploy-options-menu-items.svelte';
- import * as ButtonGroup from '#lib/components/ui/button-group/index.js';
import * as DropdownMenu from '#lib/components/ui/dropdown-menu/index.js';
- import { cn } from '#lib/utils.js';
import { m } from '#lib/paraglide/messages.js';
import settingsStore from '#lib/stores/config-store.svelte.js';
import { deployOptionsStore } from '#lib/stores/deploy-options.store.svelte.js';
@@ -23,7 +19,7 @@
import { attachProjectLogsToWatch } from '#lib/utils/watch-logs.js';
import type { Project } from '#lib/types/swarm.js';
import type { ContainerDetailsDto } from '#lib/types/docker.js';
- import { ArrowDownIcon, EllipsisIcon, TerminalIcon } from '#lib/icons/index.js';
+ import { TerminalIcon } from '#lib/icons/index.js';
import { createMutation } from '@tanstack/svelte-query';
import { hasPermission } from '#lib/utils/auth.js';
import { isDepotBuildAvailable } from '#lib/utils/build-provider.js';
@@ -40,7 +36,6 @@
redeploy?: boolean;
build?: boolean;
remove?: boolean;
- validating?: boolean;
refresh?: boolean;
};
@@ -49,45 +44,35 @@
name,
type = 'container',
itemState = 'stopped',
- loading = $bindable<LoadingStates>({}),
- onActionComplete = $bindable<(status?: string) => void>(() => {}),
+ onActionComplete = () => {},
startLoading = $bindable(false),
stopLoading = $bindable(false),
restartLoading = $bindable(false),
removeLoading = $bindable(false),
redeployLoading = $bindable(false),
- refreshLoading = $bindable(false),
hasBuildDirective = false,
disableRedeploy = false,
disabled = false,
disabledReason,
onRefresh,
- leadingActions,
- leadingMenuItems,
- beforeRemoveActions,
- beforeRemoveMenuItems
+ extraActions = []
}: {
id: string;
name?: string;
type?: TargetType;
itemState?: string;
- loading?: LoadingStates;
onActionComplete?: (status?: string) => void;
startLoading?: boolean;
stopLoading?: boolean;
restartLoading?: boolean;
removeLoading?: boolean;
redeployLoading?: boolean;
- refreshLoading?: boolean;
hasBuildDirective?: boolean;
disableRedeploy?: boolean;
disabled?: boolean;
disabledReason?: string;
onRefresh?: () => void | Promise<void>;
- leadingActions?: Snippet<[ArcaneButtonSize, boolean, boolean]>;
- leadingMenuItems?: Snippet<[boolean]>;
- beforeRemoveActions?: Snippet<[ArcaneButtonSize, boolean, boolean]>;
- beforeRemoveMenuItems?: Snippet<[boolean]>;
+ extraActions?: ActionButton[];
} = $props();
let isLoading = $state<LoadingStates>({
@@ -98,36 +83,29 @@
pull: false,
build: false,
redeploy: false,
- validating: false,
refresh: false
});
function setLoading<K extends keyof LoadingStates>(key: K, value: boolean) {
isLoading[key] = value;
- loading = { ...loading, [key]: value };
if (key === 'start') startLoading = value;
if (key === 'stop') stopLoading = value;
if (key === 'restart') restartLoading = value;
if (key === 'remove') removeLoading = value;
if (key === 'redeploy') redeployLoading = value;
- if (key === 'refresh') refreshLoading = value;
}
const uiLoading = $derived({
- start: !!(isLoading.start || loading?.start || startLoading),
- stop: !!(isLoading.stop || loading?.stop || stopLoading),
- restart: !!(isLoading.restart || loading?.restart || restartLoading),
- remove: !!(isLoading.remove || loading?.remove || removeLoading),
- pull: !!(isLoading.pull || loading?.pull),
- build: !!(isLoading.build || loading?.build),
- redeploy: !!(isLoading.redeploy || loading?.redeploy || redeployLoading),
- validating: !!(isLoading.validating || loading?.validating),
- refresh: !!(isLoading.refresh || loading?.refresh || refreshLoading)
+ start: !!(isLoading.start || startLoading),
+ stop: !!(isLoading.stop || stopLoading),
+ restart: !!(isLoading.restart || restartLoading),
+ remove: !!(isLoading.remove || removeLoading),
+ pull: !!isLoading.pull,
+ build: !!isLoading.build,
+ redeploy: !!(isLoading.redeploy || redeployLoading),
+ refresh: !!isLoading.refresh
});
- const isLifecycleActionPending = $derived(
- !!(uiLoading.start || uiLoading.stop || uiLoading.restart || uiLoading.redeploy || uiLoading.remove)
- );
const startMutation = createMutation(() => ({
mutationKey: ['action', 'start', type, id],
@@ -205,6 +183,9 @@
onSettled: () => setLoading('refresh', false)
}));
+ const isLifecycleActionPending = $derived(
+ !!(uiLoading.start || uiLoading.stop || uiLoading.restart || uiLoading.redeploy || uiLoading.remove)
+ );
const isRunning = $derived(itemState === 'running' || (type === 'project' && itemState === 'partially running'));
const projectHasBuildDirective = $derived(type === 'project' && hasBuildDirective);
@@ -228,9 +209,6 @@
const canRemove = $derived(
type === 'container' ? hasPermission('containers:delete', currentEnvId) : hasPermission('projects:delete', currentEnvId)
);
- // Whether the start/stop/restart block above the deploy options renders anything,
- // so its leading separator never lands next to a caller-provided one.
- const hasLifecycleMenuItems = $derived((!isRunning && canStart) || (isRunning && (canStop || canRestart)));
const canPull = $derived(type === 'project' && hasPermission('projects:deploy', currentEnvId));
const canBuild = $derived(type === 'project' && hasPermission('projects:deploy', currentEnvId));
const deployButtonLabel = $derived(projectHasBuildDirective ? m.compose_build_and_deploy() : m.common_up());
@@ -243,70 +221,6 @@
return configuredProvider;
});
- // The header gives this component a spanning column whose width does not depend on
- // its content (flex-1 basis-0). We measure the rendered row against that column and
- // step labels -> icons -> menu until it fits, then probe back up when space returns.
- // Measuring the real row (instead of an invisible mirror) keeps root font size and
- // locale label widths in the equation and never mounts the actions twice.
- type Tier = 'labels' | 'icons' | 'menu';
- const TIERS: Tier[] = ['labels', 'icons', 'menu'];
- let tier = $state<Tier>('labels');
- let rootEl: HTMLElement | undefined;
- let rowEl: HTMLElement | undefined;
-
- function fits() {
- // Commit the current `tier` to the DOM before reading layout.
- flushSync();
- if (!rootEl || !rowEl) return true;
- return rowEl.getBoundingClientRect().width <= rootEl.getBoundingClientRect().width + 0.5;
- }
-
- // Step down until the row fits, then probe upward while the larger tier still fits.
- // `mayLeaveMenu` is false for row-content triggers (label or loading changes) so an
- // open ellipsis menu is never unmounted underneath the user.
- function resolveTier(mayLeaveMenu: boolean) {
- let i = TIERS.indexOf(tier);
- while (!fits() && i < TIERS.length - 1) {
- i++;
- tier = TIERS[i] ?? 'menu';
- }
- while (i > 0 && (tier !== 'menu' || mayLeaveMenu)) {
- const larger = TIERS[i - 1] ?? 'labels';
- tier = larger;
- if (fits()) {
- i--;
- } else {
- tier = TIERS[i] ?? 'menu';
- break;
- }
- }
- }
-
- function observeRoot(node: HTMLElement) {
- rootEl = node;
- const ro = new ResizeObserver(() => resolveTier(true));
- ro.observe(node);
- // The floating header bubble is shrink-to-fit, so its column does not grow when the
- // viewport does; listen to the window as well so we can probe back up.
- const onResize = () => resolveTier(true);
- window.addEventListener('resize', onResize);
- return () => {
- ro.disconnect();
- window.removeEventListener('resize', onResize);
- rootEl = undefined;
- };
- }
-
- function observeRow(node: HTMLElement) {
- rowEl = node;
- const ro = new ResizeObserver(() => resolveTier(false));
- ro.observe(node);
- return () => {
- ro.disconnect();
- if (rowEl === node) rowEl = undefined;
- };
- }
-
async function handleRefresh() {
if (!onRefresh) return;
await refreshMutation.mutateAsync();
@@ -570,299 +484,166 @@
setLoading('build', false);
}
}
-</script>
-{#snippet WatchDropdown(onWatch: () => void, disabled: boolean, size: 'default' | 'icon' = 'default', withDeployOptions = false)}
- <DropdownMenu.Root>
- <DropdownMenu.Trigger
- {disabled}
- onclick={(event) => event.stopPropagation()}
- onpointerdown={(event) => event.stopPropagation()}
- >
- {#snippet child({ props })}
- <ArcaneButton
- {...props}
- action="base"
- tone="outline-primary"
- size="icon"
- icon={ArrowDownIcon}
- class={cn(size === 'icon' && 'size-9 rounded-md')}
- aria-label={m.common_open_menu()}
- />
- {/snippet}
- </DropdownMenu.Trigger>
- <DropdownMenu.Content align="end" class={cn(withDeployOptions && 'w-72')}>
- {#if withDeployOptions}
- <DeployOptionsMenuItems />
- <DropdownMenu.Separator />
- {/if}
- <DropdownMenu.Item onclick={() => onWatch()}>
- <TerminalIcon class="size-4" />
- {m.watch_output()}
- </DropdownMenu.Item>
- </DropdownMenu.Content>
- </DropdownMenu.Root>
-{/snippet}
+ const redeployDisabledReason = $derived(disableRedeploy ? m.common_redeploy_disabled_arcane_self() : disabledReason);
+
+ const buttons = $derived.by((): ActionButton[] => {
+ // Page-provided actions pause while a lifecycle operation is in flight.
+ const list: ActionButton[] = extraActions.map((action) => ({
+ ...action,
+ disabled: action.disabled || isLifecycleActionPending
+ }));
+
+ if (!isRunning && canStart) {
+ if (type === 'container') {
+ list.push({
+ id: 'start',
+ action: 'start',
+ label: m.common_start(),
+ placement: 'primary',
+ group: 'lifecycle',
+ loading: uiLoading.start,
+ disabled,
+ disabledReason,
+ onclick: () => handleStart()
+ });
+ } else {
+ list.push({
+ id: 'deploy',
+ action: 'deploy',
+ label: deployButtonLabel,
+ placement: 'primary',
+ group: 'lifecycle',
+ loading: uiLoading.start,
+ disabled,
+ disabledReason,
+ onclick: () => handleDeploy(),
+ menuContent: upMenu
+ });
+ }
+ }
+
+ if (isRunning && canStop) {
+ list.push({
+ id: 'stop',
+ action: 'stop',
+ label: type === 'project' ? m.common_down() : m.common_stop(),
+ placement: 'primary',
+ group: 'lifecycle',
+ destructive: true,
+ loading: uiLoading.stop,
+ disabled,
+ disabledReason,
+ onclick: () => handleStop()
+ });
+ }
+
+ if (isRunning && canRestart) {
+ list.push({
+ id: 'restart',
+ action: 'restart',
+ label: m.common_restart(),
+ placement: 'secondary',
+ group: 'lifecycle',
+ loading: uiLoading.restart,
+ disabled,
+ disabledReason,
+ onclick: () => handleRestart()
+ });
+ }
+
+ if (canRedeploy) {
+ list.push({
+ id: 'redeploy',
+ action: 'redeploy',
+ label: m.common_redeploy(),
+ placement: type === 'project' ? 'secondary' : 'menu',
+ group: 'deploy',
+ loading: uiLoading.redeploy,
+ disabled: disabled || disableRedeploy,
+ disabledReason: redeployDisabledReason,
+ onclick: () => confirmAction('redeploy'),
+ menuContent: type === 'project' ? redeployMenu : undefined
+ });
+ }
+
+ if (projectHasBuildDirective && canBuild) {
+ list.push({
+ id: 'build',
+ action: 'build',
+ label: m.build(),
+ group: 'deploy',
+ loading: uiLoading.build,
+ disabled,
+ disabledReason,
+ onclick: () => handleProjectBuild()
+ });
+ }
+
+ if (canPull) {
+ list.push({
+ id: 'pull',
+ action: 'pull',
+ label: m.pull(),
+ group: 'deploy',
+ loading: uiLoading.pull,
+ disabled,
+ disabledReason,
+ onclick: () => handleProjectPull(),
+ menuContent: pullMenu
+ });
+ }
+
+ if (onRefresh) {
+ list.push({
+ id: 'refresh',
+ action: 'refresh',
+ placement: 'secondary',
+ iconOnly: true,
+ label: m.common_refresh(),
+ group: 'manage',
+ loading: uiLoading.refresh,
+ onclick: () => handleRefresh()
+ });
+ }
+
+ if (canRemove) {
+ list.push({
+ id: 'remove',
+ action: 'remove',
+ label: type === 'project' ? m.compose_destroy() : m.common_remove(),
+ group: 'danger',
+ destructive: true,
+ loading: uiLoading.remove,
+ onclick: () => confirmAction('remove')
+ });
+ }
+
+ return list;
+ });
+</script>
-{#snippet RedeployActionButton(size: 'default' | 'icon' = 'default', showLabel = true)}
- {#if canRedeploy}
- {#if disabled}
- <ArcaneButton action="redeploy" {size} {showLabel} disabled title={disabledReason} />
- {:else if disableRedeploy}
- <span class="inline-flex" title={m.common_redeploy_disabled_arcane_self()}>
- <ArcaneButton action="redeploy" {size} {showLabel} disabled />
- </span>
- {:else if type === 'project'}
- <ButtonGroup.Root>
- <ArcaneButton
- action="redeploy"
- {size}
- {showLabel}
- {disabled}
- title={disabledReason}
- onclick={() => confirmAction('redeploy')}
- loading={uiLoading.redeploy}
- />
- {@render WatchDropdown(() => confirmRedeploy(true), disabled || !!uiLoading.redeploy, size, true)}
- </ButtonGroup.Root>
- {:else}
- <ArcaneButton
- action="redeploy"
- {size}
- {showLabel}
- {disabled}
- title={disabledReason}
- onclick={() => confirmAction('redeploy')}
- loading={uiLoading.redeploy}
- />
- {/if}
- {/if}
+{#snippet watchItem(onWatch: () => void, disabled: boolean, label = m.watch_output())}
+ <DropdownMenu.Item onclick={onWatch} {disabled}>
+ <TerminalIcon class="size-4" />
+ {label}
+ </DropdownMenu.Item>
{/snippet}
-{#snippet RedeployMenuItem()}
- {#if canRedeploy}
- {#if disabled}
- <DropdownMenu.Item disabled title={disabledReason}>
- {m.common_redeploy()}
- </DropdownMenu.Item>
- {:else if disableRedeploy}
- <DropdownMenu.Item disabled title={m.common_redeploy_disabled_arcane_self()}>
- {m.common_redeploy()}
- </DropdownMenu.Item>
- {:else}
- <DropdownMenu.Item onclick={() => confirmAction('redeploy')} disabled={uiLoading.redeploy}>
- {m.common_redeploy()}
- </DropdownMenu.Item>
- {/if}
- {/if}
+{#snippet upMenu(disabled: boolean)}
+ <DeployOptionsMenuItems />
+ <DropdownMenu.Separator />
+ {@render watchItem(() => handleDeploy(undefined, true), disabled)}
{/snippet}
-{#snippet DesktopActions(size: 'default' | 'icon', showLabel: boolean)}
- {@render leadingActions?.(size, showLabel, isLifecycleActionPending)}
-
- {#if !isRunning && canStart}
- {#if type === 'container'}
- <ArcaneButton
- action="start"
- {size}
- {showLabel}
- {disabled}
- title={disabledReason}
- onclick={() => handleStart()}
- loading={uiLoading.start}
- />
- {:else}
- <DeploySplitButton
- {size}
- {showLabel}
- {disabled}
- customLabel={deployButtonLabel}
- onDeploy={() => handleDeploy()}
- onDeployWatch={() => handleDeploy(undefined, true)}
- loading={uiLoading.start}
- />
- {/if}
- {/if}
-
- {#if isRunning}
- {#if canStop}
- <ArcaneButton
- action="stop"
- {size}
- {showLabel}
- {disabled}
- title={disabledReason}
- customLabel={type === 'project' ? m.common_down() : undefined}
- onclick={() => handleStop()}
- loading={uiLoading.stop}
- />
- {/if}
- {#if canRestart}
- <ArcaneButton
- action="restart"
- {size}
- {showLabel}
- {disabled}
- title={disabledReason}
- 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}
- {disabled}
- title={disabledReason}
- onclick={() => handleProjectBuild()}
- loading={uiLoading.build}
- />
- {/if}
-
- {#if canPull}
- <ButtonGroup.Root>
- <ArcaneButton
- action="pull"
- {size}
- {showLabel}
- {disabled}
- title={disabledReason}
- onclick={() => handleProjectPull()}
- loading={uiLoading.pull}
- />
- {@render WatchDropdown(() => handleProjectPull(true), disabled || !!uiLoading.pull, size)}
- </ButtonGroup.Root>
- {/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 redeployMenu(disabled: boolean)}
+ <DeployOptionsMenuItems />
+ <DropdownMenu.Separator />
+ {@render watchItem(() => confirmRedeploy(true), disabled)}
{/snippet}
-{#snippet ActionsMenu()}
- <DropdownMenu.Root>
- <DropdownMenu.Trigger>
- {#snippet child({ props })}
- <button
- {...props}
- type="button"
- class="inline-flex size-9 items-center justify-center rounded-lg border bg-background/70"
- >
- <span class="sr-only">{m.common_open_menu()}</span>
- <EllipsisIcon />
- </button>
- {/snippet}
- </DropdownMenu.Trigger>
-
- <DropdownMenu.Content align="end" class="z-(--arcane-z-surface) min-w-45">
- <DropdownMenu.Group>
- {@render leadingMenuItems?.(isLifecycleActionPending)}
- {#if !isRunning && canStart}
- {#if type === 'container'}
- <DropdownMenu.Item onclick={handleStart} disabled={disabled || uiLoading.start} title={disabledReason}>
- {m.common_start()}
- </DropdownMenu.Item>
- {:else}
- <DropdownMenu.Item onclick={() => handleDeploy()} disabled={disabled || uiLoading.start} title={disabledReason}>
- {deployButtonLabel}
- </DropdownMenu.Item>
- {/if}
- {:else if isRunning}
- {#if canStop}
- <DropdownMenu.Item onclick={handleStop} disabled={disabled || uiLoading.stop} title={disabledReason}>
- {type === 'project' ? m.common_down() : m.common_stop()}
- </DropdownMenu.Item>
- {/if}
- {#if canRestart}
- <DropdownMenu.Item onclick={handleRestart} disabled={disabled || uiLoading.restart} title={disabledReason}>
- {m.common_restart()}
- </DropdownMenu.Item>
- {/if}
- {/if}
-
- {#if type === 'project' && (canStart || canRedeploy)}
- {#if hasLifecycleMenuItems}
- <DropdownMenu.Separator />
- {/if}
- <DeployOptionsMenuItems />
- <DropdownMenu.Separator />
- {/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={disabled || uiLoading.build} title={disabledReason}>
- {m.build()}
- </DropdownMenu.Item>
- {/if}
- {#if canPull}
- <DropdownMenu.Item onclick={() => handleProjectPull()} disabled={disabled || uiLoading.pull} title={disabledReason}>
- {m.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>
+{#snippet pullMenu(disabled: boolean)}
+ {@render watchItem(() => handleProjectPull(true), disabled, m.pull_and_watch_output())}
{/snippet}
-<div class="flex min-w-0 flex-1 justify-end" {@attach observeRoot}>
- {#if tier === 'menu'}
- <div class="flex shrink-0 items-center" {@attach observeRow}>
- {@render ActionsMenu()}
- </div>
- {:else}
- <div class="flex shrink-0 items-center gap-2" {@attach observeRow}>
- {@render DesktopActions(tier === 'labels' ? 'default' : 'icon', tier === 'labels')}
- </div>
- {/if}
-</div>
+<ActionButtonGroup {buttons} class="flex-1" />
diff --git a/frontend/src/lib/components/deploy-split-button/deploy-split-button.svelte b/frontend/src/lib/components/deploy-split-button/deploy-split-button.svelte
deleted file mode 100644
index 2f558fb85..000000000
--- a/frontend/src/lib/components/deploy-split-button/deploy-split-button.svelte
+++ /dev/null
@@ -1,63 +0,0 @@
-<script lang="ts">
- import { ArcaneButton, type ArcaneButtonSize } from '#lib/components/arcane-button/index.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, TerminalIcon } from '#lib/icons/index.js';
- import { m } from '#lib/paraglide/messages.js';
- import { cn } from '#lib/utils.js';
- import DeployOptionsMenuItems from './deploy-options-menu-items.svelte';
-
- let {
- size = 'default',
- showLabel = true,
- loading = false,
- disabled = false,
- customLabel,
- onDeploy,
- onDeployWatch
- }: {
- size?: ArcaneButtonSize;
- showLabel?: boolean;
- loading?: boolean;
- disabled?: boolean;
- customLabel?: string;
- onDeploy: () => void | Promise<void>;
- onDeployWatch?: () => void | Promise<void>;
- } = $props();
-</script>
-
-<ButtonGroup.Root>
- <ArcaneButton action="deploy" {size} {showLabel} {loading} {disabled} {customLabel} onclick={() => onDeploy?.()} />
-
- <DropdownMenu.Root>
- <DropdownMenu.Trigger
- disabled={loading || disabled}
- onclick={(event) => event.stopPropagation()}
- onpointerdown={(event) => event.stopPropagation()}
- >
- {#snippet child({ props })}
- <ArcaneButton
- {...props}
- action="base"
- tone="outline-primary"
- size="icon"
- icon={ArrowDownIcon}
- class={cn(size === 'sm' && 'size-8 rounded-lg', size === 'lg' && 'size-10 rounded-xl')}
- aria-label={m.common_open_menu()}
- />
- {/snippet}
- </DropdownMenu.Trigger>
-
- <DropdownMenu.Content align="end" class="w-72">
- <DeployOptionsMenuItems />
-
- {#if onDeployWatch}
- <DropdownMenu.Separator />
- <DropdownMenu.Item onclick={() => onDeployWatch?.()}>
- <TerminalIcon class="size-4" />
- {m.watch_output()}
- </DropdownMenu.Item>
- {/if}
- </DropdownMenu.Content>
- </DropdownMenu.Root>
-</ButtonGroup.Root>
diff --git a/frontend/src/lib/components/events/events-labels.ts b/frontend/src/lib/components/events/events-labels.ts
index 99aa93d54..98693d7c8 100644
--- a/frontend/src/lib/components/events/events-labels.ts
+++ b/frontend/src/lib/components/events/events-labels.ts
@@ -76,7 +76,7 @@ const categoryLabels: Record<string, () => string> = {
system: m.system,
webhook: m.events_category_webhook,
notification: m.events_category_notification,
- lifecycle: m.security_lifecycle_tab
+ lifecycle: m.lifecycle
};
function eventTypeCategoryLabel(category: string): string {
diff --git a/frontend/src/lib/components/gitops/project-git-backup-summary.svelte b/frontend/src/lib/components/gitops/project-git-backup-summary.svelte
index 1b05068af..32704da73 100644
--- a/frontend/src/lib/components/gitops/project-git-backup-summary.svelte
+++ b/frontend/src/lib/components/gitops/project-git-backup-summary.svelte
@@ -3,9 +3,11 @@
import { createQuery, useQueryClient } from '@tanstack/svelte-query';
import { toast } from 'svelte-sonner';
import * as DropdownMenu from '#lib/components/ui/dropdown-menu/index.js';
+ import * as Empty from '#lib/components/ui/empty/index.js';
import RowActionsMenu from '#lib/components/arcane-table/row-actions-menu.svelte';
import { ArcaneButton } from '#lib/components/arcane-button/index.js';
- import { DetailMetaStrip, DetailSection, type DetailMetaItem } from '#lib/components/resource-detail/index.js';
+ import StatCard from '#lib/components/stat-card.svelte';
+ import MetricRing from '#lib/components/metric-ring.svelte';
import BackupStateBadge from './backup-state-badge.svelte';
import BackupHistoryDialog from './backup-history-dialog.svelte';
import BackupResolveDialog from './backup-resolve-dialog.svelte';
@@ -15,9 +17,25 @@
import { tryCatch } from '#lib/utils/try-catch.js';
import { confirmAndRun } from '#lib/utils/bulk-actions.js';
import { hasPermission } from '#lib/utils/auth.js';
- import { formatDateTimeShort } from '#lib/utils/formatting.js';
+ import { formatDateTimeShort, formatRelativeTime } from '#lib/utils/formatting.js';
+ import { syncedPaths } from '#lib/utils/gitops.js';
+ import { Spinner } from '#lib/components/ui/spinner/index.js';
+ import { cn } from '#lib/utils.js';
import { m } from '#lib/paraglide/messages.js';
- import { ClockIcon, GitBranchIcon, SettingsIcon, TrashIcon, UploadIcon, ShieldAlertIcon } from '#lib/icons/index.js';
+ import type { GitOpsBackupHistoryEntry, GitOpsBackupState } from '#lib/types/automation.js';
+ import {
+ ClockIcon,
+ FileTextIcon,
+ GitBranchIcon,
+ SaveIcon,
+ SettingsIcon,
+ TrashIcon,
+ UploadIcon,
+ ShieldAlertIcon,
+ CheckIcon,
+ AlertIcon,
+ PauseIcon
+ } from '#lib/icons/index.js';
let {
environmentId,
@@ -47,39 +65,57 @@
}));
const sync = $derived(backups.data?.data?.[0] ?? null);
+
const canBackup = $derived(hasPermission('gitops:backup', environmentId));
+
+ const RECENT_LIMIT = 5;
+ const history = createQuery(() => ({
+ queryKey: queryKeys.gitOpsSyncs.backupHistory(environmentId, sync?.id ?? '', RECENT_LIMIT),
+ queryFn: () => gitOpsSyncService.getBackupHistory(environmentId, sync!.id, RECENT_LIMIT),
+ enabled: !!sync && canBackup
+ }));
+ const recentEntries = $derived<GitOpsBackupHistoryEntry[]>(history.data?.entries ?? []);
+ // Tracked snapshot paths from the last successful backup, not the commit's changed files.
+ const snapshotFiles = $derived(sync ? syncedPaths(sync).length : 0);
+ const fileLimit = $derived(sync?.maxSyncFiles ?? 0);
+ const filePercent = $derived(fileLimit > 0 ? (snapshotFiles / fileLimit) * 100 : 0);
+
const canCreate = $derived(canBackup && hasPermission('gitops:create', environmentId));
const canRun = $derived(canBackup && hasPermission('gitops:sync', environmentId));
const canEdit = $derived(canBackup && hasPermission('gitops:update', environmentId));
const canDisconnect = $derived(canBackup && hasPermission('gitops:delete', environmentId));
- const needsAttention = $derived(sync?.backupState === 'needs_attention');
- const showError = $derived(!!sync?.lastSyncError && (sync?.backupState === 'failed' || needsAttention));
+ const backupState = $derived<GitOpsBackupState>(sync?.backupState ?? 'never');
+ const needsAttention = $derived(backupState === 'needs_attention');
+ const showError = $derived(!!sync?.lastSyncError && (backupState === 'failed' || needsAttention));
const createHref = $derived(`/environments/${environmentId}/gitops?action=create&mode=backup&projectId=${projectId}`);
-
- const metaItems = $derived.by<DetailMetaItem[]>(() => {
- if (!sync) return [];
+ const destination = $derived.by(() => {
+ if (!sync) return '';
const repository = sync.repository?.name ?? sync.repositoryId;
const directory = sync.backupDirectory ? ` / ${sync.backupDirectory}` : '';
- return [
- {
- icon: GitBranchIcon,
- label: m.destination(),
- value: `${repository} · ${sync.branch}${directory}`,
- mono: true
- },
- {
- icon: UploadIcon,
- label: m.last_backup(),
- value: sync.lastBackupAt ? formatDateTimeShort(sync.lastBackupAt) : m.common_never()
- },
- {
- icon: ClockIcon,
- label: m.last_check(),
- value: sync.lastSyncAt ? formatDateTimeShort(sync.lastSyncAt) : m.common_never()
- }
- ];
+ return `${repository} · ${sync.branch}${directory}`;
+ });
+
+ const stateVisual = $derived.by(() => {
+ switch (backupState) {
+ case 'backed_up':
+ return { icon: CheckIcon, color: 'text-success', bg: 'bg-success/10 ring-success/30' };
+ case 'pending':
+ case 'backing_up':
+ return { icon: UploadIcon, color: 'text-warning', bg: 'bg-warning/10 ring-warning/30' };
+ case 'failed':
+ case 'needs_attention':
+ return { icon: AlertIcon, color: 'text-destructive', bg: 'bg-destructive/10 ring-destructive/30' };
+ case 'paused':
+ return { icon: PauseIcon, color: 'text-muted-foreground', bg: 'bg-muted ring-border' };
+ default:
+ return { icon: GitBranchIcon, color: 'text-muted-foreground', bg: 'bg-muted ring-border' };
+ }
});
+ function firstLine(message: string): string {
+ return message.split('\n')[0] ?? message;
+ }
+
async function invalidate() {
await queryClient.invalidateQueries({ queryKey: queryKeys.gitOpsSyncs.all });
await queryClient.invalidateQueries({ queryKey: queryKeys.gitOpsSyncs.projectBackup(environmentId, projectId) });
@@ -120,19 +156,47 @@
}
</script>
-<DetailSection title={m.git_backup()} icon={GitBranchIcon} class="mb-4 space-y-3 border-t-0 pt-0">
- {#if !sync}
- <div class="flex flex-wrap items-center justify-between gap-3 rounded-lg border border-border/50 px-4 py-3">
- <p class="text-sm text-muted-foreground">{m.not_backed_up_to_git()}</p>
+{#if !sync}
+ <div class="rounded-xl border border-dashed border-border/70">
+ <Empty.Root>
+ <Empty.Header>
+ <Empty.Media variant="icon">
+ <GitBranchIcon />
+ </Empty.Media>
+ <Empty.Title>{m.not_backed_up_to_git()}</Empty.Title>
+ <Empty.Description>{m.back_up_to_git_description()}</Empty.Description>
+ </Empty.Header>
{#if canCreate}
- <ArcaneButton action="base" tone="outline-primary" href={createHref} icon={UploadIcon} customLabel={m.back_up_to_git()} />
+ <Empty.Content>
+ <ArcaneButton
+ action="base"
+ tone="outline-primary"
+ href={createHref}
+ icon={UploadIcon}
+ customLabel={m.back_up_to_git()}
+ />
+ </Empty.Content>
{/if}
- </div>
- {:else}
- <DetailMetaStrip items={metaItems}>
- <BackupStateBadge {sync} />
-
- <div class="ml-auto flex items-center gap-2">
+ </Empty.Root>
+ </div>
+{:else}
+ {@const StateIcon = stateVisual.icon}
+ <div class="space-y-4">
+ <div class="flex flex-wrap items-center gap-4 rounded-xl border border-border/70 bg-card/60 p-4 backdrop-blur-md">
+ <div class={cn('flex size-12 shrink-0 items-center justify-center rounded-full ring-1 ring-inset', stateVisual.bg)}>
+ <StateIcon class={cn('size-6', stateVisual.color)} />
+ </div>
+ <div class="min-w-0 flex-1 space-y-1">
+ <div class="flex flex-wrap items-center gap-2">
+ <h3 class="text-base font-semibold">{m.git_backup()}</h3>
+ <BackupStateBadge {sync} />
+ </div>
+ <p class="flex items-center gap-1.5 truncate font-mono text-xs text-muted-foreground" title={destination}>
+ <GitBranchIcon class="size-3.5 shrink-0" />
+ {destination}
+ </p>
+ </div>
+ <div class="flex items-center gap-2">
{#if canRun}
<ArcaneButton
action="base"
@@ -178,13 +242,97 @@
</RowActionsMenu>
{/if}
</div>
- </DetailMetaStrip>
+ </div>
{#if showError}
- <p class="text-sm break-words text-destructive">{sync.lastSyncError}</p>
+ <p class="rounded-lg border border-destructive/30 bg-destructive/5 px-4 py-3 text-sm break-words text-destructive">
+ {sync.lastSyncError}
+ </p>
+ {/if}
+
+ <div class="grid gap-3 sm:grid-cols-2 xl:grid-cols-4">
+ <div
+ class="hover-lift flex items-center justify-between gap-3 rounded-xl border border-border/70 bg-card/60 p-4 backdrop-blur-md"
+ >
+ <div class="space-y-2">
+ <p class="text-sm font-medium tracking-wide text-muted-foreground">{m.files_in_last_backup()}</p>
+ <h3 class="text-2xl font-semibold tracking-tight tabular-nums">{snapshotFiles}</h3>
+ {#if fileLimit > 0}
+ <p class="text-xs text-muted-foreground">{m.file_limit({ limit: fileLimit })}</p>
+ {/if}
+ </div>
+ <MetricRing variant="backup" percent={filePercent} size={44} stroke={5} />
+ </div>
+ <StatCard
+ title={m.last_backup()}
+ value={sync.lastBackupAt ? formatRelativeTime(sync.lastBackupAt) : m.common_never()}
+ subtitle={sync.lastBackupAt ? formatDateTimeShort(sync.lastBackupAt) : undefined}
+ icon={UploadIcon}
+ iconColor="text-success"
+ bgColor="bg-success/10"
+ />
+ <StatCard
+ title={m.last_check()}
+ value={sync.lastSyncAt ? formatRelativeTime(sync.lastSyncAt) : m.common_never()}
+ subtitle={sync.lastSyncAt ? formatDateTimeShort(sync.lastSyncAt) : undefined}
+ icon={ClockIcon}
+ />
+ <StatCard
+ title={m.common_mode()}
+ value={sync.backupOnSave ? m.on_save() : m.backups_trigger_manual()}
+ icon={SaveIcon}
+ iconColor="text-info"
+ bgColor="bg-info/10"
+ />
+ </div>
+
+ {#if canBackup}
+ <div class="rounded-xl border border-border/70 bg-card/60 backdrop-blur-md">
+ <div class="flex items-center justify-between gap-2 border-b border-border/50 px-4 py-3">
+ <h3 class="flex items-center gap-2 text-sm font-medium">
+ <ClockIcon class="size-4" />
+ {m.recent_backups()}
+ </h3>
+ {#if recentEntries.length > 0}
+ <ArcaneButton
+ action="base"
+ tone="ghost"
+ size="sm"
+ customLabel={m.common_view_all()}
+ onclick={() => (historyOpen = true)}
+ />
+ {/if}
+ </div>
+ {#if history.isPending}
+ <div class="flex items-center gap-2 px-4 py-6 text-sm text-muted-foreground">
+ <Spinner class="size-4" />
+ {m.common_loading()}
+ </div>
+ {:else if history.isError}
+ <p class="px-4 py-6 text-sm text-destructive">{m.backup_history_load_failed()}</p>
+ {:else if recentEntries.length === 0}
+ <p class="px-4 py-6 text-sm text-muted-foreground">{m.backup_history_empty()}</p>
+ {:else}
+ <ul class="divide-y divide-border/50">
+ {#each recentEntries as entry (entry.commit)}
+ <li class="flex flex-wrap items-center gap-x-3 gap-y-1 px-4 py-2.5 text-sm">
+ <code class="rounded bg-muted px-1.5 py-0.5 font-mono text-xs">{entry.commit.slice(0, 7)}</code>
+ <span class="min-w-0 flex-1 truncate font-medium">{firstLine(entry.message)}</span>
+ <span class="flex items-center gap-1 text-xs text-muted-foreground">
+ <FileTextIcon class="size-3.5" />
+ {m.changed_files_count({ count: entry.files.length })}
+ </span>
+ <span class="text-xs text-muted-foreground" title={formatDateTimeShort(entry.date)}
+ >{formatRelativeTime(entry.date)}</span
+ >
+ </li>
+ {/each}
+ </ul>
+ {/if}
+ </div>
{/if}
- {/if}
-</DetailSection>
+ </div>
+{/if}
<BackupHistoryDialog bind:open={historyOpen} {environmentId} {sync} />
<BackupResolveDialog bind:open={resolveOpen} {environmentId} {sync} onResolved={invalidate} />
diff --git a/frontend/src/lib/components/metric-ring.svelte b/frontend/src/lib/components/metric-ring.svelte
index 1fed57279..537273ca0 100644
--- a/frontend/src/lib/components/metric-ring.svelte
+++ b/frontend/src/lib/components/metric-ring.svelte
@@ -1,5 +1,5 @@
<script module lang="ts">
- export type MetricRingVariant = 'cpu' | 'memory' | 'disk';
+ export type MetricRingVariant = 'cpu' | 'memory' | 'disk' | 'backup';
let uidCounter = 0;
function nextUid() {
@@ -9,7 +9,8 @@
const gradientStops: Record<MetricRingVariant, [string, string]> = {
cpu: ['oklch(0.75 0.18 35)', 'oklch(0.65 0.24 25)'],
memory: ['oklch(0.72 0.18 300)', 'oklch(0.58 0.25 290)'],
- disk: ['oklch(0.78 0.15 195)', 'oklch(0.62 0.16 220)']
+ disk: ['oklch(0.78 0.15 195)', 'oklch(0.62 0.16 220)'],
+ backup: ['oklch(0.72 0.17 150)', 'oklch(0.6 0.19 160)']
};
</script>
diff --git a/frontend/src/lib/components/swarm/swarm-kv-page.svelte b/frontend/src/lib/components/swarm/swarm-kv-page.svelte
index 55fb3ca3a..9de06b0d3 100644
--- a/frontend/src/lib/components/swarm/swarm-kv-page.svelte
+++ b/frontend/src/lib/components/swarm/swarm-kv-page.svelte
@@ -173,7 +173,9 @@
const actionButtons: ActionButton[] = $derived([
{
id: 'refresh',
- action: 'restart',
+ action: 'refresh',
+ placement: 'secondary',
+ iconOnly: true,
label: m.common_refresh(),
onclick: refresh,
loading: isLoading.refresh,
diff --git a/frontend/src/lib/components/ui/select/select-content.svelte b/frontend/src/lib/components/ui/select/select-content.svelte
index af42de5b1..8bf87a4a7 100644
--- a/frontend/src/lib/components/ui/select/select-content.svelte
+++ b/frontend/src/lib/components/ui/select/select-content.svelte
@@ -8,7 +8,7 @@
ref = $bindable(null),
class: className,
sideOffset = 4,
- align = 'center',
+ align = 'end',
portalProps,
children,
...restProps
diff --git a/frontend/src/lib/layouts/index.ts b/frontend/src/lib/layouts/index.ts
index ff309a468..99609f47f 100644
--- a/frontend/src/lib/layouts/index.ts
+++ b/frontend/src/lib/layouts/index.ts
@@ -1,4 +1,3 @@
export { default as ResourcePageLayout, type ActionButton, type StatCardConfig } from './resource-page-layout.svelte';
export { default as SettingsPageLayout } from './settings-page-layout.svelte';
-export type { SettingsActionButton, DetailAction } from './types.js';
export { default as ResourceDetailLayout } from './resource-detail-layout.svelte';
diff --git a/frontend/src/lib/layouts/resource-detail-layout.svelte b/frontend/src/lib/layouts/resource-detail-layout.svelte
index f20c1c64b..dd3efc315 100644
--- a/frontend/src/lib/layouts/resource-detail-layout.svelte
+++ b/frontend/src/lib/layouts/resource-detail-layout.svelte
@@ -1,17 +1,17 @@
<script lang="ts">
import { ArcaneButton } from '#lib/components/arcane-button/index.js';
- import * as DropdownMenu from '#lib/components/ui/dropdown-menu/index.js';
+ import ActionButtonGroup from '#lib/components/action-button-group/action-button-group.svelte';
+ import type { ActionButton } from '#lib/components/action-button-group/types.js';
import { cn } from '#lib/utils.js';
- import { ArrowLeftIcon, EllipsisIcon } from '#lib/icons/index.js';
+ import { ArrowLeftIcon } from '#lib/icons/index.js';
import type { Snippet } from 'svelte';
- import type { DetailAction } from './types.js';
interface Props {
backUrl?: string;
backLabel?: string;
title: string;
subtitle?: string;
- actions?: DetailAction[];
+ actions?: ActionButton[];
badges?: Snippet;
headerExtra?: Snippet;
children: Snippet;
@@ -32,34 +32,10 @@
let scrollY = $state(0);
const showFloatingHeader = $derived(scrollY > 120);
-
- const primaryAction = $derived(actions[0]);
- const secondaryActions = $derived(actions.slice(1));
</script>
<svelte:window bind:scrollY />
-{#snippet ActionMenu(items: DetailAction[], tone: 'ghost' | 'outline')}
- {#if items.length > 0}
- <DropdownMenu.Root>
- <DropdownMenu.Trigger>
- {#snippet child({ props })}
- <ArcaneButton {...props} action="base" {tone} size="icon" class={tone === 'ghost' ? 'size-8' : 'size-9'}>
- <EllipsisIcon class="size-4" />
- </ArcaneButton>
- {/snippet}
- </DropdownMenu.Trigger>
- <DropdownMenu.Content align="end" class={tone === 'ghost' ? 'min-w-35' : 'min-w-40'}>
- {#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>
- </DropdownMenu.Root>
- {/if}
-{/snippet}
-
{#if showFloatingHeader}
<div
class="fixed top-4 left-1/2 z-(--arcane-z-page-floating) w-full-inset max-w-fit -translate-x-1/2 animate-in px-2 duration-200 fade-in slide-in-from-top-2 sm:w-auto sm:px-0"
@@ -77,18 +53,9 @@
<span class="max-w-50 truncate text-sm font-semibold">{title}</span>
- {#if primaryAction}
+ {#if actions.length > 0}
<div class="h-4 w-px bg-border/60"></div>
- <div class="flex items-center gap-1.5">
- <ArcaneButton
- action={primaryAction.action}
- customLabel={primaryAction.label}
- loading={primaryAction.loading}
- disabled={primaryAction.disabled}
- onclick={primaryAction.onclick}
- />
- {@render ActionMenu(secondaryActions, 'ghost')}
- </div>
+ <ActionButtonGroup buttons={actions} size="sm" />
{/if}
</div>
</div>
@@ -96,32 +63,16 @@
<div class={cn('space-y-6 pb-8', className)}>
<div class="space-y-4">
- <div class="flex items-center justify-between">
- {#if backUrl}
+ {#if backUrl}
+ <div>
<ArcaneButton action="base" tone="ghost" href={backUrl} class="-ml-2">
<ArrowLeftIcon class="size-4" />
{backLabel}
</ArcaneButton>
- {:else}
- <span></span>
- {/if}
-
- <div class="flex items-center gap-2 sm:hidden">
- {#if actions.length === 1 && primaryAction}
- <ArcaneButton
- action={primaryAction.action}
- customLabel={primaryAction.label}
- loading={primaryAction.loading}
- disabled={primaryAction.disabled}
- onclick={primaryAction.onclick}
- />
- {:else}
- {@render ActionMenu(actions, 'outline')}
- {/if}
</div>
- </div>
+ {/if}
- <div class="flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between">
+ <div class="flex items-start justify-between gap-4">
<div class="min-w-0 flex-1 space-y-2">
<h1 class="text-xl font-semibold tracking-tight break-all sm:text-2xl">{title}</h1>
{#if subtitle}
@@ -134,18 +85,7 @@
{/if}
</div>
- <div class="hidden shrink-0 items-center gap-2 sm:flex">
- {#each actions as act (act.id)}
- <ArcaneButton
- action={act.action}
- customLabel={act.label}
- loadingLabel={act.loadingLabel}
- loading={act.loading}
- disabled={act.disabled}
- onclick={act.onclick}
- />
- {/each}
- </div>
+ <ActionButtonGroup buttons={actions} class="shrink-0" />
</div>
{@render headerExtra?.()}
diff --git a/frontend/src/lib/layouts/settings-page-layout.svelte b/frontend/src/lib/layouts/settings-page-layout.svelte
index 723c096d7..073f81d9a 100644
--- a/frontend/src/lib/layouts/settings-page-layout.svelte
+++ b/frontend/src/lib/layouts/settings-page-layout.svelte
@@ -4,11 +4,12 @@
import { UiConfigDisabledTag } from '#lib/components/badges/index.js';
import StatCard from '#lib/components/stat-card.svelte';
import { ArcaneButton } from '#lib/components/arcane-button/index.js';
- import * as DropdownMenu from '#lib/components/ui/dropdown-menu/index.js';
+ import ActionButtonGroup from '#lib/components/action-button-group/action-button-group.svelte';
+ import type { ActionButton } from '#lib/components/action-button-group/types.js';
import { m } from '#lib/paraglide/messages.js';
- import { EllipsisIcon, ResetIcon, type IconType, ArrowDownIcon } from '#lib/icons/index.js';
+ import { ResetIcon, type IconType } from '#lib/icons/index.js';
import { cn } from '#lib/utils.js';
- import type { SettingsActionButton, SettingsActionOption, SettingsPageType, SettingsStatCard } from './types.js';
+ import type { SettingsPageType, SettingsStatCard } from './types.js';
interface Props {
title: string;
@@ -16,7 +17,7 @@
icon: IconType;
pageType?: SettingsPageType;
showReadOnlyTag?: boolean;
- actionButtons?: SettingsActionButton[];
+ actionButtons?: ActionButton[];
statCards?: SettingsStatCard[];
mainContent: Snippet;
additionalContent?: Snippet;
@@ -36,64 +37,10 @@
class: className = ''
}: Props = $props();
- const mobileVisibleButtons = $derived(actionButtons.filter((btn) => btn.showOnMobile));
- const mobileDropdownButtons = $derived(actionButtons.filter((btn) => !btn.showOnMobile));
-
const formContext = hasSettingsFormContext() ? getSettingsFormContext() : undefined;
const formState = $derived(formContext?.activeForm);
</script>
-{#snippet ActionOptions(options: SettingsActionOption[], disabled = false, showIcons = true)}
- {#each options as option (option)}
- <DropdownMenu.Item onclick={option.onclick} disabled={disabled || option.disabled}>
- {#if showIcons && option.icon}
- {@const OptionIcon = option.icon}
- <OptionIcon class="size-4" />
- {/if}
- {option.label}
- </DropdownMenu.Item>
- {/each}
-{/snippet}
-
-{#snippet ActionButtonList(buttons: SettingsActionButton[])}
- {#each buttons as button (button.id)}
- {#if button.options?.length}
- <DropdownMenu.Root>
- <DropdownMenu.Trigger>
- {#snippet child({ props })}
- <ArcaneButton
- {...props}
- action={button.action}
- icon={button.icon}
- customLabel={button.label}
- disabled={button.disabled}
- size={button.size ?? 'default'}
- >
- <ArrowDownIcon class="size-3.5 opacity-60" />
- </ArcaneButton>
- {/snippet}
- </DropdownMenu.Trigger>
- <DropdownMenu.Content align="end" class="z-(--arcane-z-surface) min-w-40">
- <DropdownMenu.Group>
- {@render ActionOptions(button.options)}
- </DropdownMenu.Group>
- </DropdownMenu.Content>
- </DropdownMenu.Root>
- {:else}
- <ArcaneButton
- action={button.action}
- icon={button.icon}
- customLabel={button.label}
- loadingLabel={button.loadingLabel}
- loading={button.loading}
- disabled={button.disabled}
- onclick={button.onclick}
- size={button.size ?? 'default'}
- />
- {/if}
- {/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-b border-border/50 pb-4 sm:pb-6">
<div class="flex items-center justify-between gap-4">
@@ -168,41 +115,7 @@
{/if}
{#if pageType === 'management' && actionButtons.length > 0}
- <div class="hidden items-center gap-2 sm:flex">
- {@render ActionButtonList(actionButtons)}
- </div>
-
- <div class="flex items-center gap-2 sm:hidden">
- {@render ActionButtonList(mobileVisibleButtons)}
-
- {#if mobileDropdownButtons.length > 0}
- <DropdownMenu.Root>
- <DropdownMenu.Trigger>
- {#snippet child({ props })}
- <ArcaneButton {...props} action="base" tone="ghost" size="icon" class="size-8 border bg-background/70">
- <span class="sr-only">{m.common_open_menu()}</span>
- <EllipsisIcon class="size-4" />
- </ArcaneButton>
- {/snippet}
- </DropdownMenu.Trigger>
-
- <DropdownMenu.Content align="end" class="z-(--arcane-z-surface) min-w-40">
- <DropdownMenu.Group>
- {#each mobileDropdownButtons as button (button.id)}
- {#if button.options?.length}
- <DropdownMenu.Label>{button.label}</DropdownMenu.Label>
- {@render ActionOptions(button.options, button.disabled, false)}
- {:else}
- <DropdownMenu.Item onclick={button.onclick} disabled={button.disabled || button.loading}>
- {button.loading ? button.loadingLabel || button.label : button.label}
- </DropdownMenu.Item>
- {/if}
- {/each}
- </DropdownMenu.Group>
- </DropdownMenu.Content>
- </DropdownMenu.Root>
- {/if}
- </div>
+ <ActionButtonGroup buttons={actionButtons} />
{/if}
</div>
</div>
diff --git a/frontend/src/lib/layouts/tabbed-page-layout.svelte b/frontend/src/lib/layouts/tabbed-page-layout.svelte
index a4f8b714d..75a8ba371 100644
--- a/frontend/src/lib/layouts/tabbed-page-layout.svelte
+++ b/frontend/src/lib/layouts/tabbed-page-layout.svelte
@@ -61,8 +61,6 @@
</div>
</div>
{#if headerActions}
- <!-- basis-0: the column's width never depends on its content, so the
- self-measuring actions inside cannot feed back into their own space. -->
<div class="flex min-w-9 flex-1 basis-0 items-center justify-end gap-2">
{@render headerActions()}
</div>
diff --git a/frontend/src/lib/layouts/types.ts b/frontend/src/lib/layouts/types.ts
index 4e3bdd85e..af228f54c 100644
--- a/frontend/src/lib/layouts/types.ts
+++ b/frontend/src/lib/layouts/types.ts
@@ -1,28 +1,5 @@
-import type { Action, ArcaneButtonSize } from '#lib/components/arcane-button/index.js';
import type { IconType } from '#lib/icons/index.js';
-export interface SettingsActionOption {
- label: string;
- icon?: IconType;
- onclick: () => void;
- disabled?: boolean;
-}
-
-export interface SettingsActionButton {
- id: string;
- action: Action;
- icon?: IconType;
- label: string;
- loadingLabel?: string;
- loading?: boolean;
- disabled?: boolean;
- size?: ArcaneButtonSize;
- onclick?: () => void;
- // When set, the button renders as a dropdown trigger and onclick is unused.
- options?: SettingsActionOption[];
- showOnMobile?: boolean;
-}
-
export interface SettingsStatCard {
title: string;
value: string | number;
@@ -34,13 +11,3 @@ export interface SettingsStatCard {
}
export type SettingsPageType = 'form' | 'management';
-
-export interface DetailAction {
- id: string;
- action: Action;
- label: string;
- loadingLabel?: string;
- loading?: boolean;
- disabled?: boolean;
- onclick: () => void;
-}
diff --git a/frontend/src/lib/query/query-keys.ts b/frontend/src/lib/query/query-keys.ts
index 5194acaab..f3c2aa2de 100644
--- a/frontend/src/lib/query/query-keys.ts
+++ b/frontend/src/lib/query/query-keys.ts
@@ -168,7 +168,8 @@ export const queryKeys = {
projectBackup: (environmentId: string, projectId: string) =>
['gitops-syncs', environmentId, 'project-backup', projectId] as const,
backupPreview: (environmentId: string, syncId: string) => ['gitops-syncs', environmentId, syncId, 'backup-preview'] as const,
- backupHistory: (environmentId: string, syncId: string) => ['gitops-syncs', environmentId, syncId, 'backup-history'] as const,
+ backupHistory: (environmentId: string, syncId: string, limit?: number) =>
+ ['gitops-syncs', environmentId, syncId, 'backup-history', limit ?? 'all'] as const,
backupRevision: (environmentId: string, syncId: string, commit: string) =>
['gitops-syncs', environmentId, syncId, 'backup-revision', commit] as const
},
diff --git a/frontend/src/lib/utils/gitops.ts b/frontend/src/lib/utils/gitops.ts
index 73c7d8e6d..c7338d42d 100644
--- a/frontend/src/lib/utils/gitops.ts
+++ b/frontend/src/lib/utils/gitops.ts
@@ -6,7 +6,7 @@ function composeDirectory(sync: GitOpsSync): string {
}
// Mirrors the backend's workspace lock, which deliberately omits the project-root .env.
-function syncedPaths(sync: GitOpsSync): string[] {
+export function syncedPaths(sync: GitOpsSync): string[] {
try {
const parsed: unknown = JSON.parse(sync.syncedFiles ?? '[]');
return Array.isArray(parsed) ? parsed.filter((entry) => typeof entry === 'string' && entry) : [];
diff --git a/frontend/src/lib/utils/resource-actions.ts b/frontend/src/lib/utils/resource-actions.ts
index 86da1df59..8db1927dc 100644
--- a/frontend/src/lib/utils/resource-actions.ts
+++ b/frontend/src/lib/utils/resource-actions.ts
@@ -1,4 +1,4 @@
-import type { ActionButton } from '#lib/layouts/index.js';
+import type { ActionButton } from '#lib/components/action-button-group/types.js';
type CreateRefreshActionOptions = {
create?: {
@@ -22,13 +22,16 @@ export function createRefreshActionButtons({
buttons.push({
id: 'create',
action: 'create',
+ placement: 'primary',
label: create.label,
onclick: create.onclick
});
}
buttons.push({
id: 'refresh',
- action: 'restart',
+ action: 'refresh',
+ placement: 'secondary',
+ iconOnly: true,
label: refreshLabel,
onclick: onRefresh,
loading: refreshing,
diff --git a/frontend/src/routes/(app)/account/account-security-panel.svelte b/frontend/src/routes/(app)/account/account-security-panel.svelte
index 73eb651e4..40d0a3456 100644
--- a/frontend/src/routes/(app)/account/account-security-panel.svelte
+++ b/frontend/src/routes/(app)/account/account-security-panel.svelte
@@ -117,7 +117,7 @@
<div class="flex items-center gap-2">
<ShieldAlertIcon class="size-4 text-destructive" />
<div>
- <h2 class="text-base font-semibold tracking-tight sm:text-lg">{m.account_danger_zone()}</h2>
+ <h2 class="text-base font-semibold tracking-tight sm:text-lg">{m.danger_zone()}</h2>
<p class="mt-1 text-xs text-muted-foreground sm:text-sm">{m.account_danger_zone_desc()}</p>
</div>
</div>
diff --git a/frontend/src/routes/(app)/containers/+page.svelte b/frontend/src/routes/(app)/containers/+page.svelte
index cee4935db..3eaafa21d 100644
--- a/frontend/src/routes/(app)/containers/+page.svelte
+++ b/frontend/src/routes/(app)/containers/+page.svelte
@@ -128,6 +128,7 @@
? {
id: 'create',
action: 'create',
+ placement: 'primary',
label: m.common_create_button({ resource: m.container() }),
onclick: () => goto('/containers/new'),
disabled: !resourcesReady
@@ -145,7 +146,9 @@
: null,
{
id: 'refresh',
- action: 'restart',
+ action: 'refresh',
+ placement: 'secondary',
+ iconOnly: true,
label: m.common_refresh(),
onclick: refresh,
loading: isRefreshing,
diff --git a/frontend/src/routes/(app)/containers/[containerId]/+page.svelte b/frontend/src/routes/(app)/containers/[containerId]/+page.svelte
index bcb036edc..88a3230e3 100644
--- a/frontend/src/routes/(app)/containers/[containerId]/+page.svelte
+++ b/frontend/src/routes/(app)/containers/[containerId]/+page.svelte
@@ -1,7 +1,6 @@
<script lang="ts">
import { tryCatch } from '#lib/utils/try-catch.js';
- import { ArcaneButton, type ArcaneButtonSize } from '#lib/components/arcane-button/index.js';
import { goto, refreshAll } from '$app/navigation';
import settingsStore from '#lib/stores/config-store.svelte.js';
import ActionButtons from '#lib/components/action-buttons.svelte';
@@ -50,8 +49,8 @@
import { projectWorkspaceService } from '#lib/services/project-workspace-service.js';
import { environmentStore } from '#lib/stores/environment.store.svelte.js';
import { hasPermission } from '#lib/utils/auth.js';
- import * as DropdownMenu from '#lib/components/ui/dropdown-menu/index.js';
- import { EditIcon, ImagesIcon, PauseIcon, PlayIcon, ProjectsIcon, UpdateIcon, ZapIcon } from '#lib/icons/index.js';
+ import type { ActionButton } from '#lib/components/action-button-group/types.js';
+ import { EditIcon, ProjectsIcon } from '#lib/icons/index.js';
import { runContainerLifecycleAction, confirmAndUpdateContainer } from '#lib/utils/container-actions.js';
import { useQueryClient } from '@tanstack/svelte-query';
import { queryKeys } from '#lib/query/query-keys.js';
@@ -376,6 +375,73 @@
return '/containers';
});
+
+ const containerExtraActions = $derived.by((): ActionButton[] => {
+ if (!container) return [];
+ const list: ActionButton[] = [];
+ if (canEditContainer) {
+ list.push({
+ id: 'edit',
+ action: 'edit',
+ label: m.common_edit(),
+ icon: EditIcon,
+ group: 'manage',
+ href: `/containers/${container.id}/edit`
+ });
+ }
+ if (canConvertToCompose) {
+ list.push({
+ id: 'convert',
+ action: 'base',
+ label: m.compose_convert_action(),
+ icon: ProjectsIcon,
+ group: 'manage',
+ href: `/projects/new?fromContainers=${container.id}&fromEnv=${encodeURIComponent(currentEnvId)}`
+ });
+ }
+ if (canUpdateContainer && updateInfo?.hasUpdate) {
+ list.push({
+ id: 'update',
+ action: 'update',
+ label: m.update_container(),
+ group: 'manage',
+ loading: updateLoading,
+ onclick: handleUpdateContainer
+ });
+ }
+ if (canPauseContainer && (isContainerPaused || isContainerRunning)) {
+ list.push({
+ id: 'pause',
+ action: isContainerPaused ? 'unpause' : 'pause',
+ label: isContainerPaused ? m.common_unpause() : m.common_pause(),
+ group: 'lifecycle',
+ loading: lifecycleStatus !== '',
+ disabled: isLifecycleActionPending,
+ onclick: isContainerPaused ? handleUnpauseContainer : handlePauseContainer
+ });
+ }
+ if (canCommitImage) {
+ list.push({
+ id: 'commit',
+ action: 'commit',
+ label: m.commit(),
+ group: 'manage',
+ onclick: () => (commitDialogOpen = true)
+ });
+ }
+ if (canKillContainer && (isContainerRunning || isContainerPaused)) {
+ list.push({
+ id: 'kill',
+ action: 'kill',
+ label: m.common_kill(),
+ group: 'danger',
+ destructive: true,
+ disabled: isLifecycleActionPending,
+ onclick: () => (killDialogOpen = true)
+ });
+ }
+ return list;
+ });
</script>
{#snippet containerHeader(container: ContainerDetailsDto)}
@@ -426,120 +492,6 @@
{/await}
{/snippet}
-{#snippet containerLifecycleButtons(
- container: ContainerDetailsDto,
- size: ArcaneButtonSize,
- showLabel: boolean,
- actionButtonsLifecyclePending: boolean
-)}
- {#if canEditContainer}
- <ArcaneButton
- action="base"
- {size}
- {showLabel}
- customLabel={m.common_edit()}
- icon={EditIcon}
- disabled={actionButtonsLifecyclePending}
- href={`/containers/${container.id}/edit`}
- />
- {/if}
- {#if canConvertToCompose}
- <ArcaneButton
- action="base"
- {size}
- {showLabel}
- customLabel={m.compose_convert_action()}
- icon={ProjectsIcon}
- disabled={actionButtonsLifecyclePending}
- href={`/projects/new?fromContainers=${container.id}&fromEnv=${encodeURIComponent(currentEnvId)}`}
- />
- {/if}
- {#if canUpdateContainer && updateInfo?.hasUpdate}
- <ArcaneButton
- action="base"
- {size}
- {showLabel}
- customLabel={m.update_container()}
- icon={UpdateIcon}
- loading={updateLoading}
- disabled={updateLoading || actionButtonsLifecyclePending}
- onclick={handleUpdateContainer}
- />
- {/if}
- {#if canPauseContainer && (isContainerPaused || isContainerRunning)}
- <ArcaneButton
- action={isContainerPaused ? 'unpause' : 'pause'}
- {size}
- {showLabel}
- loading={lifecycleStatus === (isContainerPaused ? 'unpausing' : 'pausing')}
- disabled={isLifecycleActionPending || actionButtonsLifecyclePending}
- onclick={isContainerPaused ? handleUnpauseContainer : handlePauseContainer}
- />
- {/if}
- {#if canCommitImage}
- <ArcaneButton
- action="commit"
- {size}
- {showLabel}
- disabled={actionButtonsLifecyclePending}
- onclick={() => (commitDialogOpen = true)}
- />
- {/if}
- {#if canKillContainer && (isContainerRunning || isContainerPaused)}
- <ArcaneButton
- action="kill"
- {size}
- {showLabel}
- disabled={isLifecycleActionPending || actionButtonsLifecyclePending}
- onclick={() => (killDialogOpen = true)}
- />
- {/if}
-{/snippet}
-
-{#snippet containerLifecycleMenu(container: ContainerDetailsDto, actionButtonsLifecyclePending: boolean)}
- {#if canConvertToCompose}
- <DropdownMenu.Item
- disabled={actionButtonsLifecyclePending}
- onclick={() => goto(`/projects/new?fromContainers=${container.id}&fromEnv=${encodeURIComponent(currentEnvId)}`)}
- >
- <ProjectsIcon class="size-4" />
- {m.compose_convert_action()}
- </DropdownMenu.Item>
- {/if}
- {#if canUpdateContainer && updateInfo?.hasUpdate}
- <DropdownMenu.Item disabled={updateLoading || actionButtonsLifecyclePending} onclick={handleUpdateContainer}>
- <UpdateIcon class="size-4" />
- {m.update_container()}
- </DropdownMenu.Item>
- {/if}
- {#if canPauseContainer && isContainerPaused}
- <DropdownMenu.Item disabled={isLifecycleActionPending || actionButtonsLifecyclePending} onclick={handleUnpauseContainer}>
- <PlayIcon class="size-4" />
- {m.common_unpause()}
- </DropdownMenu.Item>
- {:else if canPauseContainer && isContainerRunning}
- <DropdownMenu.Item disabled={isLifecycleActionPending || actionButtonsLifecyclePending} onclick={handlePauseContainer}>
- <PauseIcon class="size-4" />
- {m.common_pause()}
- </DropdownMenu.Item>
- {/if}
- {#if canCommitImage}
- <DropdownMenu.Item disabled={actionButtonsLifecyclePending} onclick={() => (commitDialogOpen = true)}>
- <ImagesIcon class="size-4" />
- {m.commit()}
- </DropdownMenu.Item>
- {/if}
- {#if canKillContainer && (isContainerRunning || isContainerPaused)}
- <DropdownMenu.Item
- disabled={isLifecycleActionPending || actionButtonsLifecyclePending}
- onclick={() => (killDialogOpen = true)}
- >
- <ZapIcon class="size-4" />
- {m.common_kill()}
- </DropdownMenu.Item>
- {/if}
-{/snippet}
-
{#snippet containerTabs(container: ContainerDetailsDto, activeTab: string)}
<Tabs.Content value="overview" class="h-full">
<ContainerOverview
@@ -656,15 +608,8 @@
type="container"
itemState={container.state?.running ? 'running' : 'stopped'}
disableRedeploy={!!container.redeployDisabled}
- >
- {#snippet beforeRemoveActions(size, showLabel, actionButtonsLifecyclePending)}
- {@render containerLifecycleButtons(container, size, showLabel, actionButtonsLifecyclePending)}
- {/snippet}
-
- {#snippet beforeRemoveMenuItems(actionButtonsLifecyclePending)}
- {@render containerLifecycleMenu(container, actionButtonsLifecyclePending)}
- {/snippet}
- </ActionButtons>
+ extraActions={containerExtraActions}
+ />
{/snippet}
{#snippet tabContent(activeTab)}
diff --git a/frontend/src/routes/(app)/customize/git-repositories/+page.svelte b/frontend/src/routes/(app)/customize/git-repositories/+page.svelte
index a34f86be6..114391399 100644
--- a/frontend/src/routes/(app)/customize/git-repositories/+page.svelte
+++ b/frontend/src/routes/(app)/customize/git-repositories/+page.svelte
@@ -104,13 +104,16 @@
buttons.push({
id: 'create',
action: 'create',
+ placement: 'primary',
label: m.common_add_button({ resource: m.resource_repository_cap() }),
onclick: openCreateRepositoryDialog
});
}
buttons.push({
id: 'refresh',
- action: 'restart',
+ action: 'refresh',
+ placement: 'secondary',
+ iconOnly: true,
label: m.common_refresh(),
onclick: refreshRepositories,
loading: isLoading.refresh,
diff --git a/frontend/src/routes/(app)/customize/registries/+page.svelte b/frontend/src/routes/(app)/customize/registries/+page.svelte
index 50e0e6502..b378b228e 100644
--- a/frontend/src/routes/(app)/customize/registries/+page.svelte
+++ b/frontend/src/routes/(app)/customize/registries/+page.svelte
@@ -111,13 +111,16 @@
buttons.push({
id: 'create',
action: 'create',
+ placement: 'primary',
label: m.common_add_button({ resource: m.common_registry() }),
onclick: openCreateRegistryDialog
});
}
buttons.push({
id: 'refresh',
- action: 'restart',
+ action: 'refresh',
+ placement: 'secondary',
+ iconOnly: true,
label: m.common_refresh(),
onclick: refreshRegistries,
loading: isLoading.refresh,
diff --git a/frontend/src/routes/(app)/customize/registries/[id]/+page.svelte b/frontend/src/routes/(app)/customize/registries/[id]/+page.svelte
index 74fcd3345..ac62a94e7 100644
--- a/frontend/src/routes/(app)/customize/registries/[id]/+page.svelte
+++ b/frontend/src/routes/(app)/customize/registries/[id]/+page.svelte
@@ -12,7 +12,8 @@
import * as DropdownMenu from '#lib/components/ui/dropdown-menu/index.js';
import * as InputGroup from '#lib/components/ui/input-group/index.js';
import { Spinner } from '#lib/components/ui/spinner/index.js';
- import { ResourceDetailLayout, type DetailAction } from '#lib/layouts/index.js';
+ import { ResourceDetailLayout } from '#lib/layouts/index.js';
+ import type { ActionButton } from '#lib/components/action-button-group/types.js';
import { AlertTriangleIcon, ArrowRightIcon, RegistryIcon, SearchIcon, TagIcon, TrashIcon } from '#lib/icons/index.js';
import { m } from '#lib/paraglide/messages.js';
import { containerRegistryService } from '#lib/services/container-registry-service.js';
@@ -156,10 +157,12 @@
});
}
- const actions: DetailAction[] = $derived([
+ const actions: ActionButton[] = $derived([
{
id: 'refresh',
action: 'refresh',
+ placement: 'secondary',
+ iconOnly: true,
label: m.common_refresh(),
loading: refreshing,
disabled: refreshing,
diff --git a/frontend/src/routes/(app)/customize/templates/+page.svelte b/frontend/src/routes/(app)/customize/templates/+page.svelte
index aeb451ce6..224b86a29 100644
--- a/frontend/src/routes/(app)/customize/templates/+page.svelte
+++ b/frontend/src/routes/(app)/customize/templates/+page.svelte
@@ -169,6 +169,7 @@
buttons.push({
id: 'create',
action: 'create',
+ placement: 'primary',
label: m.templates_create_template(),
onclick: () => goto('/customize/templates/create')
});
@@ -183,7 +184,9 @@
}
buttons.push({
id: 'refresh',
- action: 'restart',
+ action: 'refresh',
+ placement: 'secondary',
+ iconOnly: true,
label: m.common_refresh(),
onclick: refreshTemplates
});
diff --git a/frontend/src/routes/(app)/customize/templates/[id]/+page.svelte b/frontend/src/routes/(app)/customize/templates/[id]/+page.svelte
index 2d6527f7e..9a27ca2a4 100644
--- a/frontend/src/routes/(app)/customize/templates/[id]/+page.svelte
+++ b/frontend/src/routes/(app)/customize/templates/[id]/+page.svelte
@@ -7,7 +7,8 @@
import { ArcaneButton } from '#lib/components/arcane-button/index.js';
import CodeEditor from '#lib/components/code-editor/editor.svelte';
import TemplateEditorWorkspace from '../components/template-editor-workspace.svelte';
- import { ResourceDetailLayout, type DetailAction } from '#lib/layouts/index.js';
+ import { ResourceDetailLayout } from '#lib/layouts/index.js';
+ import type { ActionButton } from '#lib/components/action-button-group/types.js';
import IfPermitted from '#lib/components/if-permitted.svelte';
import { goto, refreshAll } from '$app/navigation';
import { m } from '#lib/paraglide/messages.js';
@@ -199,10 +200,11 @@
}
const remoteActions = $derived.by(() => {
- const actions: DetailAction[] = [
+ const actions: ActionButton[] = [
{
id: 'create-project',
action: 'create',
+ placement: 'primary',
label: m.compose_create_project(),
onclick: () => goto(`/projects/new?templateId=${template.id}`)
}
@@ -211,6 +213,7 @@
actions.push({
id: 'download',
action: 'base',
+ placement: 'secondary',
label: m.templates_download(),
loadingLabel: m.common_action_downloading(),
loading: status.isDownloading,
@@ -221,6 +224,7 @@
actions.push({
id: 'view-local',
action: 'base',
+ placement: 'secondary',
label: m.templates_view_local_version(),
onclick: () => goto(`/customize/templates/${localVersionOfRemote?.id}`)
});
diff --git a/frontend/src/routes/(app)/customize/variables/+page.svelte b/frontend/src/routes/(app)/customize/variables/+page.svelte
index 29963880b..eba38d33d 100644
--- a/frontend/src/routes/(app)/customize/variables/+page.svelte
+++ b/frontend/src/routes/(app)/customize/variables/+page.svelte
@@ -135,6 +135,7 @@
{
id: 'create',
action: 'create',
+ placement: 'primary',
label: m.common_add_button({ resource: m.variable() }),
onclick: openCreateSheet
}
diff --git a/frontend/src/routes/(app)/dashboard/dashboard-all-environments-view.svelte b/frontend/src/routes/(app)/dashboard/dashboard-all-environments-view.svelte
index 0d16cbfa8..c05914ffe 100644
--- a/frontend/src/routes/(app)/dashboard/dashboard-all-environments-view.svelte
+++ b/frontend/src/routes/(app)/dashboard/dashboard-all-environments-view.svelte
@@ -6,6 +6,7 @@
import { type ActionButton } from '#lib/components/action-button-group/index.js';
import { cn } from '#lib/utils.js';
import { ArcaneButton } from '#lib/components/arcane-button/index.js';
+ import * as ArcaneTooltip from '#lib/components/arcane-tooltip/index.js';
import PruneConfirmationDialog from '#lib/components/dialogs/prune-confirmation-dialog.svelte';
import DockerInfoDialog from '#lib/components/dialogs/docker-info-dialog.svelte';
import { Skeleton } from '#lib/components/ui/skeleton/index.js';
@@ -40,7 +41,6 @@
ImagesIcon,
InfoIcon,
InspectIcon,
- RefreshIcon,
TrashIcon,
UpdateIcon,
VolumesIcon,
@@ -702,14 +702,22 @@
{/each}
</div>
- <ArcaneButton
- action="restart"
- size="sm"
- customLabel={m.common_refresh()}
- icon={RefreshIcon}
- loading={isRefreshing}
- onclick={refreshOverview}
- />
+ <ArcaneTooltip.Root>
+ <ArcaneTooltip.Trigger>
+ {#snippet child({ props })}
+ <ArcaneButton
+ {...props}
+ action="refresh"
+ size="icon"
+ class="size-8"
+ customLabel={m.common_refresh()}
+ loading={isRefreshing}
+ onclick={refreshOverview}
+ />
+ {/snippet}
+ </ArcaneTooltip.Trigger>
+ <ArcaneTooltip.Content>{m.common_refresh()}</ArcaneTooltip.Content>
+ </ArcaneTooltip.Root>
</div>
</header>
diff --git a/frontend/src/routes/(app)/environments/+page.svelte b/frontend/src/routes/(app)/environments/+page.svelte
index 8f19889b0..22cf612eb 100644
--- a/frontend/src/routes/(app)/environments/+page.svelte
+++ b/frontend/src/routes/(app)/environments/+page.svelte
@@ -87,6 +87,8 @@
{
id: 'remove-selected',
action: 'remove' as const,
+ group: 'danger' as const,
+ destructive: true,
label: m.common_remove_selected(),
onclick: handleBulkDelete,
loading: isLoading.deleting,
@@ -99,6 +101,7 @@
{
id: 'create',
action: 'create' as const,
+ placement: 'primary' as const,
label: m.common_add_button({ resource: m.resource_environment_cap() }),
onclick: () => {
environmentSession += 1;
@@ -132,7 +135,9 @@
: []),
{
id: 'refresh',
- action: 'restart' as const,
+ action: 'refresh' as const,
+ placement: 'secondary',
+ iconOnly: true,
label: m.common_refresh(),
onclick: refresh,
loading: isLoading.refresh,
diff --git a/frontend/src/routes/(app)/environments/[id]/+page.svelte b/frontend/src/routes/(app)/environments/[id]/+page.svelte
index 0324cb9ca..9a667f0ba 100644
--- a/frontend/src/routes/(app)/environments/[id]/+page.svelte
+++ b/frontend/src/routes/(app)/environments/[id]/+page.svelte
@@ -129,7 +129,8 @@
if (settingsForm.hasChanges) {
actions.push({
id: 'reset',
- action: 'restart',
+ action: 'base',
+ placement: 'secondary',
label: m.common_reset(),
onclick: resetForm,
disabled: settingsForm.isLoading,
@@ -139,6 +140,7 @@
actions.push({
id: 'save',
action: 'save',
+ placement: 'primary',
label: m.common_save(),
loadingLabel: m.common_saving(),
onclick: onSubmit,
@@ -156,6 +158,8 @@
actions.push({
id: 'refresh',
action: 'refresh',
+ placement: 'secondary',
+ iconOnly: true,
label: m.common_refresh(),
onclick: refreshEnvironment,
disabled: isRefreshing,
@@ -666,6 +670,23 @@
}
</script>
+{#snippet enabledIndicator()}
+ <div class="flex shrink-0 items-center gap-2.5 rounded-lg border border-border/60 bg-card/40 px-3 py-1.5">
+ <div class="flex items-center gap-2">
+ <div
+ class={cn(
+ 'size-2 rounded-full transition-colors',
+ formInputs.enabled.value ? 'bg-success shadow-glow shadow-success' : 'bg-muted-foreground/40'
+ )}
+ ></div>
+ <span class="text-sm font-medium">
+ {formInputs.enabled.value ? m.common_enabled() : m.common_disabled()}
+ </span>
+ </div>
+ <Switch id="env-enabled-header" bind:checked={formInputs.enabled.value} />
+ </div>
+{/snippet}
+
<div class="container mx-auto max-w-full space-y-6 overflow-hidden p-2 sm:p-6">
<div class="space-y-3 sm:space-y-4">
<ArcaneButton
@@ -690,33 +711,6 @@
placeholder={m.environments_name_placeholder()}
class="max-w-56 min-w-0 sm:max-w-80 md:max-w-104"
/>
-
- <!-- Enable/Disable indicator -->
- <div class="flex shrink-0 items-center gap-2.5 rounded-lg border border-border/60 bg-card/40 px-3 py-1.5">
- <div class="flex items-center gap-2">
- <div
- class={cn(
- 'size-2 rounded-full transition-colors',
- formInputs.enabled.value ? 'bg-success shadow-glow shadow-success' : 'bg-muted-foreground/40'
- )}
- ></div>
- <span class="text-sm font-medium">
- {formInputs.enabled.value ? m.common_enabled() : m.common_disabled()}
- </span>
- </div>
- {#if environment.id === '0'}
- <ArcaneTooltip.Root>
- <ArcaneTooltip.Trigger>
- <Switch id="env-enabled-header" disabled={true} bind:checked={formInputs.enabled.value} />
- </ArcaneTooltip.Trigger>
- <ArcaneTooltip.Content>
- <p>{m.environments_local_setting_disabled()}</p>
- </ArcaneTooltip.Content>
- </ArcaneTooltip.Root>
- {:else}
- <Switch id="env-enabled-header" bind:checked={formInputs.enabled.value} />
- {/if}
- </div>
</div>
<div class="mt-1 flex min-w-0 items-center gap-1">
{#if isEditingApiUrl}
@@ -784,14 +778,15 @@
</div>
</div>
- <!-- ActionButtonGroup measures its own width to decide what overflows, so it
- needs a row that actually spans the header, not a shrink-to-fit column. -->
- <div class="flex w-full min-w-0 shrink-0 flex-col items-start gap-2 sm:w-auto sm:min-w-md sm:items-end">
+ <div class="flex w-full min-w-0 shrink-0 flex-col items-start gap-2 sm:w-auto sm:items-end">
<span class={cn('text-xs', settingsForm.hasChanges ? 'text-warning' : 'text-success')}>
{settingsForm.hasChanges ? m.common_unsaved_changes() : m.common_all_changes_saved()}
</span>
- <div class="flex w-full">
- <ActionButtonGroup buttons={headerActions} class="justify-end" />
+ <div class="flex w-full items-center justify-end gap-2">
+ {#if environment.id !== '0'}
+ {@render enabledIndicator()}
+ {/if}
+ <ActionButtonGroup buttons={headerActions} />
</div>
</div>
</div>
diff --git a/frontend/src/routes/(app)/environments/[id]/gitops/+page.svelte b/frontend/src/routes/(app)/environments/[id]/gitops/+page.svelte
index fae957747..b348a8380 100644
--- a/frontend/src/routes/(app)/environments/[id]/gitops/+page.svelte
+++ b/frontend/src/routes/(app)/environments/[id]/gitops/+page.svelte
@@ -203,6 +203,7 @@
{
id: 'create',
action: 'create',
+ placement: 'primary',
label: m.common_add_button({ resource: m.resource_sync_cap() }),
onclick: () => openCreateSyncDialog()
},
@@ -222,7 +223,9 @@
},
{
id: 'refresh',
- action: 'restart',
+ action: 'refresh',
+ placement: 'secondary',
+ iconOnly: true,
label: m.common_refresh(),
onclick: refreshSyncs,
loading: isLoading.refresh,
diff --git a/frontend/src/routes/(app)/events/+page.svelte b/frontend/src/routes/(app)/events/+page.svelte
index 5cc8bbee7..7955be2d8 100644
--- a/frontend/src/routes/(app)/events/+page.svelte
+++ b/frontend/src/routes/(app)/events/+page.svelte
@@ -136,6 +136,8 @@
{
id: 'remove-selected',
action: 'remove' as const,
+ group: 'danger' as const,
+ destructive: true,
label: m.common_remove_selected(),
onclick: handleDeleteSelected,
loading: isDeleting,
@@ -145,7 +147,9 @@
: []),
{
id: 'refresh',
- action: 'restart' as const,
+ action: 'refresh' as const,
+ placement: 'secondary',
+ iconOnly: true,
label: m.common_refresh(),
onclick: refresh,
loading: isRefreshing,
diff --git a/frontend/src/routes/(app)/images/+page.svelte b/frontend/src/routes/(app)/images/+page.svelte
index 6b2ad4cab..39c47e52b 100644
--- a/frontend/src/routes/(app)/images/+page.svelte
+++ b/frontend/src/routes/(app)/images/+page.svelte
@@ -233,6 +233,7 @@
buttons.push({
id: 'pull',
action: 'pull',
+ placement: 'primary',
label: m.images_pull_image(),
onclick: () => (isPullDialogOpen = true),
disabled: !resourcesReady
@@ -268,7 +269,9 @@
}
buttons.push({
id: 'refresh',
- action: 'restart',
+ action: 'refresh',
+ placement: 'secondary',
+ iconOnly: true,
label: m.common_refresh(),
onclick: refresh,
loading: isRefreshing,
@@ -278,6 +281,8 @@
buttons.push({
id: 'prune',
action: 'remove',
+ group: 'danger',
+ destructive: true,
label: m.images_prune_unused(),
loadingLabel: m.common_action_pruning(),
onclick: () => (isConfirmPruneDialogOpen = true),
diff --git a/frontend/src/routes/(app)/images/[imageId]/+page.svelte b/frontend/src/routes/(app)/images/[imageId]/+page.svelte
index 2832dfce4..bc1e173cd 100644
--- a/frontend/src/routes/(app)/images/[imageId]/+page.svelte
+++ b/frontend/src/routes/(app)/images/[imageId]/+page.svelte
@@ -22,7 +22,8 @@
stabilizeFailedVulnerabilitySummary,
isVulnerabilityScanInProgress
} from '#lib/utils/docker.js';
- import { ResourceDetailLayout, type DetailAction } from '#lib/layouts/index.js';
+ import { ResourceDetailLayout } from '#lib/layouts/index.js';
+ import type { ActionButton } from '#lib/components/action-button-group/types.js';
import { TabBar, type TabItem } from '#lib/components/tab-bar/index.js';
import { useUrlTab } from '#lib/hooks/use-url-tab.svelte.js';
import { DetailMetaStrip, DetailSection, KeyValueCard } from '#lib/components/resource-detail/index.js';
@@ -353,12 +354,13 @@
}
}
- const actions: DetailAction[] = $derived.by(() => {
- const list: DetailAction[] = [];
+ const actions: ActionButton[] = $derived.by(() => {
+ const list: ActionButton[] = [];
if (canTagImage) {
list.push({
id: 'tag',
action: 'tag',
+ placement: 'secondary',
label: m.images_tag_image(),
onclick: () => (tagDialogOpen = true)
});
@@ -399,6 +401,8 @@
list.push({
id: 'remove',
action: 'remove',
+ group: 'danger',
+ destructive: true,
label: m.common_remove(),
loading: isLoading.removing,
disabled: isLoading.removing,
diff --git a/frontend/src/routes/(app)/networks/+page.svelte b/frontend/src/routes/(app)/networks/+page.svelte
index 80a5bd8d7..ea01abac1 100644
--- a/frontend/src/routes/(app)/networks/+page.svelte
+++ b/frontend/src/routes/(app)/networks/+page.svelte
@@ -1,7 +1,5 @@
<script lang="ts">
- import { goto } from '$app/navigation';
import { NetworksIcon, ConnectionIcon } from '#lib/icons/index.js';
- import { GitBranchIcon } from '#lib/icons/index.js';
import { toast } from 'svelte-sonner';
import type { NetworkCreateOptions, NetworkUsageCounts } from '#lib/types/docker.js';
import CreateNetworkSheet from '#lib/components/sheets/create-network-sheet.svelte';
@@ -93,6 +91,7 @@
{
id: 'create',
action: 'create',
+ placement: 'primary',
label: m.common_create_button({ resource: m.resource_network_cap() }),
onclick: () => (pageState.isCreateDialogOpen = true),
loading: createNetworkMutation.isPending,
@@ -100,19 +99,13 @@
},
{
id: 'refresh',
- action: 'restart',
+ action: 'refresh',
+ placement: 'secondary',
+ iconOnly: true,
label: m.common_refresh(),
onclick: refresh,
loading: isRefreshing,
disabled: networksQuery.isFetching
- },
- {
- id: 'topology',
- action: 'inspect',
- label: m.networks_topology_button(),
- icon: GitBranchIcon,
- onclick: () => void goto('/networks/topology'),
- disabled: !resourcesReady
}
]);
diff --git a/frontend/src/routes/(app)/networks/[networkId]/+page.svelte b/frontend/src/routes/(app)/networks/[networkId]/+page.svelte
index 201c3ee34..eb0b8d2a7 100644
--- a/frontend/src/routes/(app)/networks/[networkId]/+page.svelte
+++ b/frontend/src/routes/(app)/networks/[networkId]/+page.svelte
@@ -26,7 +26,8 @@
import { tryCatch } from '#lib/utils/try-catch.js';
import { m } from '#lib/paraglide/messages.js';
import { networkService } from '#lib/services/network-service.js';
- import { ResourceDetailLayout, type DetailAction } from '#lib/layouts/index.js';
+ import { ResourceDetailLayout } from '#lib/layouts/index.js';
+ import type { ActionButton } from '#lib/components/action-button-group/types.js';
import { activityToastOptions, extractActivityId } from '#lib/utils/activity-toast.js';
import { DetailMetaStrip, DetailSection, KeyValueCard, KeyValueGrid } from '#lib/components/resource-detail/index.js';
@@ -113,10 +114,13 @@
});
}
- const actions: DetailAction[] = $derived([
+ const actions: ActionButton[] = $derived([
{
id: 'remove',
action: 'remove',
+ group: 'danger',
+ destructive: true,
+ placement: 'secondary',
label: m.common_remove(),
loading: isRemoving,
disabled: isRemoving || isPredefined,
diff --git a/frontend/src/routes/(app)/networks/ports/+page.svelte b/frontend/src/routes/(app)/networks/ports/+page.svelte
index 7854408bf..6b3dc41b0 100644
--- a/frontend/src/routes/(app)/networks/ports/+page.svelte
+++ b/frontend/src/routes/(app)/networks/ports/+page.svelte
@@ -39,7 +39,9 @@
const actionButtons: ActionButton[] = $derived([
{
id: 'refresh',
- action: 'restart',
+ action: 'refresh',
+ placement: 'secondary',
+ iconOnly: true,
label: m.common_refresh(),
onclick: refresh,
loading: isRefreshing,
diff --git a/frontend/src/routes/(app)/networks/topology/+page.svelte b/frontend/src/routes/(app)/networks/topology/+page.svelte
index 866023872..e7a37f6ba 100644
--- a/frontend/src/routes/(app)/networks/topology/+page.svelte
+++ b/frontend/src/routes/(app)/networks/topology/+page.svelte
@@ -31,7 +31,9 @@
const actionButtons: ActionButton[] = $derived([
{
id: 'refresh',
- action: 'restart',
+ action: 'refresh',
+ placement: 'secondary',
+ iconOnly: true,
label: m.common_refresh(),
onclick: refresh,
loading: isRefreshing,
diff --git a/frontend/src/routes/(app)/projects/+page.svelte b/frontend/src/routes/(app)/projects/+page.svelte
index 81262e826..0e44b4ad1 100644
--- a/frontend/src/routes/(app)/projects/+page.svelte
+++ b/frontend/src/routes/(app)/projects/+page.svelte
@@ -199,6 +199,7 @@
buttons.push({
id: 'create',
action: 'create',
+ placement: 'primary',
label: m.compose_create_project(),
onclick: () => goto('/projects/new')
});
@@ -215,7 +216,9 @@
}
buttons.push({
id: 'refresh',
- action: 'restart',
+ action: 'refresh',
+ placement: 'secondary',
+ iconOnly: true,
label: m.common_refresh(),
onclick: refreshCompose,
loading: isManualRefreshing,
diff --git a/frontend/src/routes/(app)/projects/[projectId]/+page.svelte b/frontend/src/routes/(app)/projects/[projectId]/+page.svelte
index 57baeff26..0d76dd193 100644
--- a/frontend/src/routes/(app)/projects/[projectId]/+page.svelte
+++ b/frontend/src/routes/(app)/projects/[projectId]/+page.svelte
@@ -4,7 +4,6 @@
import * as Tabs from '#lib/components/ui/tabs/index.js';
import * as Alert from '#lib/components/ui/alert/index.js';
import { ArcaneButton } from '#lib/components/arcane-button/index.js';
- import * as DropdownMenu from '#lib/components/ui/dropdown-menu/index.js';
import {
ArrowLeftIcon,
ArrowDownIcon,
@@ -20,11 +19,14 @@
CodeIcon,
ArrowsUpDownIcon,
ExternalLinkIcon,
- SearchIcon
+ SearchIcon,
+ ResetIcon,
+ GitBranchIcon
} from '#lib/icons/index.js';
import { type TabItem } from '#lib/components/tab-bar/index.js';
import TabbedPageLayout from '#lib/layouts/tabbed-page-layout.svelte';
import ActionButtons from '#lib/components/action-buttons.svelte';
+ import type { ActionButton } from '#lib/components/action-button-group/types.js';
import ProjectGitBackupSummary from '#lib/components/gitops/project-git-backup-summary.svelte';
import { Badge } from '#lib/components/ui/badge/index.js';
import * as ArcaneTooltip from '#lib/components/arcane-tooltip/index.js';
@@ -62,11 +64,11 @@
import { hasPermission } from '#lib/utils/auth.js';
import { queryKeys } from '#lib/query/query-keys.js';
import { RefreshIcon } from '#lib/icons/index.js';
+ import { cn } from '#lib/utils.js';
import IconImage from '#lib/components/icon-image.svelte';
import { createMutation, createQuery, useQueryClient } from '@tanstack/svelte-query';
import ProjectUpdateItem from '#lib/components/project-update-item.svelte';
import ProjectTagEditor from '#lib/components/project-tag-editor.svelte';
- import IfPermitted from '#lib/components/if-permitted.svelte';
import { activityToastOptions, extractActivityId } from '#lib/utils/activity-toast.js';
import { globalVariablesToMap } from '#lib/utils/template-load.js';
import {
@@ -346,7 +348,7 @@
let autoScrollStackLogs = $state(true);
- type ProjectTab = 'services' | 'compose' | 'logs';
+ type ProjectTab = 'services' | 'compose' | 'backup' | 'logs';
let selectedTab = $state<ProjectTab>('compose');
let userSelectedTabProjectId: string | null = null;
let composeOpen = $state(true);
@@ -478,13 +480,14 @@
value: 'compose',
label: m.common_configuration(),
icon: SettingsIcon
- }
+ },
+ ...(isGitOpsManaged ? [] : [{ value: 'backup', label: m.git_backup(), icon: GitBranchIcon }])
]);
let nameInputRef = $state<HTMLInputElement | null>(null);
type ComposeUIPrefs = {
- tab: 'services' | 'compose' | 'logs';
+ tab: 'services' | 'compose' | 'backup' | 'logs';
composeOpen: boolean;
overrideOpen: boolean;
envOpen: boolean;
@@ -691,7 +694,7 @@
selectedTab = urlTabValue ?? cur.tab ?? defaultComposeUIPrefs.tab;
// Logs merged into the services tab (#3367): honor legacy ?tab=logs deep
// links and stored prefs by landing on services (logs render alongside).
- if (requestedTab === 'logs' || selectedTab === 'logs') {
+ if (requestedTab === 'logs' || !tabItems.some((tab) => tab.value === selectedTab)) {
selectedTab = 'services';
}
}
@@ -1474,6 +1477,23 @@
editorContext: codeEditorContext
} as const;
}
+
+ const projectExtraActions = $derived.by((): ActionButton[] => {
+ const list: ActionButton[] = [];
+ if (canArchiveProject) {
+ list.push({
+ id: 'archive',
+ action: 'archive',
+ label: project?.isArchived ? m.projects_unarchive() : m.projects_archive(),
+ group: 'manage',
+ loading: isLoading.archiving,
+ disabled: archiveRequiresStopped,
+ disabledReason: archiveRequiresStopped ? m.projects_archive_requires_stopped() : undefined,
+ onclick: handleArchiveToggle
+ });
+ }
+ return list;
+ });
</script>
{#snippet projectComposeTab(project: Project)}
@@ -1481,32 +1501,59 @@
<div class="flex h-full min-h-0 flex-col">
{@render configurationErrorNotice()}
{@render gitSourceNotice()}
- {#if !isGitOpsManaged}
- <ProjectGitBackupSummary environmentId={envId} projectId={project.id} projectName={project.name} />
- {/if}
{@render composeFilesNotice()}
{#if lastPrefsProjectId === project.id}
- <div class="mb-2 flex shrink-0 items-center justify-end gap-2">
- <label
- for="layout-mode-toggle"
- class="cursor-pointer text-xs text-muted-foreground"
- title={m.project_view_description()}
- >
- {m.workspace()}
- </label>
- <Switch
- id="layout-mode-toggle"
- checked={layoutMode === 'tree'}
- aria-label={m.project_view_description()}
- onCheckedChange={(checked) => {
- layoutMode = checked ? 'tree' : 'classic';
- if (checked) {
- openFileTab('compose');
- selectedIncludeTabPreference = null;
- }
- persistPrefs();
- }}
- />
+ <div class="mb-2 flex shrink-0 flex-wrap items-center justify-between gap-2">
+ <div class="flex items-center gap-2">
+ <label
+ for="layout-mode-toggle"
+ class="cursor-pointer text-xs text-muted-foreground"
+ title={m.project_view_description()}
+ >
+ {m.workspace()}
+ </label>
+ <Switch
+ id="layout-mode-toggle"
+ checked={layoutMode === 'tree'}
+ aria-label={m.project_view_description()}
+ onCheckedChange={(checked) => {
+ layoutMode = checked ? 'tree' : 'classic';
+ if (checked) {
+ openFileTab('compose');
+ selectedIncludeTabPreference = null;
+ }
+ persistPrefs();
+ }}
+ />
+ </div>
+
+ {#if canUpdateProject}
+ <div class="flex items-center gap-2">
+ <span class={cn('text-xs', hasChanges ? 'text-warning' : 'text-success')}>
+ {hasChanges ? m.common_unsaved_changes() : m.common_all_changes_saved()}
+ </span>
+ {#if hasChanges}
+ <ArcaneButton
+ action="base"
+ tone="outline"
+ size="sm"
+ icon={ResetIcon}
+ customLabel={m.common_reset()}
+ disabled={isLoading.saving}
+ onclick={() => rebaseEditorDraft(project)}
+ />
+ {/if}
+ <ArcaneButton
+ action="save"
+ size="sm"
+ class="min-w-20"
+ disabled={!canSave}
+ loading={isLoading.saving}
+ loadingLabel={m.common_saving()}
+ onclick={handleSaveChanges}
+ />
+ </div>
+ {/if}
</div>
<div class="min-h-0 flex-1">
@@ -1748,6 +1795,14 @@
</div>
{/snippet}
+{#snippet projectBackupTab(project: Project)}
+ <Tabs.Content value="backup" class="h-full min-h-0">
+ {#if !isGitOpsManaged}
+ <ProjectGitBackupSummary environmentId={envId} projectId={project.id} projectName={project.name} />
+ {/if}
+ </Tabs.Content>
+{/snippet}
+
{#snippet projectServicesTab(project: Project)}
<Tabs.Content value="services" class="h-full min-h-0">
<div class="flex h-full min-h-0 flex-col">
@@ -2213,60 +2268,16 @@
void refreshProjectDetails();
}}
onRefresh={() => refreshProjectDetails()}
- >
- {#snippet leadingActions(size, showLabel)}
- {#if canUpdateProject}
- <ArcaneButton
- action="save"
- {size}
- {showLabel}
- loading={isLoading.saving}
- onclick={handleSaveChanges}
- disabled={!canSave}
- customLabel={m.common_save()}
- loadingLabel={m.common_saving()}
- />
- {/if}
- <IfPermitted perm="projects:archive">
- <ArcaneButton
- action="archive"
- {size}
- {showLabel}
- loading={isLoading.archiving}
- onclick={handleArchiveToggle}
- disabled={archiveRequiresStopped}
- title={archiveRequiresStopped ? m.projects_archive_requires_stopped() : undefined}
- customLabel={project?.isArchived ? m.projects_unarchive() : m.projects_archive()}
- />
- </IfPermitted>
- {/snippet}
-
- {#snippet leadingMenuItems()}
- {#if canUpdateProject}
- <DropdownMenu.Item onclick={handleSaveChanges} disabled={!canSave || isLoading.saving}>
- {isLoading.saving ? m.common_saving() : m.common_save()}
- </DropdownMenu.Item>
- {/if}
- {#if canArchiveProject}
- <DropdownMenu.Item
- onclick={handleArchiveToggle}
- disabled={archiveRequiresStopped || isLoading.archiving}
- title={archiveRequiresStopped ? m.projects_archive_requires_stopped() : undefined}
- >
- {project?.isArchived ? m.projects_unarchive() : m.projects_archive()}
- </DropdownMenu.Item>
- {/if}
- {#if canUpdateProject || canArchiveProject}
- <DropdownMenu.Separator />
- {/if}
- {/snippet}
- </ActionButtons>
+ extraActions={projectExtraActions}
+ />
{/snippet}
{#snippet tabContent()}
{@render projectServicesTab(project)}
{@render projectComposeTab(project)}
+
+ {@render projectBackupTab(project)}
{/snippet}
</TabbedPageLayout>
{:else}
diff --git a/frontend/src/routes/(app)/security/+page.svelte b/frontend/src/routes/(app)/security/+page.svelte
index 053f4276b..600c9b6a8 100644
--- a/frontend/src/routes/(app)/security/+page.svelte
+++ b/frontend/src/routes/(app)/security/+page.svelte
@@ -359,6 +359,7 @@
buttons.push({
id: 'scan-all',
action: 'base',
+ placement: 'primary',
label: isLoading.scanningAll ? `${m.scanning()} (${scanProgress.current}/${scanProgress.total})` : m.security_scan_all(),
onclick: scanAllImages,
loading: isLoading.scanningAll,
@@ -368,7 +369,9 @@
}
buttons.push({
id: 'refresh',
- action: 'restart',
+ action: 'refresh',
+ placement: 'secondary',
+ iconOnly: true,
label: m.common_refresh(),
onclick: () => refreshAll(),
loading: isLoading.refreshing,
diff --git a/frontend/src/routes/(app)/settings/api-keys/+page.svelte b/frontend/src/routes/(app)/settings/api-keys/+page.svelte
index 22d4d74c1..a215fe884 100644
--- a/frontend/src/routes/(app)/settings/api-keys/+page.svelte
+++ b/frontend/src/routes/(app)/settings/api-keys/+page.svelte
@@ -7,7 +7,8 @@
import type { SearchPaginationSortRequest } from '#lib/types/shared.js';
import type { ApiKey, ApiKeyCreated, CreateApiKey } from '#lib/types/auth.js';
import { apiKeyService } from '#lib/services/api-key-service.js';
- import { SettingsPageLayout, type SettingsActionButton } from '#lib/layouts/index.js';
+ import { SettingsPageLayout } from '#lib/layouts/index.js';
+ import type { ActionButton } from '#lib/components/action-button-group/types.js';
import * as ResponsiveDialog from '#lib/components/ui/responsive-dialog/index.js';
import { ArcaneButton } from '#lib/components/arcane-button/index.js';
import { Snippet } from '#lib/components/ui/snippet/index.js';
@@ -96,10 +97,11 @@
}
}
- const actionButtons: SettingsActionButton[] = $derived.by(() => [
+ const actionButtons: ActionButton[] = $derived.by(() => [
{
id: 'create',
action: 'create',
+ placement: 'primary',
label: m.create_api_key(),
onclick: openCreateDialog,
loading: isLoading.creating,
diff --git a/frontend/src/routes/(app)/settings/backups/+page.svelte b/frontend/src/routes/(app)/settings/backups/+page.svelte
index 2164ee6c8..8d85aa796 100644
--- a/frontend/src/routes/(app)/settings/backups/+page.svelte
+++ b/frontend/src/routes/(app)/settings/backups/+page.svelte
@@ -8,7 +8,8 @@
import { activityStore } from '#lib/stores/activity.store.svelte.js';
import { toast } from 'svelte-sonner';
import settingsStore from '#lib/stores/config-store.svelte.js';
- import { SettingsPageLayout, type SettingsActionButton } from '#lib/layouts/index.js';
+ import { SettingsPageLayout } from '#lib/layouts/index.js';
+ import type { ActionButton } from '#lib/components/action-button-group/types.js';
import { AlertIcon, BackupIcon, CloudStorageIcon, InfoIcon, LockIcon, ResetIcon, UploadIcon } from '#lib/icons/index.js';
import { openConfirmDialog } from '#lib/components/confirm-dialog/index.js';
import * as Alert from '#lib/components/ui/alert/index.js';
@@ -523,15 +524,17 @@
}
}
- const actionButtons: SettingsActionButton[] = $derived.by(() => [
+ const actionButtons: ActionButton[] = $derived.by(() => [
{
id: 'create',
action: 'create',
+ placement: 'primary',
label: m.common_create(),
disabled: isReadOnly,
- options: [
- { label: m.jobs_schedule(), onclick: () => openSchedule() },
+ menuItems: [
+ { id: 'schedule', label: m.jobs_schedule(), onclick: () => openSchedule() },
{
+ id: 'workspace-backup',
label: m.volumes_workspace_backup(),
onclick: () => openAction('create'),
disabled: backupActivity.activeIds.length > 0
@@ -543,7 +546,7 @@
action: 'edit',
icon: CloudStorageIcon,
label: m.s3_destinations_title(),
- onclick: () => goto('/settings/backups/s3')
+ href: '/settings/backups/s3'
},
...(!policyCollection.recoveryKeyStored
? [
@@ -553,7 +556,7 @@
label: m.system_backups_discover(),
onclick: () => openAction('discover'),
disabled: isReadOnly || data.destinations.length === 0
- } satisfies SettingsActionButton
+ } satisfies ActionButton
]
: []),
...(canManageRecoveryKey
@@ -564,8 +567,9 @@
icon: LockIcon,
label: m.system_backups_recovery_key(),
disabled: isReadOnly,
- options: [
+ menuItems: [
{
+ id: 'recovery-key-set',
label: policyCollection.recoveryKeyStored
? m.system_backups_reset_recovery_key()
: m.system_backups_create_recovery_key(),
@@ -573,12 +577,13 @@
onclick: () => openRecoveryKey()
},
{
+ id: 'recovery-key-import',
label: m.system_backups_import_recovery_key(),
icon: UploadIcon,
onclick: () => openImportKey()
}
]
- } satisfies SettingsActionButton
+ } satisfies ActionButton
]
: [])
]);
diff --git a/frontend/src/routes/(app)/settings/backups/s3/+page.svelte b/frontend/src/routes/(app)/settings/backups/s3/+page.svelte
index 8af294960..6ec71d663 100644
--- a/frontend/src/routes/(app)/settings/backups/s3/+page.svelte
+++ b/frontend/src/routes/(app)/settings/backups/s3/+page.svelte
@@ -3,7 +3,8 @@
import { toast } from 'svelte-sonner';
import settingsStore from '#lib/stores/config-store.svelte.js';
- import { SettingsPageLayout, type SettingsActionButton } from '#lib/layouts/index.js';
+ import { SettingsPageLayout } from '#lib/layouts/index.js';
+ import type { ActionButton } from '#lib/components/action-button-group/types.js';
import { RemoteEnvironmentIcon } from '#lib/icons/index.js';
import { openConfirmDialog } from '#lib/components/confirm-dialog/index.js';
import { s3DestinationService } from '#lib/services/s3-destination-service.js';
@@ -89,10 +90,11 @@
});
}
- const actionButtons: SettingsActionButton[] = $derived.by(() => [
+ const actionButtons: ActionButton[] = $derived.by(() => [
{
id: 'create',
action: 'create',
+ placement: 'primary',
label: m.s3_destination_add(),
onclick: openCreate,
disabled: isReadOnly
diff --git a/frontend/src/routes/(app)/settings/diagnostics/+page.svelte b/frontend/src/routes/(app)/settings/diagnostics/+page.svelte
index 349dd8510..8e3e5392b 100644
--- a/frontend/src/routes/(app)/settings/diagnostics/+page.svelte
+++ b/frontend/src/routes/(app)/settings/diagnostics/+page.svelte
@@ -11,7 +11,8 @@
import * as Tabs from '#lib/components/ui/tabs/index.js';
import { TabBar, type TabItem } from '#lib/components/tab-bar/index.js';
import { SettingsPageLayout } from '#lib/layouts/index.js';
- import type { SettingsActionButton, SettingsStatCard } from '#lib/layouts/types.js';
+ import type { SettingsStatCard } from '#lib/layouts/types.js';
+ import type { ActionButton } from '#lib/components/action-button-group/types.js';
import { useUrlTab } from '#lib/hooks/use-url-tab.svelte.js';
import { createDiagnosticsWebSocket, ReconnectingWebSocket } from '#lib/utils/ws.js';
import { diagnosticsService } from '#lib/services/diagnostics-service.js';
@@ -190,20 +191,21 @@
];
});
- const actionButtons = $derived.by((): SettingsActionButton[] => [
+ const actionButtons = $derived.by((): ActionButton[] => [
{
id: 'pause',
action: paused ? 'unpause' : 'pause',
label: paused ? m.diagnostics_resume() : m.common_pause(),
- onclick: togglePause,
- showOnMobile: true
+ placement: 'secondary',
+ onclick: togglePause
},
{
id: 'refresh',
action: 'refresh',
+ placement: 'secondary',
+ iconOnly: true,
label: m.common_refresh(),
- onclick: refresh,
- showOnMobile: true
+ onclick: refresh
}
]);
diff --git a/frontend/src/routes/(app)/settings/roles/+page.svelte b/frontend/src/routes/(app)/settings/roles/+page.svelte
index db2c5763d..8546a2c8f 100644
--- a/frontend/src/routes/(app)/settings/roles/+page.svelte
+++ b/frontend/src/routes/(app)/settings/roles/+page.svelte
@@ -5,7 +5,8 @@
import type { SearchPaginationSortRequest } from '#lib/types/shared.js';
import { m } from '#lib/paraglide/messages.js';
import { roleService } from '#lib/services/role-service.js';
- import { SettingsPageLayout, type SettingsActionButton } from '#lib/layouts/index.js';
+ import { SettingsPageLayout } from '#lib/layouts/index.js';
+ import type { ActionButton } from '#lib/components/action-button-group/types.js';
import userStore from '#lib/stores/user-store.svelte.js';
let { data } = $props();
@@ -20,13 +21,14 @@
roles = await roleService.getRoles(requestOptions);
}
- const actionButtons: SettingsActionButton[] = $derived.by(() =>
+ const actionButtons: ActionButton[] = $derived.by(() =>
!isAdmin
? []
: [
{
id: 'create',
action: 'create',
+ placement: 'primary',
label: m.common_create_button({ resource: m.common_role() }),
onclick: () => goto('/settings/roles/new')
}
diff --git a/frontend/src/routes/(app)/settings/users/+page.svelte b/frontend/src/routes/(app)/settings/users/+page.svelte
index deaaa2845..09b88121e 100644
--- a/frontend/src/routes/(app)/settings/users/+page.svelte
+++ b/frontend/src/routes/(app)/settings/users/+page.svelte
@@ -15,7 +15,8 @@
import { settingsService } from '#lib/services/settings-service.js';
import userStore from '#lib/stores/user-store.svelte.js';
import settingsStore from '#lib/stores/config-store.svelte.js';
- import { SettingsPageLayout, type SettingsActionButton } from '#lib/layouts/index.js';
+ import { SettingsPageLayout } from '#lib/layouts/index.js';
+ import type { ActionButton } from '#lib/components/action-button-group/types.js';
import SettingsRow from '#lib/components/settings/settings-row.svelte';
import { Switch } from '#lib/components/ui/switch/index.js';
import { Input } from '#lib/components/ui/input/index.js';
@@ -213,10 +214,11 @@
void saveAvatarSettings({ avatarMaxUploadSizeMb: parsed });
}
- const actionButtons: SettingsActionButton[] = $derived.by(() => [
+ const actionButtons: ActionButton[] = $derived.by(() => [
{
id: 'create',
action: 'create',
+ placement: 'primary',
label: m.common_create_button({ resource: m.common_user() }),
onclick: openCreateDialog,
loading: isLoading.creating,
diff --git a/frontend/src/routes/(app)/settings/webhooks/+page.svelte b/frontend/src/routes/(app)/settings/webhooks/+page.svelte
index be3fc547c..74523ddc2 100644
--- a/frontend/src/routes/(app)/settings/webhooks/+page.svelte
+++ b/frontend/src/routes/(app)/settings/webhooks/+page.svelte
@@ -6,7 +6,8 @@
import WebhookFormSheet from '#lib/components/sheets/webhook-form-sheet.svelte';
import type { Webhook, WebhookCreated, CreateWebhook } from '#lib/types/environment.js';
import { webhookService } from '#lib/services/webhook-service.js';
- import { SettingsPageLayout, type SettingsActionButton } from '#lib/layouts/index.js';
+ import { SettingsPageLayout } from '#lib/layouts/index.js';
+ import type { ActionButton } from '#lib/components/action-button-group/types.js';
import * as ResponsiveDialog from '#lib/components/ui/responsive-dialog/index.js';
import { ArcaneButton } from '#lib/components/arcane-button/index.js';
import { Snippet } from '#lib/components/ui/snippet/index.js';
@@ -52,10 +53,11 @@
});
}
- const actionButtons: SettingsActionButton[] = $derived.by(() => [
+ const actionButtons: ActionButton[] = $derived.by(() => [
{
id: 'create',
action: 'create',
+ placement: 'primary',
label: m.create_webhook(),
onclick: () => (isDialogOpen.create = true),
loading: isLoading.creating,
diff --git a/frontend/src/routes/(app)/swarm/cluster/+page.svelte b/frontend/src/routes/(app)/swarm/cluster/+page.svelte
index f6eb0a084..91d0c0099 100644
--- a/frontend/src/routes/(app)/swarm/cluster/+page.svelte
+++ b/frontend/src/routes/(app)/swarm/cluster/+page.svelte
@@ -303,6 +303,7 @@
{
id: 'easy-join',
action: 'create' as const,
+ placement: 'primary' as const,
label: m.swarm_easy_join_action(),
onclick: () => {
easyJoinSession += 1;
@@ -313,7 +314,9 @@
: []),
{
id: 'refresh',
- action: 'restart',
+ action: 'refresh',
+ placement: 'secondary',
+ iconOnly: true,
label: m.common_refresh(),
onclick: refresh,
loading: isLoading.refresh,
diff --git a/frontend/src/routes/(app)/swarm/services/[serviceId]/+page.svelte b/frontend/src/routes/(app)/swarm/services/[serviceId]/+page.svelte
index f67a2e544..913852381 100644
--- a/frontend/src/routes/(app)/swarm/services/[serviceId]/+page.svelte
+++ b/frontend/src/routes/(app)/swarm/services/[serviceId]/+page.svelte
@@ -179,14 +179,13 @@
const canManageServices = $derived(hasPermission('swarm:services', envId));
const canScaleService = $derived(canManageServices && showsReplicas);
- // Scaling lives behind a dialog so the header keeps a single measured action group;
- // inline controls could not collapse and overflowed into the service info.
const serviceActions = $derived<ActionButton[]>([
...(canScaleService
? [
{
id: 'scale',
action: 'base' as const,
+ placement: 'primary' as const,
label: m.swarm_service_scale(),
icon: LayersIcon,
disabled: isLoading.scale,
@@ -197,6 +196,7 @@
{
id: 'edit',
action: 'edit',
+ placement: canScaleService ? ('secondary' as const) : ('primary' as const),
label: m.common_edit(),
icon: EditIcon,
disabled: isLoading.update,
@@ -205,6 +205,7 @@
{
id: 'rollback',
action: 'redeploy',
+ group: 'deploy' as const,
label: m.swarm_service_rollback(),
icon: RedeployIcon,
disabled: isLoading.rollback,
@@ -213,6 +214,8 @@
{
id: 'delete',
action: 'remove',
+ group: 'danger' as const,
+ destructive: true,
label: m.common_delete(),
icon: TrashIcon,
disabled: isLoading.remove,
diff --git a/frontend/src/routes/(app)/swarm/stacks/[name]/+page.svelte b/frontend/src/routes/(app)/swarm/stacks/[name]/+page.svelte
index 1e03d5577..12e147438 100644
--- a/frontend/src/routes/(app)/swarm/stacks/[name]/+page.svelte
+++ b/frontend/src/routes/(app)/swarm/stacks/[name]/+page.svelte
@@ -209,6 +209,7 @@
{
id: 'edit',
action: 'base' as const,
+ placement: 'primary' as const,
label: m.common_edit(),
icon: EditIcon,
onclick: () => goto(`/swarm/stacks/new?fromStack=${encodeURIComponent(stackName)}`),
@@ -217,6 +218,8 @@
{
id: 'remove',
action: 'remove' as const,
+ group: 'danger' as const,
+ destructive: true,
label: m.common_delete(),
icon: TrashIcon,
onclick: handleDelete,
@@ -227,7 +230,9 @@
: []),
{
id: 'refresh',
- action: 'restart',
+ action: 'refresh',
+ placement: 'secondary',
+ iconOnly: true,
label: m.common_refresh(),
onclick: refresh,
loading: isLoading.refresh,
diff --git a/frontend/src/routes/(app)/updates/+page.svelte b/frontend/src/routes/(app)/updates/+page.svelte
index aa7cdfe1b..4a54b87aa 100644
--- a/frontend/src/routes/(app)/updates/+page.svelte
+++ b/frontend/src/routes/(app)/updates/+page.svelte
@@ -178,6 +178,7 @@
{
id: 'update-all',
action: 'update',
+ placement: 'primary',
label: m.update_all(),
loadingLabel: m.common_action_updating(),
onclick: updateAll,
@@ -186,7 +187,9 @@
},
{
id: 'refresh',
- action: 'restart',
+ action: 'refresh',
+ placement: 'secondary',
+ iconOnly: true,
label: m.common_refresh(),
onclick: refresh,
loading: isRefreshing,
diff --git a/frontend/src/routes/(app)/volumes/+page.svelte b/frontend/src/routes/(app)/volumes/+page.svelte
index 629820485..091c08b24 100644
--- a/frontend/src/routes/(app)/volumes/+page.svelte
+++ b/frontend/src/routes/(app)/volumes/+page.svelte
@@ -96,6 +96,7 @@
buttons.push({
id: 'create',
action: 'create',
+ placement: 'primary',
label: m.common_create_button({ resource: m.resource_volume_cap() }),
onclick: () => (pageState.isCreateDialogOpen = true),
loading: createVolumeMutation.isPending,
@@ -104,7 +105,9 @@
}
buttons.push({
id: 'refresh',
- action: 'restart',
+ action: 'refresh',
+ placement: 'secondary',
+ iconOnly: true,
label: m.common_refresh(),
onclick: refresh,
loading: isRefreshing,
diff --git a/frontend/src/routes/(app)/volumes/[volumeName]/+page.svelte b/frontend/src/routes/(app)/volumes/[volumeName]/+page.svelte
index 7e6dde1d0..c687f6dc9 100644
--- a/frontend/src/routes/(app)/volumes/[volumeName]/+page.svelte
+++ b/frontend/src/routes/(app)/volumes/[volumeName]/+page.svelte
@@ -26,7 +26,7 @@
import { m } from '#lib/paraglide/messages.js';
import { volumeService } from '#lib/services/volume-service.js';
import { volumeWorkspaceService } from '#lib/services/volume-workspace-service.js';
- import { type DetailAction } from '#lib/layouts/index.js';
+ import type { ActionButton } from '#lib/components/action-button-group/types.js';
import TabbedPageLayout from '#lib/layouts/tabbed-page-layout.svelte';
import { ActionButtonGroup } from '#lib/components/action-button-group/index.js';
import BackupList from '../components/volume-backup-table.svelte';
@@ -778,12 +778,13 @@
});
}
- const actions: DetailAction[] = $derived.by(() => {
- const items: DetailAction[] = [];
+ const actions: ActionButton[] = $derived.by(() => {
+ const items: ActionButton[] = [];
if (hasWorkspaceChanges) {
items.push({
id: 'save-workspace',
action: 'save',
+ placement: 'primary',
label: m.common_save_changes(),
loading: isLoading.save,
disabled: !canSaveWorkspace,
@@ -794,6 +795,9 @@
items.push({
id: 'remove',
action: 'remove',
+ group: 'danger',
+ destructive: true,
+ placement: 'secondary',
label: m.common_remove(),
loading: isLoading.remove,
disabled: isLoading.remove || isBackupVolume,
diff --git a/tests/spec/container-lifecycle.spec.ts b/tests/spec/container-lifecycle.spec.ts
index 19065d841..50d01c211 100644
--- a/tests/spec/container-lifecycle.spec.ts
+++ b/tests/spec/container-lifecycle.spec.ts
@@ -161,6 +161,30 @@ async function expectActivitySucceeded(page: Page, activityId: string, expectedT
expect(detail.activity.error).toBeFalsy();
}
+// Header actions render inline or inside the "More actions" menu depending on placement.
+async function clickHeaderAction(page: Page, name: string) {
+ const header = page.locator('[data-tabs-root] > :not([inert])');
+ const inline = header
+ .getByRole('button', { name, exact: true })
+ .or(header.getByRole('link', { name, exact: true }))
+ .filter({ visible: true })
+ .first();
+ const menuTrigger = header
+ .getByRole('button', { name: 'More actions', exact: true })
+ .filter({ visible: true })
+ .first();
+ const inlineVisible = await inline
+ .waitFor({ state: 'visible', timeout: 5_000 })
+ .then(() => true)
+ .catch(() => false);
+ if (inlineVisible) {
+ await inline.click();
+ return;
+ }
+ await menuTrigger.click();
+ await page.getByRole('menuitem', { name, exact: true }).click();
+}
+
async function runSimpleContainerAction(
page: Page,
containerId: string,
@@ -182,12 +206,7 @@ async function runSimpleContainerAction(
(response) => matchesActionRequest(response.url(), response.request().method()),
{ timeout: responseTimeout }
);
- await page
- .locator('[data-tabs-root] > :not([inert])')
- .getByRole('button', { name: buttonName, exact: true })
- .filter({ visible: true })
- .first()
- .click();
+ await clickHeaderAction(page, buttonName);
await requestPromise;
const result = await readApiData<ActionResult>(
await responsePromise,
@@ -392,12 +411,7 @@ async function commitContainer(
imageIds: Set<string>
) {
return test.step('Commit image', async () => {
- await page
- .locator('[data-tabs-root] > :not([inert])')
- .getByRole('button', { name: 'Commit', exact: true })
- .filter({ visible: true })
- .first()
- .click();
+ await clickHeaderAction(page, 'Commit');
const dialog = page.getByRole('dialog', { name: `Commit "${containerName}"` });
await waitForDialogReady(dialog);
await expect(dialog.locator('#repository')).toBeFocused();
@@ -448,12 +462,7 @@ async function editContainerThroughUI(
containerIds: Set<string>
) {
return test.step('Edit and recreate container', async () => {
- await page
- .locator('[data-tabs-root] > :not([inert])')
- .getByRole('link', { name: 'Edit', exact: true })
- .filter({ visible: true })
- .first()
- .click();
+ await clickHeaderAction(page, 'Edit');
await expect(page).toHaveURL(`/containers/${containerId}/edit`);
await expect(page.getByText('Applying changes recreates this container.')).toBeVisible();
await expect(page.getByLabel('Container Name *', { exact: true })).toHaveValue(
@@ -501,12 +510,7 @@ async function redeployContainerThroughUI(
containerIds: Set<string>
) {
return test.step('Redeploy container', async () => {
- await page
- .locator('[data-tabs-root] > :not([inert])')
- .getByRole('button', { name: 'Redeploy', exact: true })
- .filter({ visible: true })
- .first()
- .click();
+ await clickHeaderAction(page, 'Redeploy');
const dialog = page.getByRole('dialog');
const responsePromise = page.waitForResponse(
(response) =>
@@ -541,12 +545,7 @@ async function convertContainerToProject(
response.request().method() === 'POST' &&
new URL(response.url()).pathname === '/api/environments/0/containers/generate-compose'
);
- await page
- .locator('[data-tabs-root] > :not([inert])')
- .getByRole('link', { name: 'Convert to Compose', exact: true })
- .filter({ visible: true })
- .first()
- .click();
+ await clickHeaderAction(page, 'Convert to Compose');
const generated = await readApiData<{ composeContent: string }>(
await generateResponsePromise,
`Generate Compose for ${containerId}`
@@ -580,12 +579,7 @@ async function convertContainerToProject(
async function killContainerThroughUI(page: Page, containerId: string, containerName: string) {
return test.step('Kill container', async () => {
- await page
- .locator('[data-tabs-root] > :not([inert])')
- .getByRole('button', { name: 'Kill', exact: true })
- .filter({ visible: true })
- .first()
- .click();
+ await clickHeaderAction(page, 'Kill');
const dialog = page.getByRole('dialog', { name: `Kill "${containerName}"` });
const responsePromise = page.waitForResponse(
(response) =>
@@ -604,12 +598,7 @@ async function killContainerThroughUI(page: Page, containerId: string, container
async function removeContainerThroughUI(page: Page, containerId: string) {
return test.step('Remove container', async () => {
- await page
- .locator('[data-tabs-root] > :not([inert])')
- .getByRole('button', { name: 'Remove', exact: true })
- .filter({ visible: true })
- .first()
- .click();
+ await clickHeaderAction(page, 'Remove');
const responsePromise = page.waitForResponse(
(response) =>
response.request().method() === 'DELETE' &&
diff --git a/tests/spec/environment-switch-isolation.spec.ts b/tests/spec/environment-switch-isolation.spec.ts
index ba1c6f131..a97d12b2e 100644
--- a/tests/spec/environment-switch-isolation.spec.ts
+++ b/tests/spec/environment-switch-isolation.spec.ts
@@ -281,7 +281,8 @@ test.describe('Environment switch isolation', () => {
'true'
);
- await page.getByRole('button', { name: 'Redeploy', exact: true }).click();
+ await page.getByRole('button', { name: 'More actions', exact: true }).click();
+ await page.getByRole('menuitem', { name: 'Redeploy', exact: true }).click();
const dialog = page.getByRole('dialog');
await dialog.getByRole('button', { name: 'Redeploy', exact: true }).click();
await expect(page).toHaveURL('/containers/route-redeployed?tab=overview');
diff --git a/tests/spec/project.spec.ts b/tests/spec/project.spec.ts
index 6368fcbe4..7e1df107f 100644
--- a/tests/spec/project.spec.ts
+++ b/tests/spec/project.spec.ts
@@ -175,12 +175,10 @@ async function destroyCurrentProjectViaUI(page: Page) {
return;
}
- const destroyButton = page.getByRole('button', {
- name: 'Destroy',
- exact: true
- });
- await expect(destroyButton).toBeVisible();
- await destroyButton.click();
+ await page.getByRole('button', { name: 'More actions', exact: true }).click();
+ const destroyItem = page.getByRole('menuitem', { name: 'Destroy', exact: true });
+ await expect(destroyItem).toBeVisible();
+ await destroyItem.click();
const dialog = page.getByRole('dialog');
await expect(dialog).toBeVisible();
@@ -372,7 +370,8 @@ test.describe('Projects Page', () => {
try {
projectId = await createProjectViaUI(page, projectName);
- await page.getByRole('button', { name: 'Archive', exact: true }).click();
+ await page.getByRole('button', { name: 'More actions', exact: true }).click();
+ await page.getByRole('menuitem', { name: 'Archive', exact: true }).click();
await expect(page.getByText('Project archived successfully.')).toBeVisible({
timeout: 10000
});