Skip to content

Modern Docker Management, Designed for Everyone

feat: mobile responsive tables (#597)

Chase Baucomf6463733e284
diff --git a/backend/internal/services/image_service.go b/backend/internal/services/image_service.go
index cd41ae21b..f8821e58a 100644
--- a/backend/internal/services/image_service.go
+++ b/backend/internal/services/image_service.go
@@ -523,11 +523,20 @@ func mapDockerImagesToDTOs(dockerImages []image.Summary, inUseMap map[string]boo
if len(di.RepoTags) > 0 {
repoTag := di.RepoTags[0]
- if strings.Contains(repoTag, ":") {
- parts := strings.SplitN(repoTag, ":", 2)
- imageDto.Repo = parts[0]
- imageDto.Tag = parts[1]
+ // Use LastIndex to split on the LAST colon, correctly handling registry:port/image:tag
+ lastColonIdx := strings.LastIndex(repoTag, ":")
+ if lastColonIdx != -1 {
+ imageDto.Repo = repoTag[:lastColonIdx]
+ imageDto.Tag = repoTag[lastColonIdx+1:]
+ // Handle edge cases
+ if imageDto.Repo == "" {
+ imageDto.Repo = "<none>"
+ }
+ if imageDto.Tag == "" {
+ imageDto.Tag = "<none>"
+ }
} else {
+ // No colon found, treat entire string as repo with default tag
imageDto.Repo = repoTag
imageDto.Tag = "latest"
}
diff --git a/frontend/messages/en.json b/frontend/messages/en.json
index 7e620cf7d..e808495fb 100644
--- a/frontend/messages/en.json
+++ b/frontend/messages/en.json
@@ -1188,6 +1188,9 @@
"dashboard_meter_disk_free": "Free",
"dashboard_meter_disk_total": "Total",
"dashboard_docker_overview": "Docker Overview",
+ "services": "Services",
+ "updated": "Updated",
+ "common_registry": "Registry",
"shell_title": "Shell",
"shell_interactive_access": "Interactive shell access to container",
"shell_select_placeholder": "Select shell",
diff --git a/frontend/src/lib/components/arcane-table/arcane-table-toolbar.svelte b/frontend/src/lib/components/arcane-table/arcane-table-toolbar.svelte
index 59484a9a7..5dc3179bb 100644
--- a/frontend/src/lib/components/arcane-table/arcane-table-toolbar.svelte
+++ b/frontend/src/lib/components/arcane-table/arcane-table-toolbar.svelte
@@ -13,66 +13,89 @@
table,
selectedIds = [],
selectionDisabled = false,
- onRemoveSelected
+ onRemoveSelected,
+ mobileFields = [],
+ onToggleMobileField
}: {
table: Table<TData>;
selectedIds?: string[];
selectionDisabled?: boolean;
onRemoveSelected?: (ids: string[]) => void;
+ mobileFields?: { id: string; label: string; visible: boolean }[];
+ onToggleMobileField?: (fieldId: string) => void;
} = $props();
const isFiltered = $derived(table.getState().columnFilters.length > 0 || !!table.getState().globalFilter);
- const usageColumn = $derived(table.getColumn('inUse'));
- const updatesColumn = $derived(table.getColumn('updates'));
+ const usageColumn = $derived(table.getAllColumns().some((col) => col.id === 'inUse') ? table.getColumn('inUse') : undefined);
+ const updatesColumn = $derived(
+ table.getAllColumns().some((col) => col.id === 'updates') ? table.getColumn('updates') : undefined
+ );
const debouncedSetGlobal = debounced((v: string) => table.setGlobalFilter(v), 300);
const hasSelection = $derived(!selectionDisabled && (selectedIds?.length ?? 0) > 0);
</script>
-<div class="flex items-center justify-between">
- <div class="flex flex-1 items-center space-x-2">
- <Input
- placeholder={m.common_search()}
- value={(table.getState().globalFilter as string) ?? ''}
- oninput={(e) => debouncedSetGlobal(e.currentTarget.value)}
- onchange={(e) => table.setGlobalFilter(e.currentTarget.value)}
- onkeydown={(e) => {
- if (e.key === 'Enter') table.setGlobalFilter((e.currentTarget as HTMLInputElement).value);
- }}
- class="h-8 w-[150px] lg:w-[250px]"
- />
+<div class="flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between">
+ <div class="flex flex-col gap-2 sm:flex-1 sm:flex-row sm:items-center sm:justify-between">
+ <div class="flex flex-col gap-2 sm:flex-row sm:items-center sm:space-x-2">
+ <div class="flex items-center gap-2">
+ <Input
+ placeholder={m.common_search()}
+ value={(table.getState().globalFilter as string) ?? ''}
+ oninput={(e) => debouncedSetGlobal(e.currentTarget.value)}
+ onchange={(e) => table.setGlobalFilter(e.currentTarget.value)}
+ onkeydown={(e) => {
+ if (e.key === 'Enter') table.setGlobalFilter((e.currentTarget as HTMLInputElement).value);
+ }}
+ class="h-8 w-full sm:w-[150px] lg:w-[250px]"
+ />
- {#if usageColumn}
- <DataTableFacetedFilter column={usageColumn} title={m.common_usage()} options={usageFilters} />
- {/if}
- {#if updatesColumn}
- <DataTableFacetedFilter column={updatesColumn} title={m.images_updates()} options={imageUpdateFilters} />
- {/if}
+ <div class="md:hidden">
+ {#if mobileFields.length > 0 && onToggleMobileField}
+ <DataTableViewOptions fields={mobileFields} onToggleField={onToggleMobileField} />
+ {:else}
+ <DataTableViewOptions {table} />
+ {/if}
+ </div>
+ </div>
- {#if isFiltered}
- <Button
- variant="ghost"
- onclick={() => {
- table.resetColumnFilters();
- table.resetGlobalFilter();
- }}
- class="h-8 px-2 lg:px-3"
- >
- {m.common_reset()}
- <XIcon />
- </Button>
- {/if}
- </div>
+ <div class="flex flex-wrap items-center gap-2 sm:gap-0 sm:space-x-2">
+ {#if usageColumn}
+ <DataTableFacetedFilter column={usageColumn} title={m.common_usage()} options={usageFilters} />
+ {/if}
+ {#if updatesColumn}
+ <DataTableFacetedFilter column={updatesColumn} title={m.images_updates()} options={imageUpdateFilters} />
+ {/if}
+
+ {#if isFiltered}
+ <Button
+ variant="ghost"
+ onclick={() => {
+ table.resetColumnFilters();
+ table.resetGlobalFilter();
+ }}
+ class="h-8 px-2 lg:px-3"
+ >
+ {m.common_reset()}
+ <XIcon />
+ </Button>
+ {/if}
+ </div>
+ </div>
- <div class="flex items-center gap-2">
- {#if hasSelection && onRemoveSelected}
- <ArcaneButton
- action="remove"
- size="sm"
- customLabel={m.common_remove_selected({ count: selectedIds?.length ?? 0 })}
- onclick={() => onRemoveSelected?.(selectedIds!)}
- />
- {/if}
- <DataTableViewOptions {table} />
+ <!-- View options - desktop only, end aligned -->
+ <div class="hidden md:block">
+ <DataTableViewOptions {table} />
+ </div>
</div>
+
+ <!-- Actions on the right (wraps on mobile) -->
+ {#if hasSelection && onRemoveSelected}
+ <ArcaneButton
+ action="remove"
+ size="sm"
+ customLabel={m.common_remove_selected({ count: selectedIds?.length ?? 0 })}
+ onclick={() => onRemoveSelected?.(selectedIds!)}
+ />
+ {/if}
</div>
diff --git a/frontend/src/lib/components/arcane-table/arcane-table-view-options.svelte b/frontend/src/lib/components/arcane-table/arcane-table-view-options.svelte
index 5ce45ce34..6836086cd 100644
--- a/frontend/src/lib/components/arcane-table/arcane-table-view-options.svelte
+++ b/frontend/src/lib/components/arcane-table/arcane-table-view-options.svelte
@@ -5,7 +5,15 @@
import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
import { m } from '$lib/paraglide/messages';
- let { table }: { table: Table<TData> } = $props();
+ let {
+ table,
+ fields,
+ onToggleField
+ }: {
+ table?: Table<TData>;
+ fields?: { id: string; label: string; visible: boolean }[];
+ onToggleField?: (fieldId: string) => void;
+ } = $props();
</script>
<DropdownMenu.Root>
@@ -13,24 +21,35 @@
class={buttonVariants({
variant: 'outline',
size: 'sm',
- class: 'ml-auto hidden h-8 lg:flex'
+ class: 'h-8'
})}
>
<Settings2Icon />
{m.common_view()}
</DropdownMenu.Trigger>
- <DropdownMenu.Content>
+ <DropdownMenu.Content align="end">
<DropdownMenu.Group>
<DropdownMenu.Label>{m.common_toggle_columns()}</DropdownMenu.Label>
<DropdownMenu.Separator />
- {#each table.getAllColumns().filter((col) => typeof col.accessorFn !== 'undefined' && col.getCanHide()) as column (column)}
- <DropdownMenu.CheckboxItem
- bind:checked={() => column.getIsVisible(), (v) => column.toggleVisibility(!!v)}
- class="capitalize"
- >
- {column.id}
- </DropdownMenu.CheckboxItem>
- {/each}
+
+ {#if table}
+ {#each table
+ .getAllColumns()
+ .filter((col) => typeof col.accessorFn !== 'undefined' && col.getCanHide()) as column (column)}
+ <DropdownMenu.CheckboxItem
+ bind:checked={() => column.getIsVisible(), (v) => column.toggleVisibility(!!v)}
+ class="capitalize"
+ >
+ {column.id}
+ </DropdownMenu.CheckboxItem>
+ {/each}
+ {:else if fields && onToggleField}
+ {#each fields as field (field.id)}
+ <DropdownMenu.CheckboxItem bind:checked={() => field.visible, (v) => onToggleField(field.id)} class="capitalize">
+ {field.label}
+ </DropdownMenu.CheckboxItem>
+ {/each}
+ {/if}
</DropdownMenu.Group>
</DropdownMenu.Content>
</DropdownMenu.Root>
diff --git a/frontend/src/lib/components/arcane-table/arcane-table.svelte b/frontend/src/lib/components/arcane-table/arcane-table.svelte
index fadbedfac..7ea728a2d 100644
--- a/frontend/src/lib/components/arcane-table/arcane-table.svelte
+++ b/frontend/src/lib/components/arcane-table/arcane-table.svelte
@@ -28,7 +28,7 @@
import * as Select from '$lib/components/ui/select/index.js';
import type { HTMLAttributes } from 'svelte/elements';
import { cn } from '$lib/utils.js';
- import type { Paginated, SearchPaginationSortRequest, FilterMap } from '$lib/types/pagination.type';
+ import type { Paginated, SearchPaginationSortRequest } from '$lib/types/pagination.type';
import type { Snippet } from 'svelte';
import type { ColumnSpec } from './arcane-table.types.svelte';
import TableCheckbox from './arcane-table-checkbox.svelte';
@@ -36,11 +36,13 @@
import { PersistedState } from 'runed';
import {
type CompactTablePrefs,
+ type FieldSpec,
encodeHidden,
applyHiddenPatch,
encodeFilters,
- decodeFilters
+ encodeMobileHidden
} from './arcane-table.types.svelte';
+ import { buildInitialMobileVisibility, extractPersistedPreferences, filterMapsEqual, toFilterMap } from './arcane-table.utils';
let {
items,
@@ -51,6 +53,9 @@
onRefresh,
columns,
rowActions,
+ mobileCard,
+ mobileFields = [],
+ mobileFieldVisibility = $bindable<Record<string, boolean>>({}),
selectedIds = $bindable<string[]>([]),
onRemoveSelected,
persistKey
@@ -63,6 +68,9 @@
onRefresh: (requestOptions: SearchPaginationSortRequest) => Promise<Paginated<TData>>;
columns: ColumnSpec<TData>[];
rowActions?: Snippet<[{ row: Row<TData>; item: TData }]>;
+ mobileCard: Snippet<[{ row: Row<TData>; item: TData; mobileFieldVisibility: Record<string, boolean> }]>;
+ mobileFields?: FieldSpec[];
+ mobileFieldVisibility?: Record<string, boolean>;
selectedIds?: string[];
onRemoveSelected?: (ids: string[]) => void;
persistKey?: string;
@@ -75,7 +83,6 @@
let globalFilter = $state<string>('');
const enablePersist = !!persistKey;
-
const getDefaultLimit = () => requestOptions?.pagination?.limit ?? items?.pagination?.itemsPerPage ?? 20;
const prefs = enablePersist
? new PersistedState<CompactTablePrefs>(
@@ -94,35 +101,71 @@
const canPrev = $derived(currentPage > 1);
const canNext = $derived(currentPage < totalPages);
- // Apply persisted state on mount
import { onMount } from 'svelte';
onMount(() => {
if (!enablePersist) return;
- const cur = prefs?.current ?? { v: [], f: [], g: '', l: getDefaultLimit() };
+ const snapshot = extractPersistedPreferences(prefs?.current, getDefaultLimit());
- applyHiddenPatch(columnVisibility, cur.v);
+ applyHiddenPatch(columnVisibility, snapshot.hiddenColumns);
- // Filters
let shouldRefresh = false;
- const restoredFilters = decodeFilters(cur.f);
- if (restoredFilters.length) columnFilters = restoredFilters;
- if (cur.g && cur.g !== globalFilter) {
- globalFilter = cur.g;
+ const { restoredFilters, filtersMap } = snapshot;
+ if (restoredFilters.length) {
+ columnFilters = restoredFilters;
+ }
+ if (Object.keys(filtersMap).length > 0) {
+ if (!filterMapsEqual(filtersMap, requestOptions?.filters)) {
+ requestOptions = {
+ ...requestOptions,
+ filters: filtersMap,
+ pagination: { page: 1, limit: requestOptions?.pagination?.limit ?? getDefaultLimit() }
+ };
+ shouldRefresh = true;
+ }
+ } else if (requestOptions?.filters && Object.keys(requestOptions.filters).length > 0) {
requestOptions = {
...requestOptions,
- search: cur.g,
+ filters: undefined,
pagination: { page: 1, limit: requestOptions?.pagination?.limit ?? getDefaultLimit() }
};
shouldRefresh = true;
}
- // Page size
- const persistedLimit = cur.l ?? getDefaultLimit();
+
+ const persistedSearch = snapshot.search;
+ const currentSearch = (requestOptions?.search ?? '').trim();
+ if (persistedSearch !== globalFilter) {
+ globalFilter = persistedSearch;
+ }
+ if (persistedSearch) {
+ if (persistedSearch !== currentSearch) {
+ requestOptions = {
+ ...requestOptions,
+ search: persistedSearch,
+ pagination: { page: 1, limit: requestOptions?.pagination?.limit ?? getDefaultLimit() }
+ };
+ shouldRefresh = true;
+ }
+ } else if (currentSearch) {
+ requestOptions = {
+ ...requestOptions,
+ search: undefined,
+ pagination: { page: 1, limit: requestOptions?.pagination?.limit ?? getDefaultLimit() }
+ };
+ shouldRefresh = true;
+ }
+
+ const persistedLimit = snapshot.limit ?? getDefaultLimit();
const currentLimit = requestOptions?.pagination?.limit ?? getDefaultLimit();
if (persistedLimit !== currentLimit) {
requestOptions = { ...requestOptions, pagination: { page: 1, limit: persistedLimit } };
shouldRefresh = true;
}
if (shouldRefresh) onRefresh(requestOptions);
+
+ const initialMobileVisibility = buildInitialMobileVisibility(mobileFields, mobileFieldVisibility, snapshot.mobileHidden);
+ if (initialMobileVisibility) {
+ mobileFieldVisibility = initialMobileVisibility;
+ }
});
function updatePagination(patch: Partial<{ page: number; limit: number }>) {
@@ -332,26 +375,25 @@
getCoreRowModel: getCoreRowModel()
});
- function toFilterMap(filters: ColumnFiltersState): FilterMap {
- const out: FilterMap = {};
- for (const f of filters ?? []) {
- const id = f.id;
- let v: unknown = (f as any).value;
- if (Array.isArray(v)) {
- if (v.length === 0) continue;
- v = v[0];
- } else if (v && typeof v === 'object' && v instanceof Set) {
- const first = (v as Set<unknown>).values().next().value;
- if (first === undefined) continue;
- v = first;
- }
- if (v !== undefined && v !== null && String(v).trim() !== '') {
- out[id] = v as any; // scalar only
- }
+ function onToggleMobileField(fieldId: string) {
+ mobileFieldVisibility = {
+ ...mobileFieldVisibility,
+ [fieldId]: !mobileFieldVisibility[fieldId]
+ };
+ // Persist mobile field visibility
+ if (enablePersist && prefs) {
+ prefs.current = { ...prefs.current, m: encodeMobileHidden(mobileFieldVisibility) };
}
- return out;
}
+ const mobileFieldsForOptions = $derived(
+ mobileFields.map((field) => ({
+ id: field.id,
+ label: field.label,
+ visible: mobileFieldVisibility[field.id] ?? true
+ }))
+ );
+
$effect(() => {
const s = requestOptions?.sort;
if (!s) {
@@ -374,12 +416,12 @@
{/snippet}
{#snippet Pagination({ table }: { table: TableType<TData> })}
- <div class="flex items-center justify-between px-2">
- <div class="text-muted-foreground flex-1 text-sm">
+ <div class="flex flex-col gap-4 px-2 sm:flex-row sm:items-center sm:justify-between">
+ <div class="text-muted-foreground order-2 text-sm sm:order-1">
{m.common_showing_of_total({ shown: items.data.length, total: totalItems })}
</div>
- <div class="flex items-center space-x-6 lg:space-x-8">
- <div class="flex items-center space-x-2">
+ <div class="order-1 flex flex-col gap-4 sm:order-2 sm:flex-row sm:items-center sm:space-x-6 lg:space-x-8">
+ <div class="flex items-center justify-between space-x-2 sm:justify-start">
<p class="text-sm font-medium">{m.common_rows_per_page()}</p>
<Select.Root
allowDeselect={false}
@@ -399,31 +441,37 @@
</Select.Content>
</Select.Root>
</div>
- <div class="flex w-[100px] items-center justify-center text-sm font-medium">
- {m.common_page_of({ page: currentPage, total: totalPages })}
- </div>
- <div class="flex items-center space-x-2">
- <Button variant="outline" class="hidden size-8 p-0 lg:flex" onclick={() => setPage(1)} disabled={!canPrev}>
- <span class="sr-only">{m.common_go_first_page()}</span>
- <ChevronsLeftIcon />
- </Button>
- <Button variant="outline" class="size-8 p-0" onclick={() => setPage(currentPage - 1)} disabled={!canPrev}>
- <span class="sr-only">{m.common_go_prev_page()}</span>
- <ChevronLeftIcon />
- </Button>
- <Button variant="outline" class="size-8 p-0" onclick={() => setPage(currentPage + 1)} disabled={!canNext}>
- <span class="sr-only">{m.common_go_next_page()}</span>
- <ChevronRightIcon />
- </Button>
- <Button variant="outline" class="hidden size-8 p-0 lg:flex" onclick={() => setPage(totalPages)} disabled={!canNext}>
- <span class="sr-only">{m.common_go_last_page()}</span>
- <ChevronsRightIcon />
- </Button>
+ <div class="flex items-center justify-between sm:justify-center">
+ <div class="flex items-center justify-center text-sm font-medium sm:w-[100px]">
+ {m.common_page_of({ page: currentPage, total: totalPages })}
+ </div>
+ <div class="flex items-center space-x-1 sm:space-x-2">
+ <Button variant="outline" class="hidden size-8 p-0 lg:flex" onclick={() => setPage(1)} disabled={!canPrev}>
+ <span class="sr-only">{m.common_go_first_page()}</span>
+ <ChevronsLeftIcon />
+ </Button>
+ <Button variant="outline" class="size-8 p-0" onclick={() => setPage(currentPage - 1)} disabled={!canPrev}>
+ <span class="sr-only">{m.common_go_prev_page()}</span>
+ <ChevronLeftIcon />
+ </Button>
+ <Button variant="outline" class="size-8 p-0" onclick={() => setPage(currentPage + 1)} disabled={!canNext}>
+ <span class="sr-only">{m.common_go_next_page()}</span>
+ <ChevronRightIcon />
+ </Button>
+ <Button variant="outline" class="hidden size-8 p-0 lg:flex" onclick={() => setPage(totalPages)} disabled={!canNext}>
+ <span class="sr-only">{m.common_go_last_page()}</span>
+ <ChevronsRightIcon />
+ </Button>
+ </div>
</div>
</div>
</div>
{/snippet}
+{#snippet MobileCard({ row, item }: { row: Row<TData>; item: TData })}
+ {@render mobileCard({ row, item, mobileFieldVisibility })}
+{/snippet}
+
{#snippet ColumnHeader({
column,
title,
@@ -475,9 +523,18 @@
<div class="space-y-4">
{#if !withoutSearch}
- <DataTableToolbar {table} {selectedIds} {selectionDisabled} {onRemoveSelected} />
+ <DataTableToolbar
+ {table}
+ {selectedIds}
+ {selectionDisabled}
+ {onRemoveSelected}
+ mobileFields={mobileFieldsForOptions}
+ {onToggleMobileField}
+ />
{/if}
- <div class="rounded-md">
+
+ <!-- Desktop Table View -->
+ <div class="hidden rounded-md md:block">
<Table.Root>
<Table.Header>
{#each table.getHeaderGroups() as headerGroup (headerGroup.id)}
@@ -509,6 +566,18 @@
</Table.Body>
</Table.Root>
</div>
+
+ <!-- Mobile Card View -->
+ <div class="space-y-3 md:hidden">
+ {#each table.getRowModel().rows as row (row.id)}
+ {@render MobileCard({ row, item: row.original as TData })}
+ {:else}
+ <div class="h-24 flex items-center justify-center text-center text-muted-foreground">
+ {m.common_no_results_found()}
+ </div>
+ {/each}
+ </div>
+
{#if !withoutPagination}
{@render Pagination({ table })}
{/if}
diff --git a/frontend/src/lib/components/arcane-table/arcane-table.types.svelte.ts b/frontend/src/lib/components/arcane-table/arcane-table.types.svelte.ts
index 3f60f41d2..6982f5776 100644
--- a/frontend/src/lib/components/arcane-table/arcane-table.types.svelte.ts
+++ b/frontend/src/lib/components/arcane-table/arcane-table.types.svelte.ts
@@ -1,6 +1,12 @@
import type { Row, Column, FilterFn, ColumnFiltersState, VisibilityState } from '@tanstack/table-core';
import type { Snippet } from 'svelte';
+export type FieldSpec = {
+ id: string;
+ label: string;
+ defaultVisible?: boolean;
+};
+
export type ColumnSpec<T> = {
accessorKey?: keyof T & string;
accessorFn?: (row: T) => any;
@@ -24,6 +30,8 @@ export type CompactTablePrefs = {
g?: string;
// l: page size (limit)
l?: number;
+ // m: list of hidden mobile field ids
+ m?: string[];
};
export function encodeHidden(visibility: VisibilityState): string[] {
@@ -49,3 +57,18 @@ export function decodeFilters(pairs?: [string, unknown][]): ColumnFiltersState {
if (!pairs?.length) return [];
return pairs.map(([id, value]) => ({ id, value }));
}
+
+export function encodeMobileHidden(visibility: Record<string, boolean>): string[] {
+ const hidden: string[] = [];
+ for (const [id, visible] of Object.entries(visibility)) {
+ if (visible === false) hidden.push(id);
+ }
+ return hidden;
+}
+
+export function applyMobileHiddenPatch(target: Record<string, boolean>, hidden?: string[]) {
+ if (!hidden?.length) return;
+ for (const id of hidden) {
+ target[id] = false;
+ }
+}
diff --git a/frontend/src/lib/components/arcane-table/arcane-table.utils.ts b/frontend/src/lib/components/arcane-table/arcane-table.utils.ts
new file mode 100644
index 000000000..be04d9c6d
--- /dev/null
+++ b/frontend/src/lib/components/arcane-table/arcane-table.utils.ts
@@ -0,0 +1,93 @@
+import type { ColumnFiltersState } from '@tanstack/table-core';
+import type { FilterMap } from '$lib/types/pagination.type';
+import type { CompactTablePrefs, FieldSpec } from './arcane-table.types.svelte';
+import { decodeFilters, applyMobileHiddenPatch } from './arcane-table.types.svelte';
+
+export type PersistedPreferencesSnapshot = {
+ hiddenColumns: string[];
+ restoredFilters: ColumnFiltersState;
+ filtersMap: FilterMap;
+ search: string;
+ limit: number;
+ mobileHidden?: string[];
+};
+
+export function toFilterMap(filters: ColumnFiltersState): FilterMap {
+ const out: FilterMap = {};
+ for (const f of filters ?? []) {
+ const id = f.id;
+ let value: unknown = (f as any).value;
+ if (Array.isArray(value)) {
+ if (value.length === 0) continue;
+ value = value[0];
+ } else if (value && typeof value === 'object' && value instanceof Set) {
+ const first = (value as Set<unknown>).values().next().value;
+ if (first === undefined) continue;
+ value = first;
+ }
+ if (value !== undefined && value !== null && String(value).trim() !== '') {
+ out[id] = value as any;
+ }
+ }
+ return out;
+}
+
+export function filterMapsEqual(a?: FilterMap, b?: FilterMap): boolean {
+ const keysA = Object.keys(a ?? {});
+ const keysB = Object.keys(b ?? {});
+ if (keysA.length !== keysB.length) return false;
+ const mapB = b ?? {};
+ for (const key of keysA) {
+ const valueA = (a ?? {})[key];
+ const valueB = mapB[key];
+ if (Array.isArray(valueA) || Array.isArray(valueB)) {
+ if (!Array.isArray(valueA) || !Array.isArray(valueB)) return false;
+ if (valueA.length !== valueB.length) return false;
+ for (let i = 0; i < valueA.length; i += 1) {
+ if (`${valueA[i]}` !== `${valueB[i]}`) return false;
+ }
+ continue;
+ }
+ if (valueA !== valueB) {
+ if (valueA == null || valueB == null) return false;
+ if (`${valueA}` !== `${valueB}`) return false;
+ }
+ }
+ return true;
+}
+
+export function extractPersistedPreferences(
+ current: CompactTablePrefs | undefined,
+ fallbackLimit: number
+): PersistedPreferencesSnapshot {
+ const prefs = current ?? { v: [], f: [], g: '', l: fallbackLimit };
+ const restoredFilters = decodeFilters(prefs.f);
+ const filtersMap = toFilterMap(restoredFilters);
+ const search = (prefs.g ?? '').trim();
+ const limit = prefs.l ?? fallbackLimit;
+
+ return {
+ hiddenColumns: prefs.v ?? [],
+ restoredFilters,
+ filtersMap,
+ search,
+ limit,
+ mobileHidden: prefs.m
+ };
+}
+
+export function buildInitialMobileVisibility(
+ fields: FieldSpec[],
+ mobileFieldVisibility: Record<string, boolean>,
+ persistedHidden?: string[]
+): Record<string, boolean> | null {
+ if (!fields.length || Object.keys(mobileFieldVisibility).length) return null;
+ const initial: Record<string, boolean> = {};
+ for (const field of fields) {
+ initial[field.id] = field.defaultVisible ?? true;
+ }
+ if (persistedHidden && persistedHidden.length > 0) {
+ applyMobileHiddenPatch(initial, persistedHidden);
+ }
+ return initial;
+}
diff --git a/frontend/src/lib/components/arcane-table/cards/universal-mobile-card.svelte b/frontend/src/lib/components/arcane-table/cards/universal-mobile-card.svelte
new file mode 100644
index 000000000..debcfbe2b
--- /dev/null
+++ b/frontend/src/lib/components/arcane-table/cards/universal-mobile-card.svelte
@@ -0,0 +1,229 @@
+<script lang="ts" generics="T">
+ import * as Card from '$lib/components/ui/card';
+ import StatusBadge from '$lib/components/badges/status-badge.svelte';
+ import { cn } from '$lib/utils';
+ import type { Snippet, Component } from 'svelte';
+
+ type IconVariant = 'emerald' | 'red' | 'amber' | 'blue' | 'purple' | 'gray' | 'sky' | 'orange';
+ type BadgeVariant = 'green' | 'red' | 'amber' | 'blue' | 'purple' | 'gray' | 'orange';
+
+ interface IconConfig {
+ component: Component<any>;
+ variant: IconVariant;
+ }
+
+ interface BadgeConfig {
+ variant: BadgeVariant;
+ text: string;
+ }
+
+ type FieldType = 'text' | 'badge' | 'date' | 'mono' | 'component';
+
+ interface FieldDefinition<T> {
+ label: string;
+ getValue: (item: T) => any;
+ type?: FieldType;
+ icon?: Component<any>;
+ iconVariant?: IconVariant;
+ badgeVariant?: BadgeVariant;
+ component?: Snippet<[value: any]>;
+ show?: boolean;
+ }
+
+ interface FooterConfig<T> {
+ label: string;
+ getValue: (item: T) => string;
+ icon: Component<any>;
+ }
+
+ let {
+ item,
+ icon,
+ title,
+ subtitle,
+ badges = [],
+ fields = [],
+ footer,
+ rowActions,
+ children,
+ compact = false,
+ class: className = '',
+ onclick
+ }: {
+ item: T;
+ icon: IconConfig | ((item: T) => IconConfig);
+ title: (item: T) => string;
+ subtitle?: (item: T) => string | null;
+ badges?: (BadgeConfig | ((item: T) => BadgeConfig | null))[];
+ fields?: FieldDefinition<T>[];
+ footer?: FooterConfig<T>;
+ rowActions?: Snippet<[{ item: T }]>;
+ children?: Snippet;
+ compact?: boolean;
+ class?: string;
+ onclick?: (item: T) => void;
+ } = $props();
+
+ const resolvedIcon = $derived(typeof icon === 'function' ? icon(item) : icon);
+ const resolvedBadges = $derived(
+ badges.map((b) => (typeof b === 'function' ? b(item) : b)).filter((b): b is BadgeConfig => b !== null)
+ );
+
+ const visibleFields = $derived(fields.filter((f) => f.show !== false));
+
+ function getIconBgClass(variant: IconVariant): string {
+ const map: Record<IconVariant, string> = {
+ emerald: 'bg-emerald-500/10',
+ red: 'bg-red-500/10',
+ amber: 'bg-amber-500/10',
+ blue: 'bg-blue-500/10',
+ purple: 'bg-purple-500/10',
+ gray: 'bg-muted',
+ sky: 'bg-sky-500/10',
+ orange: 'bg-orange-500/10'
+ };
+ return map[variant];
+ }
+
+ function getIconTextClass(variant: IconVariant): string {
+ const map: Record<IconVariant, string> = {
+ emerald: 'text-emerald-500',
+ red: 'text-red-500',
+ amber: 'text-amber-500',
+ blue: 'text-blue-500',
+ purple: 'text-purple-500',
+ gray: 'text-muted-foreground',
+ sky: 'text-sky-500',
+ orange: 'text-orange-500'
+ };
+ return map[variant];
+ }
+</script>
+
+<Card.Root variant="subtle" class={className} onclick={onclick ? () => onclick(item) : undefined}>
+ <Card.Content class={cn('flex flex-col', compact ? 'gap-1.5 p-2' : 'gap-3 p-4')}>
+ <!-- Main Row -->
+ <div class="flex items-start gap-3">
+ {#if resolvedIcon}
+ {@const IconComponent = resolvedIcon.component}
+ <div
+ class={cn(
+ 'flex shrink-0 items-center justify-center rounded-lg',
+ compact ? 'size-7' : 'size-9',
+ getIconBgClass(resolvedIcon.variant)
+ )}
+ >
+ <IconComponent class={cn(getIconTextClass(resolvedIcon.variant), compact ? 'size-3.5' : 'size-4')} />
+ </div>
+ {/if}
+ <div class="min-w-0 flex-1">
+ <h3 class={cn('truncate font-semibold leading-tight', compact ? 'text-[13px]' : 'text-base')} title={title(item)}>
+ {title(item)}
+ </h3>
+ {#if subtitle}
+ {@const subtitleValue = subtitle(item)}
+ {#if subtitleValue}
+ <p class={cn('text-muted-foreground mt-0.5 truncate', compact ? 'text-[10px]' : 'text-xs')}>
+ {subtitleValue}
+ </p>
+ {/if}
+ {/if}
+ </div>
+ <div class="flex flex-shrink-0 items-center gap-2">
+ {#each resolvedBadges as badge}
+ <StatusBadge variant={badge.variant} text={badge.text} size="sm" />
+ {/each}
+ {#if rowActions}
+ {@render rowActions({ item })}
+ {/if}
+ </div>
+ </div>
+
+ <!-- Additional Fields -->
+ {#if visibleFields.length > 0}
+ {#if !compact}
+ <div class="flex flex-wrap gap-x-4 gap-y-3">
+ {#each visibleFields as field}
+ {@const value = field.getValue(item)}
+ {#if value !== null && value !== undefined}
+ <div class="flex min-w-0 flex-1 basis-[160px] items-start gap-2.5">
+ {#if field.icon}
+ {@const FieldIcon = field.icon}
+ <div
+ class={cn(
+ 'flex size-7 shrink-0 items-center justify-center rounded-lg',
+ field.iconVariant ? getIconBgClass(field.iconVariant) : 'bg-muted'
+ )}
+ >
+ <FieldIcon
+ class={cn(field.iconVariant ? getIconTextClass(field.iconVariant) : 'text-muted-foreground', 'size-3.5')}
+ />
+ </div>
+ {/if}
+ <div class="min-w-0 flex-1">
+ <div class="text-muted-foreground text-[10px] font-medium uppercase tracking-wide">
+ {field.label}
+ </div>
+ <div class="mt-0.5 text-xs font-medium">
+ {#if field.type === 'badge' && field.badgeVariant}
+ <StatusBadge variant={field.badgeVariant} text={String(value)} />
+ {:else if field.type === 'mono'}
+ <span class="font-mono">{value}</span>
+ {:else if field.type === 'component' && field.component}
+ {@render field.component(value)}
+ {:else}
+ {value}
+ {/if}
+ </div>
+ </div>
+ </div>
+ {/if}
+ {/each}
+ </div>
+ {:else}
+ {#each visibleFields as field}
+ {@const value = field.getValue(item)}
+ {#if value !== null && value !== undefined}
+ <div class="flex items-baseline gap-1.5">
+ <span class="text-muted-foreground text-[10px] font-medium uppercase tracking-wide">{field.label}:</span>
+ {#if field.type === 'badge' && field.badgeVariant}
+ <StatusBadge variant={field.badgeVariant} text={String(value)} size="sm" />
+ {:else if field.type === 'mono'}
+ <span class="text-muted-foreground truncate font-mono text-[11px] leading-tight">{value}</span>
+ {:else if field.type === 'component' && field.component}
+ <span class="text-muted-foreground min-w-0 flex-1 text-[11px] leading-tight">
+ {@render field.component(value)}
+ </span>
+ {:else}
+ <span class="text-muted-foreground min-w-0 flex-1 truncate text-[11px] leading-tight">
+ {value}
+ </span>
+ {/if}
+ </div>
+ {/if}
+ {/each}
+ {/if}
+ {/if}
+
+ <!-- Custom children content -->
+ {#if children}
+ {@render children()}
+ {/if}
+ </Card.Content>
+
+ {#if !compact && footer}
+ {@const footerValue = footer.getValue(item)}
+ {#if footerValue}
+ {@const FooterIcon = footer.icon}
+ <Card.Footer class="border-t-1 flex items-center gap-2 py-3">
+ <FooterIcon class="text-muted-foreground size-3.5" />
+ <span class="text-muted-foreground text-[10px] font-medium uppercase tracking-wide">
+ {footer.label}
+ </span>
+ <span class="text-muted-foreground ml-auto font-mono text-[11px]">
+ {footerValue}
+ </span>
+ </Card.Footer>
+ {/if}
+ {/if}
+</Card.Root>
diff --git a/frontend/src/lib/components/arcane-table/index.ts b/frontend/src/lib/components/arcane-table/index.ts
index 96cf94ed5..f050fb1cd 100644
--- a/frontend/src/lib/components/arcane-table/index.ts
+++ b/frontend/src/lib/components/arcane-table/index.ts
@@ -1,4 +1,5 @@
export { default as DataTableToolbar } from './arcane-table-toolbar.svelte';
export { default as DataTableViewOptions } from './arcane-table-view-options.svelte';
export { default as DataTableFacetedFilter } from './arcane-table-filter.svelte';
-export type { ColumnSpec } from './arcane-table.types.svelte';
+export type { ColumnSpec, FieldSpec } from './arcane-table.types.svelte';
+export { default as UniversalMobileCard } from './cards/universal-mobile-card.svelte';
diff --git a/frontend/src/lib/components/disk-meter.svelte b/frontend/src/lib/components/disk-meter.svelte
index 0f790eb3a..1a3b265ad 100644
--- a/frontend/src/lib/components/disk-meter.svelte
+++ b/frontend/src/lib/components/disk-meter.svelte
@@ -1,4 +1,5 @@
<script lang="ts">
+ import * as Card from '$lib/components/ui/card';
import { Progress } from '$lib/components/ui/progress/index.js';
import HardDriveIcon from '@lucide/svelte/icons/hard-drive';
import LoaderCircleIcon from '@lucide/svelte/icons/loader-circle';
@@ -28,84 +29,71 @@
}
</script>
-<div
- class="bg-card/80 supports-[backdrop-filter]:bg-card/60 ring-border/40 group relative
- isolate flex flex-col
- overflow-hidden rounded-xl border
- shadow-sm ring-1 ring-inset backdrop-blur-sm transition-all
- duration-300 hover:shadow-md dark:shadow-none {className}"
->
- <div
- class="flex items-center gap-3 bg-gradient-to-br from-gray-50 to-slate-50/30 p-3 sm:p-4 dark:from-gray-900/20 dark:to-slate-900/10"
- >
- <div
- class="from-primary to-primary/80 shadow-primary/25 flex size-8 shrink-0 items-center justify-center rounded-full bg-gradient-to-br shadow-lg sm:size-10"
- >
- {#if loading}
- <LoaderCircleIcon class="size-4 animate-spin text-white sm:size-5" />
- {:else}
- <HardDriveIcon class="size-4 text-white sm:size-5" />
- {/if}
- </div>
- <div class="min-w-0 flex-1">
- <div class="text-foreground text-sm font-semibold">{m.dashboard_meter_disk()}</div>
- <div class="text-muted-foreground text-xs">{m.dashboard_meter_disk_desc()}</div>
- </div>
- </div>
-
- <div class="flex flex-1 items-center p-3 sm:p-4">
- <div class="flex w-full items-center gap-4">
- <div class="flex-1 space-y-2">
- {#if loading}
- <div class="bg-muted h-2 w-full animate-pulse rounded"></div>
- {:else}
- <Progress value={percentage} max={100} class="h-2" />
- {/if}
-
- <div class="flex items-center justify-between text-xs">
- {#if loading}
- <div class="bg-muted h-3 w-16 animate-pulse rounded"></div>
- <div class="bg-muted h-3 w-24 animate-pulse rounded"></div>
- {:else}
- <span class="text-muted-foreground font-medium">
- {percentage.toFixed(1)}%
- </span>
- <span class="text-muted-foreground/70 font-mono">
- {formatBytes(diskUsage ?? 0)} / {formatBytes(diskTotal ?? 0)}
- </span>
- {/if}
+<Card.Root class={className}>
+ {#snippet children()}
+ <Card.Header icon={loading ? LoaderCircleIcon : HardDriveIcon} iconVariant="primary" compact>
+ {#snippet children()}
+ <div class="min-w-0 flex-1">
+ <div class="text-foreground text-sm font-semibold">{m.dashboard_meter_disk()}</div>
+ <div class="text-muted-foreground text-xs">{m.dashboard_meter_disk_desc()}</div>
</div>
- </div>
+ {/snippet}
+ </Card.Header>
- <div class="bg-muted/50 hidden shrink-0 gap-4 rounded-lg p-3 sm:flex">
- <div class="space-y-0.5">
+ <Card.Content class="flex flex-1 items-center p-3 sm:p-4">
+ <div class="flex w-full items-center gap-4">
+ <div class="flex-1 space-y-2">
{#if loading}
- <div class="bg-muted h-3 w-12 animate-pulse rounded"></div>
- <div class="bg-muted h-4 w-16 animate-pulse rounded"></div>
+ <div class="bg-muted h-2 w-full animate-pulse rounded"></div>
{:else}
- <div class="text-muted-foreground text-[10px] font-medium uppercase tracking-wide">
- {m.dashboard_meter_disk_used()}
- </div>
- <div class="text-foreground text-sm font-semibold">
- {formatBytes(diskUsage ?? 0)}
- </div>
+ <Progress value={percentage} max={100} class="h-2" />
{/if}
+
+ <div class="flex items-center justify-between text-xs">
+ {#if loading}
+ <div class="bg-muted h-3 w-16 animate-pulse rounded"></div>
+ <div class="bg-muted h-3 w-24 animate-pulse rounded"></div>
+ {:else}
+ <span class="text-muted-foreground font-medium">
+ {percentage.toFixed(1)}%
+ </span>
+ <span class="text-muted-foreground/70 font-mono">
+ {formatBytes(diskUsage ?? 0)} / {formatBytes(diskTotal ?? 0)}
+ </span>
+ {/if}
+ </div>
</div>
- <div class="space-y-0.5">
- {#if loading}
- <div class="bg-muted h-3 w-12 animate-pulse rounded"></div>
- <div class="bg-muted h-4 w-16 animate-pulse rounded"></div>
- {:else}
- <div class="text-muted-foreground text-[10px] font-medium uppercase tracking-wide">
- {m.dashboard_meter_disk_free()}
- </div>
- <div class="text-foreground text-sm font-semibold">
- {formatBytes(diskFree)}
- </div>
- {/if}
+ <div class="bg-muted/50 hidden shrink-0 gap-4 rounded-lg p-3 sm:flex">
+ <div class="space-y-0.5">
+ {#if loading}
+ <div class="bg-muted h-3 w-12 animate-pulse rounded"></div>
+ <div class="bg-muted h-4 w-16 animate-pulse rounded"></div>
+ {:else}
+ <div class="text-muted-foreground text-[10px] font-medium tracking-wide uppercase">
+ {m.dashboard_meter_disk_used()}
+ </div>
+ <div class="text-foreground text-sm font-semibold">
+ {formatBytes(diskUsage ?? 0)}
+ </div>
+ {/if}
+ </div>
+
+ <div class="space-y-0.5">
+ {#if loading}
+ <div class="bg-muted h-3 w-12 animate-pulse rounded"></div>
+ <div class="bg-muted h-4 w-16 animate-pulse rounded"></div>
+ {:else}
+ <div class="text-muted-foreground text-[10px] font-medium tracking-wide uppercase">
+ {m.dashboard_meter_disk_free()}
+ </div>
+ <div class="text-foreground text-sm font-semibold">
+ {formatBytes(diskFree)}
+ </div>
+ {/if}
+ </div>
</div>
</div>
- </div>
- </div>
-</div>
+ </Card.Content>
+ {/snippet}
+</Card.Root>
diff --git a/frontend/src/lib/components/docker-overview.svelte b/frontend/src/lib/components/docker-overview.svelte
index d97f9a636..ec82cd6cc 100644
--- a/frontend/src/lib/components/docker-overview.svelte
+++ b/frontend/src/lib/components/docker-overview.svelte
@@ -1,4 +1,5 @@
<script lang="ts">
+ import * as Card from '$lib/components/ui/card';
import { Badge } from '$lib/components/ui/badge';
import { Button } from '$lib/components/ui/button';
import { Skeleton } from '$lib/components/ui/skeleton';
@@ -32,65 +33,55 @@
let dockerInfoDialogOpen = $state(false);
</script>
-<div
- class="bg-card/80 supports-[backdrop-filter]:bg-card/60 ring-border/40 group relative isolate flex overflow-hidden rounded-xl border shadow-sm ring-1 ring-inset backdrop-blur-sm transition-all duration-300 hover:shadow-md dark:shadow-none {className}"
->
- <div
- class="flex flex-1 items-center gap-4 bg-gradient-to-br from-gray-50 to-slate-50/30 p-4 dark:from-gray-900/20 dark:to-slate-900/10"
- >
- <div
- class="from-primary to-primary/80 shadow-primary/25 flex size-10 shrink-0 items-center justify-center rounded-full bg-gradient-to-br shadow-lg"
- >
- {#if loading}
- <LoaderCircleIcon class="size-5 animate-spin text-white" />
- {:else}
- <DockerIcon class="size-5 text-white" />
- {/if}
- </div>
+<Card.Root class={className}>
+ {#snippet children()}
+ <Card.Header icon={loading ? LoaderCircleIcon : DockerIcon} iconVariant="primary" class="items-center">
+ {#snippet children()}
+ {#if loading}
+ <div class="flex flex-1 flex-col gap-2">
+ <Skeleton class="h-4 w-32" />
+ <Skeleton class="h-3 w-48" />
+ </div>
+ {:else}
+ <div class="flex flex-1 flex-col gap-1.5">
+ <div class="flex items-center gap-2">
+ <span class="text-foreground text-sm font-semibold">{m.docker_engine_title()}</span>
+ <Badge variant="outline" class="text-xs">{dockerInfo?.version ?? '-'}</Badge>
+ </div>
+ <div class="text-muted-foreground flex flex-wrap items-center gap-3 text-xs">
+ <span class="flex items-center gap-1.5">
+ <BoxIcon class="size-3" />
+ <span class="font-medium text-emerald-600">{containersRunning}</span>
+ <span class="text-muted-foreground/70">/</span>
+ <span>{totalContainers}</span>
+ </span>
+ <span class="text-muted-foreground/50">•</span>
+ <span class="flex items-center gap-1.5">
+ <HardDriveIcon class="size-3" />
+ <span>{totalImages}</span>
+ <span class="text-muted-foreground/70">{m.images_title().toLowerCase()}</span>
+ </span>
+ <span class="text-muted-foreground/50">•</span>
+ <span class="font-mono">
+ {dockerInfo?.os ?? '-'} / {dockerInfo?.architecture ?? '-'}
+ </span>
+ </div>
+ </div>
- {#if loading}
- <div class="flex flex-1 flex-col gap-2">
- <Skeleton class="h-4 w-32" />
- <Skeleton class="h-3 w-48" />
- </div>
- {:else}
- <div class="flex flex-1 flex-col gap-1.5">
- <div class="flex items-center gap-2">
- <span class="text-foreground text-sm font-semibold">{m.docker_engine_title()}</span>
- <Badge variant="outline" class="text-xs">{dockerInfo?.version ?? '-'}</Badge>
- </div>
- <div class="text-muted-foreground flex flex-wrap items-center gap-3 text-xs">
- <span class="flex items-center gap-1.5">
- <BoxIcon class="size-3" />
- <span class="font-medium text-emerald-600">{containersRunning}</span>
- <span class="text-muted-foreground/70">/</span>
- <span>{totalContainers}</span>
- </span>
- <span class="text-muted-foreground/50">•</span>
- <span class="flex items-center gap-1.5">
- <HardDriveIcon class="size-3" />
- <span>{totalImages}</span>
- <span class="text-muted-foreground/70">{m.images_title().toLowerCase()}</span>
- </span>
- <span class="text-muted-foreground/50">•</span>
- <span class="font-mono">
- {dockerInfo?.os ?? '-'} / {dockerInfo?.architecture ?? '-'}
- </span>
- </div>
- </div>
- {/if}
-
- {#if !loading && dockerInfo}
- <Button
- variant="ghost"
- size="icon"
- class="text-muted-foreground hover:text-foreground size-8 shrink-0"
- onclick={() => (dockerInfoDialogOpen = true)}
- >
- <InfoIcon class="size-4" />
- </Button>
- {/if}
- </div>
-</div>
+ {#if dockerInfo}
+ <Button
+ variant="ghost"
+ size="icon"
+ class="text-muted-foreground hover:text-foreground size-8 shrink-0"
+ onclick={() => (dockerInfoDialogOpen = true)}
+ >
+ <InfoIcon class="size-4" />
+ </Button>
+ {/if}
+ {/if}
+ {/snippet}
+ </Card.Header>
+ {/snippet}
+</Card.Root>
<DockerInfoDialog bind:open={dockerInfoDialogOpen} {dockerInfo} />
diff --git a/frontend/src/lib/components/dropdown-card.svelte b/frontend/src/lib/components/dropdown-card.svelte
index b5d7e3805..ea6b2a347 100644
--- a/frontend/src/lib/components/dropdown-card.svelte
+++ b/frontend/src/lib/components/dropdown-card.svelte
@@ -49,8 +49,11 @@
});
</script>
-<Card.Root>
- <Card.Header class="cursor-pointer pt-2" onclick={toggleExpanded}>
+<Card.Root class="flex flex-col gap-6 py-3">
+ <Card.Header
+ class="@container/card-header grid cursor-pointer auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 pt-2 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6"
+ onclick={toggleExpanded}
+ >
<div class="flex items-center justify-between">
<div>
<Card.Title class="my-2 flex items-center">
@@ -70,7 +73,7 @@
</Card.Header>
{#if expanded}
<div transition:slide={{ duration: 200 }}>
- <Card.Content class="bg-muted/20 pt-5">
+ <Card.Content class="bg-muted/20 px-6 pt-5">
{@render children()}
</Card.Content>
</div>
diff --git a/frontend/src/lib/components/gradient-frame-card.svelte b/frontend/src/lib/components/gradient-frame-card.svelte
index fdb6aa3c6..2aff1ba2a 100644
--- a/frontend/src/lib/components/gradient-frame-card.svelte
+++ b/frontend/src/lib/components/gradient-frame-card.svelte
@@ -46,7 +46,7 @@
</script>
<Card.Root
- class={`bg-card/80 ring-border/40 supports-[backdrop-filter]:bg-card/60 group relative overflow-hidden rounded-xl border shadow-sm ring-1 backdrop-blur ring-inset
+ class={`bg-card/80 ring-border/40 supports-[backdrop-filter]:bg-card/60 group relative flex flex-col gap-6 overflow-hidden rounded-xl border py-3 shadow-sm ring-1 backdrop-blur ring-inset
before:pointer-events-none before:absolute before:inset-0 before:rounded-[inherit] before:[mask-composite:exclude] before:p-[1px]
before:content-['']
before:[-webkit-mask-composite:xor]
@@ -54,7 +54,7 @@
before:[mask:linear-gradient(#000_0_0)_content-box,linear-gradient(#000_0_0)]
${frameGradientClass} ${className ?? ''}`}
>
- <Card.Content class="p-4">
+ <Card.Content class="p-4 px-6">
<svelte:fragment>
{@const IconComponent = icon}
<div class="flex items-start gap-3">
diff --git a/frontend/src/lib/components/logs/log-controls.svelte b/frontend/src/lib/components/logs/log-controls.svelte
new file mode 100644
index 000000000..4deea06a1
--- /dev/null
+++ b/frontend/src/lib/components/logs/log-controls.svelte
@@ -0,0 +1,48 @@
+<script lang="ts">
+ import { Button } from '$lib/components/ui/button/index.js';
+ import RefreshCwIcon from '@lucide/svelte/icons/refresh-cw';
+ import { m } from '$lib/paraglide/messages';
+
+ let {
+ autoScroll = $bindable(),
+ isStreaming = false,
+ disabled = false,
+ onStart,
+ onStop,
+ onClear,
+ onRefresh
+ }: {
+ autoScroll: boolean;
+ isStreaming?: boolean;
+ disabled?: boolean;
+ onStart?: () => void;
+ onStop?: () => void;
+ onClear?: () => void;
+ onRefresh?: () => void;
+ } = $props();
+</script>
+
+<div class="flex flex-col gap-3 sm:flex-row sm:items-center">
+ <label class="flex items-center gap-2">
+ <input type="checkbox" bind:checked={autoScroll} class="size-4" />
+ <span class="text-sm font-medium">{m.common_autoscroll()}</span>
+ </label>
+
+ <div class="flex items-center gap-2">
+ <Button variant="outline" size="sm" class="text-xs font-medium" onclick={onClear}>
+ {m.common_clear()}
+ </Button>
+ {#if isStreaming}
+ <Button variant="outline" size="sm" class="text-xs font-medium" onclick={onStop}>
+ {m.common_stop()}
+ </Button>
+ {:else}
+ <Button variant="outline" size="sm" class="text-xs font-medium" onclick={onStart} {disabled}>
+ {m.common_start()}
+ </Button>
+ {/if}
+ <Button variant="outline" size="sm" class="px-2" onclick={onRefresh} aria-label="Refresh logs" title="Refresh">
+ <RefreshCwIcon class="size-4" />
+ </Button>
+ </div>
+</div>
diff --git a/frontend/src/lib/components/log-viewer.svelte b/frontend/src/lib/components/logs/log-viewer.svelte
similarity index 97%
rename from frontend/src/lib/components/log-viewer.svelte
rename to frontend/src/lib/components/logs/log-viewer.svelte
index 16e51f1d7..a2b0ac0a9 100644
--- a/frontend/src/lib/components/log-viewer.svelte
+++ b/frontend/src/lib/components/logs/log-viewer.svelte
@@ -226,7 +226,7 @@
});
}
- export function stopLogStream() {
+ export function stopLogStream(notifyCallback = true) {
shouldBeStreaming = false;
if (eventSource) {
@@ -241,7 +241,9 @@
wsClient = null;
}
isStreaming = false;
- onStop?.();
+ if (notifyCallback) {
+ onStop?.();
+ }
}
function addLogEntry(logData: { level: string; message: string; timestamp?: string; service?: string; containerId?: string }) {
@@ -258,7 +260,7 @@
}
onDestroy(() => {
- stopLogStream();
+ stopLogStream(false);
});
export function toggleAutoScroll() {
@@ -296,7 +298,7 @@
const key = streamKey();
if (!key) return;
if (key === currentStreamKey && isStreaming) return;
- if (currentStreamKey) stopLogStream();
+ if (currentStreamKey) stopLogStream(false); // Don't notify callback on internal stop
logs = [];
currentStreamKey = key;
startLogStream();
diff --git a/frontend/src/lib/components/meter-metric.svelte b/frontend/src/lib/components/meter-metric.svelte
index 17c95a171..193ee7261 100644
--- a/frontend/src/lib/components/meter-metric.svelte
+++ b/frontend/src/lib/components/meter-metric.svelte
@@ -1,4 +1,5 @@
<script lang="ts">
+ import * as Card from '$lib/components/ui/card';
import { Progress } from '$lib/components/ui/progress/index.js';
import type { Icon as IconType } from '@lucide/svelte';
import LoaderCircleIcon from '@lucide/svelte/icons/loader-circle';
@@ -34,70 +35,57 @@
const Icon = icon;
</script>
-<div
- class="bg-card/80 supports-[backdrop-filter]:bg-card/60 ring-border/40 group relative
- isolate flex flex-col
- overflow-hidden rounded-xl border
- shadow-sm ring-1 ring-inset backdrop-blur-sm transition-all
- duration-300 hover:shadow-md dark:shadow-none"
->
- <div class="flex-none bg-gradient-to-br from-gray-50 to-slate-50/30 p-3 dark:from-gray-900/20 dark:to-slate-900/10">
- <div class="flex items-center gap-2.5">
- <div
- class="from-primary to-primary/80 shadow-primary/25 flex size-8 shrink-0 items-center justify-center rounded-full bg-gradient-to-br shadow-lg"
- >
- {#if loading}
- <LoaderCircleIcon class="size-4 animate-spin text-white" />
- {:else}
- <Icon class="size-4 text-white" />
- {/if}
- </div>
- <div class="min-w-0 flex-1">
- <div class="text-foreground text-sm font-semibold">{title}</div>
- {#if description}
- <div class="text-muted-foreground text-xs">{description}</div>
- {/if}
- </div>
- </div>
- </div>
-
- <div class="flex flex-col justify-center p-3">
- <div class="w-full space-y-2">
- <div class="text-center">
- {#if loading}
- <div class="bg-muted mx-auto h-7 w-14 animate-pulse rounded"></div>
- {:else}
- <div class="text-foreground text-lg font-bold">
- {currentValue !== undefined ? formatValue(currentValue) : m.common_na()}
- </div>
- {/if}
- </div>
+<Card.Root>
+ {#snippet children()}
+ <Card.Header icon={loading ? LoaderCircleIcon : icon} iconVariant="primary" compact>
+ {#snippet children()}
+ <div class="min-w-0 flex-1">
+ <div class="text-foreground text-sm font-semibold">{title}</div>
+ {#if description}
+ <div class="text-muted-foreground text-xs">{description}</div>
+ {/if}
+ </div>
+ {/snippet}
+ </Card.Header>
- <div class="space-y-1.5">
- {#if loading}
- <div class="bg-muted h-1.5 w-full animate-pulse rounded"></div>
- {:else}
- <Progress value={percentage} max={100} class="h-1.5" />
- {/if}
+ <Card.Content class="flex flex-col justify-center p-3">
+ <div class="w-full space-y-2">
+ <div class="text-center">
+ {#if loading}
+ <div class="bg-muted mx-auto h-7 w-14 animate-pulse rounded"></div>
+ {:else}
+ <div class="text-foreground text-lg font-bold">
+ {currentValue !== undefined ? formatValue(currentValue) : m.common_na()}
+ </div>
+ {/if}
+ </div>
- <div class="flex items-center justify-between text-xs">
+ <div class="space-y-1.5">
{#if loading}
- <div class="bg-muted h-3 w-12 animate-pulse rounded"></div>
- {#if showAbsoluteValues}
- <div class="bg-muted h-3 w-20 animate-pulse rounded"></div>
- {/if}
+ <div class="bg-muted h-1.5 w-full animate-pulse rounded"></div>
{:else}
- <span class="text-muted-foreground font-medium">
- {percentage.toFixed(1)}%
- </span>
- {#if showAbsoluteValues && currentValue !== undefined && maxValue !== undefined}
- <span class="text-muted-foreground/70 font-mono text-[10px]">
- {formatAbsoluteValue(currentValue)} / {formatAbsoluteValue(maxValue)}
+ <Progress value={percentage} max={100} class="h-1.5" />
+ {/if}
+
+ <div class="flex items-center justify-between text-xs">
+ {#if loading}
+ <div class="bg-muted h-3 w-12 animate-pulse rounded"></div>
+ {#if showAbsoluteValues}
+ <div class="bg-muted h-3 w-20 animate-pulse rounded"></div>
+ {/if}
+ {:else}
+ <span class="text-muted-foreground font-medium">
+ {percentage.toFixed(1)}%
</span>
+ {#if showAbsoluteValues && currentValue !== undefined && maxValue !== undefined}
+ <span class="text-muted-foreground/70 font-mono text-[10px]">
+ {formatAbsoluteValue(currentValue)} / {formatAbsoluteValue(maxValue)}
+ </span>
+ {/if}
{/if}
- {/if}
+ </div>
</div>
</div>
- </div>
- </div>
-</div>
+ </Card.Content>
+ {/snippet}
+</Card.Root>
diff --git a/frontend/src/lib/components/sheets/image-pull-sheet.svelte b/frontend/src/lib/components/sheets/image-pull-sheet.svelte
index 282b1d510..6ae0f0cb9 100644
--- a/frontend/src/lib/components/sheets/image-pull-sheet.svelte
+++ b/frontend/src/lib/components/sheets/image-pull-sheet.svelte
@@ -82,10 +82,12 @@
let imageTag = data.tag?.trim() || 'latest';
if (imageName.includes(':')) {
- const parts = imageName.split(':');
- imageName = parts[0];
- if (parts.length > 1 && parts[1].trim() !== '') {
- imageTag = parts[1].trim();
+ const lastColonIndex = imageName.lastIndexOf(':');
+ const possibleTag = imageName.substring(lastColonIndex + 1).trim();
+ // Only split if the part after the last colon looks like a tag (not a port number in a registry URL)
+ if (possibleTag && !possibleTag.includes('/')) {
+ imageName = imageName.substring(0, lastColonIndex);
+ imageTag = possibleTag;
}
}
diff --git a/frontend/src/lib/components/sheets/new-environment-sheet.svelte b/frontend/src/lib/components/sheets/new-environment-sheet.svelte
index 554049cb8..cb1fd98b8 100644
--- a/frontend/src/lib/components/sheets/new-environment-sheet.svelte
+++ b/frontend/src/lib/components/sheets/new-environment-sheet.svelte
@@ -90,11 +90,13 @@
</Sheet.Header>
<div class="space-y-6 py-6">
- <Card.Root>
- <Card.Header>
+ <Card.Root class="flex flex-col gap-6 py-3">
+ <Card.Header
+ class="@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6"
+ >
<Card.Title class="text-lg">{m.environments_add_button()}</Card.Title>
</Card.Header>
- <Card.Content>
+ <Card.Content class="px-6">
<form onsubmit={preventDefault(handleSubmit)} class="space-y-4">
<FormInput label={m.common_name()} placeholder={m.environments_name_placeholder()} bind:input={$inputs.name} />
diff --git a/frontend/src/lib/components/stat-card.svelte b/frontend/src/lib/components/stat-card.svelte
index 043b9fa0f..480a2435c 100644
--- a/frontend/src/lib/components/stat-card.svelte
+++ b/frontend/src/lib/components/stat-card.svelte
@@ -24,8 +24,8 @@
}: Props = $props();
</script>
-<Card.Root class={cn('', className)}>
- <Card.Content class="flex items-center justify-between">
+<Card.Root class={cn('flex flex-col gap-6 py-3', className)}>
+ <Card.Content class="flex items-center justify-between px-6">
<div>
<p class="text-muted-foreground text-sm font-medium">{title}</p>
<p class="text-2xl font-bold">{value}</p>
diff --git a/frontend/src/lib/components/terminal/terminal-controls.svelte b/frontend/src/lib/components/terminal/terminal-controls.svelte
new file mode 100644
index 000000000..2934736ef
--- /dev/null
+++ b/frontend/src/lib/components/terminal/terminal-controls.svelte
@@ -0,0 +1,91 @@
+<script lang="ts">
+ import * as Select from '$lib/components/ui/select/index.js';
+ import { Button } from '$lib/components/ui/button/index.js';
+ import { Input } from '$lib/components/ui/input/index.js';
+ import RefreshCwIcon from '@lucide/svelte/icons/refresh-cw';
+ import { m } from '$lib/paraglide/messages';
+
+ let {
+ selectedShell = $bindable(),
+ onShellChange,
+ onReconnect
+ }: {
+ selectedShell: string;
+ onShellChange?: (shell: string) => void;
+ onReconnect?: () => void;
+ } = $props();
+
+ let customShell = $state('');
+ let useCustomShell = $state(false);
+
+ const commonShells = [
+ { value: '/bin/sh', label: 'sh' },
+ { value: '/bin/bash', label: 'bash' },
+ { value: '/bin/ash', label: 'ash' },
+ { value: '/bin/zsh', label: 'zsh' },
+ { value: 'custom', label: m.custom() }
+ ];
+
+ const shellLabels: Record<string, string> = {
+ '/bin/sh': 'sh',
+ '/bin/bash': 'bash',
+ '/bin/ash': 'ash',
+ '/bin/zsh': 'zsh',
+ custom: m.custom()
+ };
+
+ function handleShellChange(value: string | undefined) {
+ if (!value) return;
+
+ if (value === 'custom') {
+ useCustomShell = true;
+ selectedShell = value;
+ } else {
+ useCustomShell = false;
+ selectedShell = value;
+ onShellChange?.(value);
+ }
+ }
+
+ function handleCustomShellSubmit() {
+ if (customShell.trim()) {
+ onShellChange?.(customShell);
+ }
+ }
+</script>
+
+<div class="flex items-center gap-2">
+ <Select.Root bind:value={selectedShell} type="single" onValueChange={handleShellChange}>
+ <Select.Trigger class="h-8 w-[140px]">
+ {shellLabels[selectedShell] ?? m.shell_select_placeholder()}
+ </Select.Trigger>
+ <Select.Content>
+ {#each commonShells as shell}
+ <Select.Item value={shell.value}>
+ {shell.label}
+ </Select.Item>
+ {/each}
+ </Select.Content>
+ </Select.Root>
+
+ {#if useCustomShell}
+ <Input
+ type="text"
+ bind:value={customShell}
+ placeholder={m.shell_custom_placeholder()}
+ class="h-8 w-[180px]"
+ onkeydown={(e) => {
+ if (e.key === 'Enter') {
+ handleCustomShellSubmit();
+ }
+ }}
+ />
+ <Button size="sm" variant="outline" onclick={handleCustomShellSubmit} class="h-8">
+ {m.apply()}
+ </Button>
+ {/if}
+
+ <Button size="icon" variant="ghost" onclick={onReconnect} class="size-8" title="Reconnect shell">
+ <RefreshCwIcon class="size-4" />
+ </Button>
+</div>
diff --git a/frontend/src/lib/components/terminal/terminal-header.svelte b/frontend/src/lib/components/terminal/terminal-header.svelte
deleted file mode 100644
index f274448b0..000000000
--- a/frontend/src/lib/components/terminal/terminal-header.svelte
+++ /dev/null
@@ -1,108 +0,0 @@
-<script lang="ts">
- import * as Select from '$lib/components/ui/select/index.js';
- import { Button } from '$lib/components/ui/button/index.js';
- import { Input } from '$lib/components/ui/input/index.js';
- import TerminalIcon from '@lucide/svelte/icons/terminal';
- import RefreshCwIcon from '@lucide/svelte/icons/refresh-cw';
- import { m } from '$lib/paraglide/messages';
-
- let {
- isConnected = false,
- selectedShell = $bindable(),
- onShellChange,
- onReconnect
- }: {
- isConnected?: boolean;
- selectedShell: string;
- onShellChange?: (shell: string) => void;
- onReconnect?: () => void;
- } = $props();
-
- let customShell = $state('');
- let useCustomShell = $state(false);
-
- const commonShells = [
- { value: '/bin/sh', label: 'sh' },
- { value: '/bin/bash', label: 'bash' },
- { value: '/bin/ash', label: 'ash' },
- { value: '/bin/zsh', label: 'zsh' },
- { value: 'custom', label: m.custom() }
- ];
-
- const shellLabels: Record<string, string> = {
- '/bin/sh': 'sh',
- '/bin/bash': 'bash',
- '/bin/ash': 'ash',
- '/bin/zsh': 'zsh',
- custom: m.custom()
- };
-
- function handleShellChange(value: string | undefined) {
- if (!value) return;
-
- if (value === 'custom') {
- useCustomShell = true;
- selectedShell = value;
- } else {
- useCustomShell = false;
- selectedShell = value;
- onShellChange?.(value);
- }
- }
-
- function handleCustomShellSubmit() {
- if (customShell.trim()) {
- onShellChange?.(customShell);
- }
- }
-</script>
-
-<div class="flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between">
- <div class="flex items-center gap-2">
- <TerminalIcon class="text-primary size-5" />
- <h2 class="text-lg font-semibold">{m.shell_title()}</h2>
- {#if isConnected}
- <div class="flex items-center gap-2">
- <div class="size-2 animate-pulse rounded-full bg-green-500"></div>
- <span class="text-xs font-semibold text-green-600 sm:text-sm">{m.common_live()}</span>
- </div>
- {/if}
- </div>
-
- <div class="flex items-center gap-2">
- <Select.Root bind:value={selectedShell} type="single" onValueChange={handleShellChange}>
- <Select.Trigger class="h-8 w-[140px]">
- {shellLabels[selectedShell] ?? m.shell_select_placeholder()}
- </Select.Trigger>
- <Select.Content>
- {#each commonShells as shell}
- <Select.Item value={shell.value}>
- {shell.label}
- </Select.Item>
- {/each}
- </Select.Content>
- </Select.Root>
-
- {#if useCustomShell}
- <Input
- type="text"
- bind:value={customShell}
- placeholder={m.shell_custom_placeholder()}
- class="h-8 w-[180px]"
- onkeydown={(e) => {
- if (e.key === 'Enter') {
- handleCustomShellSubmit();
- }
- }}
- />
- <Button size="sm" variant="outline" onclick={handleCustomShellSubmit} class="h-8">
- {m.apply()}
- </Button>
- {/if}
-
- <!-- Reconnect Button -->
- <Button size="icon" variant="ghost" onclick={onReconnect} class="size-8" title="Reconnect shell">
- <RefreshCwIcon class="size-4" />
- </Button>
- </div>
-</div>
diff --git a/frontend/src/lib/components/ui/card/card-header.svelte b/frontend/src/lib/components/ui/card/card-header.svelte
index 9cdc602ba..08afc9292 100644
--- a/frontend/src/lib/components/ui/card/card-header.svelte
+++ b/frontend/src/lib/components/ui/card/card-header.svelte
@@ -5,9 +5,33 @@
let {
ref = $bindable(null),
class: className,
+ icon,
+ iconVariant = 'primary',
+ compact = false,
+ enableHover = false,
children,
...restProps
- }: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
+ }: WithElementRef<
+ HTMLAttributes<HTMLDivElement> & {
+ icon?: any;
+ iconVariant?: 'primary' | 'emerald' | 'red' | 'amber' | 'blue' | 'purple' | 'cyan' | 'orange' | 'indigo' | 'pink';
+ compact?: boolean;
+ enableHover?: boolean;
+ }
+ > = $props();
+
+ const iconVariantClasses = {
+ primary: 'from-primary to-primary/80 shadow-primary/25',
+ emerald: 'from-emerald-500 to-emerald-600 shadow-emerald-500/25',
+ red: 'from-red-500 to-red-600 shadow-red-500/25',
+ amber: 'from-amber-500 to-amber-600 shadow-amber-500/25',
+ blue: 'from-blue-500 to-blue-600 shadow-blue-500/25',
+ purple: 'from-purple-500 to-purple-600 shadow-purple-500/25',
+ cyan: 'from-cyan-500 to-cyan-600 shadow-cyan-500/25',
+ orange: 'from-orange-500 to-orange-600 shadow-orange-500/25',
+ indigo: 'from-indigo-500 to-indigo-600 shadow-indigo-500/25',
+ pink: 'from-pink-500 to-pink-600 shadow-pink-500/25'
+ };
</script>
<div
@@ -15,9 +39,28 @@
data-slot="card-header"
class={cn(
'@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6',
+ icon
+ ? 'flex flex-row items-start space-y-0 bg-gradient-to-br from-gray-50 to-slate-50/30 dark:from-gray-900/20 dark:to-slate-900/10'
+ : '',
+ icon && compact ? 'gap-2 p-2' : icon ? 'gap-3 p-3.5' : '',
+ icon && enableHover
+ ? 'transition-colors group-[&:not(:has(button:hover,a:hover,[role=button]:hover))]:hover:from-gray-100 group-[&:not(:has(button:hover,a:hover,[role=button]:hover))]:hover:to-slate-100/50 dark:group-[&:not(:has(button:hover,a:hover,[role=button]:hover))]:hover:from-gray-800/40 dark:group-[&:not(:has(button:hover,a:hover,[role=button]:hover))]:hover:to-slate-800/30'
+ : '',
className
)}
{...restProps}
>
+ {#if icon}
+ {@const IconComponent = icon}
+ <div
+ class={cn(
+ 'flex shrink-0 items-center justify-center rounded-full bg-gradient-to-br shadow-lg transition-transform group-[&:not(:has(button:hover,a:hover,[role=button]:hover))]:hover:scale-105',
+ iconVariantClasses[iconVariant],
+ compact ? 'size-8 sm:size-10' : 'size-10'
+ )}
+ >
+ <IconComponent class={cn('text-white', compact ? 'size-4 sm:size-5' : 'size-5')} />
+ </div>
+ {/if}
{@render children?.()}
</div>
diff --git a/frontend/src/lib/components/ui/card/card.svelte b/frontend/src/lib/components/ui/card/card.svelte
index 45a53f9ba..b72ea0a45 100644
--- a/frontend/src/lib/components/ui/card/card.svelte
+++ b/frontend/src/lib/components/ui/card/card.svelte
@@ -5,15 +5,50 @@
let {
ref = $bindable(null),
class: className,
+ variant = 'default',
+ onclick,
children,
...restProps
- }: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
+ }: WithElementRef<
+ HTMLAttributes<HTMLDivElement> & { variant?: 'default' | 'subtle' | 'outlined'; onclick?: (e: MouseEvent) => void }
+ > = $props();
+
+ function handleClick(e: MouseEvent) {
+ if (onclick) {
+ // Check if the clicked element is interactive (button, link, or has onclick)
+ const target = e.target as HTMLElement;
+ const isInteractive = target.closest('button, a, [onclick], [role="button"]');
+
+ if (!isInteractive) {
+ onclick(e);
+ }
+ }
+ }
+
+ function getVariantClasses(variant: 'default' | 'subtle' | 'outlined') {
+ switch (variant) {
+ case 'default':
+ return 'bg-card/80 supports-[backdrop-filter]:bg-card/60 ring-border/40 shadow-sm backdrop-blur-sm dark:shadow-none';
+ case 'subtle':
+ return 'bg-muted/30 border-transparent';
+ case 'outlined':
+ return 'bg-card/80 supports-[backdrop-filter]:bg-card/60 border-border/50';
+ }
+ }
</script>
<div
bind:this={ref}
data-slot="card"
- class={cn('bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-3 shadow-sm', className)}
+ class={cn(
+ 'text-card-foreground group relative isolate gap-0 overflow-hidden rounded-xl border p-0 transition-all duration-300',
+ getVariantClasses(variant),
+ onclick
+ ? '[&:not(:has(button:hover,a:hover,[role=button]:hover))]:hover:bg-muted/50 cursor-pointer [&:not(:has(button:hover,a:hover,[role=button]:hover))]:hover:shadow-md'
+ : '',
+ className
+ )}
+ onclick={onclick ? handleClick : undefined}
{...restProps}
>
{@render children?.()}
diff --git a/frontend/src/lib/layouts/resource-page-layout.svelte b/frontend/src/lib/layouts/resource-page-layout.svelte
index b82865fcc..f9eecb207 100644
--- a/frontend/src/lib/layouts/resource-page-layout.svelte
+++ b/frontend/src/lib/layouts/resource-page-layout.svelte
@@ -62,19 +62,19 @@
case 1:
return 'grid-cols-1';
case 2:
- return 'grid-cols-1 sm:grid-cols-2';
+ return 'grid-cols-2 sm:grid-cols-2';
case 3:
- return 'grid-cols-1 sm:grid-cols-3';
+ return 'grid-cols-2 sm:grid-cols-3';
case 4:
- return 'grid-cols-1 sm:grid-cols-2 lg:grid-cols-4';
+ return 'grid-cols-2 sm:grid-cols-2 lg:grid-cols-4';
case 5:
- return 'grid-cols-1 sm:grid-cols-2 lg:grid-cols-5';
+ return 'grid-cols-2 sm:grid-cols-3 lg:grid-cols-5';
case 'auto':
default:
- if (statCards.length <= 2) return 'grid-cols-1 sm:grid-cols-2';
- if (statCards.length === 3) return 'grid-cols-1 sm:grid-cols-3';
- if (statCards.length === 4) return 'grid-cols-1 sm:grid-cols-2 lg:grid-cols-4';
- return 'grid-cols-1 sm:grid-cols-2 lg:grid-cols-5';
+ if (statCards.length <= 2) return 'grid-cols-2 sm:grid-cols-2';
+ if (statCards.length === 3) return 'grid-cols-2 sm:grid-cols-3';
+ if (statCards.length === 4) return 'grid-cols-2 sm:grid-cols-2 lg:grid-cols-4';
+ return 'grid-cols-2 sm:grid-cols-3 lg:grid-cols-5';
}
};
</script>
diff --git a/frontend/src/lib/utils/table-persistence.util.ts b/frontend/src/lib/utils/table-persistence.util.ts
new file mode 100644
index 000000000..46bba4acd
--- /dev/null
+++ b/frontend/src/lib/utils/table-persistence.util.ts
@@ -0,0 +1,110 @@
+import { browser } from '$app/environment';
+import { PersistedState } from 'runed';
+import type { CompactTablePrefs } from '$lib/components/arcane-table/arcane-table.types.svelte';
+import type { FilterMap, FilterValue, SearchPaginationSortRequest } from '$lib/types/pagination.type';
+
+const DEFAULT_LIMIT = 20;
+
+function cloneRequest(options: SearchPaginationSortRequest): SearchPaginationSortRequest {
+ return {
+ search: options.search,
+ filters: options.filters ? { ...options.filters } : undefined,
+ pagination: options.pagination ? { ...options.pagination } : undefined,
+ sort: options.sort ? { ...options.sort } : undefined
+ };
+}
+
+function buildFilterMap(pairs?: [string, unknown][]): FilterMap {
+ const filters: FilterMap = {};
+ if (!pairs?.length) return filters;
+
+ for (const [id, rawValue] of pairs) {
+ let value: unknown = rawValue;
+ if (value instanceof Set) {
+ const iterator = value.values().next();
+ value = iterator.value;
+ }
+
+ if (Array.isArray(value)) {
+ const first = value.find((entry) => entry !== undefined && entry !== null && `${entry}`.trim() !== '');
+ if (first === undefined) continue;
+ value = first;
+ }
+
+ if (value === undefined || value === null) continue;
+ if (typeof value === 'string') {
+ const trimmed = value.trim();
+ if (!trimmed) continue;
+ filters[id] = trimmed;
+ continue;
+ }
+
+ filters[id] = value as FilterValue;
+ }
+
+ return filters;
+}
+
+function normalizeLimit(limit: unknown): number | undefined {
+ if (typeof limit === 'number' && Number.isFinite(limit) && limit > 0) return limit;
+ if (typeof limit === 'string') {
+ const parsed = Number.parseInt(limit, 10);
+ if (Number.isFinite(parsed) && parsed > 0) return parsed;
+ }
+ return undefined;
+}
+
+function normalizeSearch(value: unknown): string | undefined {
+ if (typeof value !== 'string') return undefined;
+ const trimmed = value.trim();
+ return trimmed.length > 0 ? trimmed : undefined;
+}
+
+export function resolveInitialTableRequest(
+ persistKey: string,
+ defaults: SearchPaginationSortRequest
+): SearchPaginationSortRequest {
+ const base = cloneRequest(defaults);
+ const fallbackLimit = base.pagination?.limit ?? DEFAULT_LIMIT;
+
+ if (!base.pagination) {
+ base.pagination = { page: 1, limit: fallbackLimit };
+ } else {
+ base.pagination = {
+ page: base.pagination.page ?? 1,
+ limit: base.pagination.limit ?? fallbackLimit
+ };
+ }
+
+ if (!browser) return base;
+
+ try {
+ const persisted = new PersistedState<CompactTablePrefs>(
+ persistKey,
+ { v: [], f: [], g: '', l: fallbackLimit },
+ { syncTabs: false }
+ );
+ const current = persisted.current ?? {};
+
+ const filters = buildFilterMap(current.f);
+ if (Object.keys(filters).length > 0) {
+ base.filters = filters;
+ base.pagination = { ...base.pagination!, page: 1 };
+ }
+
+ const search = normalizeSearch(current.g);
+ if (search !== undefined) {
+ base.search = search;
+ base.pagination = { ...base.pagination!, page: 1 };
+ }
+
+ const limit = normalizeLimit(current.l);
+ if (limit !== undefined && base.pagination?.limit !== limit) {
+ base.pagination = { page: 1, limit };
+ }
+ } catch (error) {
+ return base;
+ }
+
+ return base;
+}
diff --git a/frontend/src/routes/auth/login/+page.svelte b/frontend/src/routes/auth/login/+page.svelte
index 9d2c1b711..9134ad6cc 100644
--- a/frontend/src/routes/auth/login/+page.svelte
+++ b/frontend/src/routes/auth/login/+page.svelte
@@ -66,8 +66,8 @@
<div class="bg-muted flex min-h-screen flex-col items-center justify-center p-6 md:p-10">
<div class="w-full max-w-sm md:max-w-3xl">
<div class="flex flex-col gap-6">
- <Card.Root class="overflow-hidden p-0">
- <Card.Content class="grid p-0 md:grid-cols-2">
+ <Card.Root class="flex flex-col gap-6 overflow-hidden p-0 py-3">
+ <Card.Content class="grid p-0 px-6 md:grid-cols-2">
<div class={showOidcLoginButton && !showLocalLoginForm ? 'flex items-center justify-center p-6 md:p-8' : 'p-6 md:p-8'}>
<div class="flex flex-col gap-6">
<div class="flex flex-col items-center text-center">
@@ -210,8 +210,8 @@
</div>
</div>
-<div class="fixed bottom-0 left-0 right-0 p-4">
- <div class="text-muted-foreground text-balance text-center text-xs">
+<div class="fixed right-0 bottom-0 left-0 p-4">
+ <div class="text-muted-foreground text-center text-xs text-balance">
<div class="flex items-center justify-center gap-4">
<a
href="https://github.com/ofkm/arcane"
diff --git a/frontend/src/routes/containers/+page.ts b/frontend/src/routes/containers/+page.ts
index 5811daf70..ec2bf6951 100644
--- a/frontend/src/routes/containers/+page.ts
+++ b/frontend/src/routes/containers/+page.ts
@@ -1,13 +1,14 @@
import type { SearchPaginationSortRequest } from '$lib/types/pagination.type';
import { containerService } from '$lib/services/container-service';
+import { resolveInitialTableRequest } from '$lib/utils/table-persistence.util';
import type { PageLoad } from './$types';
import { settingsService } from '$lib/services/settings-service';
export const load: PageLoad = async () => {
- const containerRequestOptions: SearchPaginationSortRequest = {
+ const containerRequestOptions = resolveInitialTableRequest('arcane-container-table', {
pagination: { page: 1, limit: 20 },
- sort: { column: 'created', direction: 'desc' as const }
- };
+ sort: { column: 'created', direction: 'desc' }
+ } satisfies SearchPaginationSortRequest);
const [containers, containerStatusCounts, settings] = await Promise.all([
containerService.getContainers(containerRequestOptions),
diff --git a/frontend/src/routes/containers/[containerId]/+page.svelte b/frontend/src/routes/containers/[containerId]/+page.svelte
index 83b67e368..b0c7b489c 100644
--- a/frontend/src/routes/containers/[containerId]/+page.svelte
+++ b/frontend/src/routes/containers/[containerId]/+page.svelte
@@ -274,7 +274,7 @@
{#snippet tabContent(activeTab)}
<Tabs.Content value="overview" class="h-full">
- <ContainerOverview {container} {primaryIpAddress} />
+ <ContainerOverview {container} {primaryIpAddress} {baseServerUrl} />
</Tabs.Content>
{#if showStats}
@@ -310,7 +310,7 @@
{#if showConfiguration}
<Tabs.Content value="config" class="h-full">
- <ContainerConfiguration {container} {hasEnvVars} {hasPorts} {hasLabels} {baseServerUrl} />
+ <ContainerConfiguration {container} {hasEnvVars} {hasLabels} />
</Tabs.Content>
{/if}
diff --git a/frontend/src/routes/containers/components/ContainerConfiguration.svelte b/frontend/src/routes/containers/components/ContainerConfiguration.svelte
index b3b804274..35fde8120 100644
--- a/frontend/src/routes/containers/components/ContainerConfiguration.svelte
+++ b/frontend/src/routes/containers/components/ContainerConfiguration.svelte
@@ -1,55 +1,62 @@
<script lang="ts">
- import * as Card from '$lib/components/ui/card/index.js';
+ import * as Card from '$lib/components/ui/card';
import SettingsIcon from '@lucide/svelte/icons/settings';
- import NetworkIcon from '@lucide/svelte/icons/network';
import TagIcon from '@lucide/svelte/icons/tag';
- import { PortBadge } from '$lib/components/badges/index.js';
import { m } from '$lib/paraglide/messages';
import type { ContainerDetailsDto } from '$lib/types/container.type';
interface Props {
container: ContainerDetailsDto;
hasEnvVars: boolean;
- hasPorts: boolean;
hasLabels: boolean;
- baseServerUrl: string;
}
- let { container, hasEnvVars, hasPorts, hasLabels, baseServerUrl }: Props = $props();
+ let { container, hasEnvVars, hasLabels }: Props = $props();
</script>
<div class="space-y-6">
{#if hasEnvVars}
- <Card.Root class="pt-0">
- <Card.Header class="bg-muted rounded-t-xl p-4">
- <Card.Title class="flex items-center gap-2 text-lg">
- <SettingsIcon class="text-primary size-5" />
- <h2>
- {m.containers_env_vars_title()}
- </h2>
- </Card.Title>
- <Card.Description>{m.containers_env_vars_description()}</Card.Description>
+ <Card.Root>
+ <Card.Header icon={SettingsIcon}>
+ <div class="flex flex-col space-y-1.5">
+ <Card.Title>
+ <h2>
+ {m.containers_env_vars_title()}
+ </h2>
+ </Card.Title>
+ <Card.Description>{m.containers_env_vars_description()}</Card.Description>
+ </div>
</Card.Header>
<Card.Content class="p-4">
{#if container.config?.env && container.config.env.length > 0}
- <div class="space-y-3">
+ <div class="grid grid-cols-1 gap-3 lg:grid-cols-2 2xl:grid-cols-3">
{#each container.config.env as env, index (index)}
{#if env.includes('=')}
{@const [key, ...valueParts] = env.split('=')}
{@const value = valueParts.join('=')}
- <div class="border-border flex items-start justify-between border-b py-2 last:border-b-0">
- <div class="text-muted-foreground text-sm font-medium break-all">{key}</div>
- <div class="text-foreground ml-4 cursor-pointer font-mono text-sm break-all select-all" title="Click to select">
- {value}
- </div>
- </div>
+ <Card.Root variant="subtle">
+ <Card.Content class="flex flex-col gap-2 p-4">
+ <div class="text-muted-foreground text-xs font-semibold tracking-wide break-all uppercase">{key}</div>
+ <div
+ class="text-foreground cursor-pointer font-mono text-sm font-medium break-all select-all"
+ title="Click to select"
+ >
+ {value}
+ </div>
+ </Card.Content>
+ </Card.Root>
{:else}
- <div class="border-border flex items-start justify-between border-b py-2 last:border-b-0">
- <div class="text-muted-foreground text-sm font-medium">ENV_VAR</div>
- <div class="text-foreground ml-4 cursor-pointer font-mono text-sm break-all select-all" title="Click to select">
- {env}
- </div>
- </div>
+ <Card.Root variant="subtle">
+ <Card.Content class="flex flex-col gap-2 p-4">
+ <div class="text-muted-foreground text-xs font-semibold tracking-wide uppercase">ENV_VAR</div>
+ <div
+ class="text-foreground cursor-pointer font-mono text-sm font-medium break-all select-all"
+ title="Click to select"
+ >
+ {env}
+ </div>
+ </Card.Content>
+ </Card.Root>
{/if}
{/each}
</div>
@@ -62,44 +69,33 @@
</Card.Root>
{/if}
- {#if hasPorts}
- <Card.Root class="pt-0">
- <Card.Header class="bg-muted rounded-t-xl p-4">
- <Card.Title class="flex items-center gap-2 text-lg">
- <NetworkIcon class="text-primary size-5" />
- <h2>
- {m.containers_port_mappings()}
- </h2>
- </Card.Title>
- <Card.Description>{m.containers_port_mappings_description()}</Card.Description>
- </Card.Header>
- <Card.Content class="p-4">
- <PortBadge ports={container.ports ?? []} {baseServerUrl} />
- </Card.Content>
- </Card.Root>
- {/if}
-
{#if hasLabels}
- <Card.Root class="pt-0">
- <Card.Header class="bg-muted rounded-t-xl p-4">
- <Card.Title class="flex items-center gap-2 text-lg">
- <TagIcon class="text-primary size-5" />
- <h2>
- {m.common_labels()}
- </h2>
- </Card.Title>
- <Card.Description>{m.common_labels_description()}</Card.Description>
+ <Card.Root>
+ <Card.Header icon={TagIcon}>
+ <div class="flex flex-col space-y-1.5">
+ <Card.Title>
+ <h2>
+ {m.common_labels()}
+ </h2>
+ </Card.Title>
+ <Card.Description>{m.common_labels_description()}</Card.Description>
+ </div>
</Card.Header>
<Card.Content class="p-4">
{#if container.labels && Object.keys(container.labels).length > 0}
- <div class="space-y-3">
+ <div class="grid grid-cols-1 gap-3 lg:grid-cols-2 2xl:grid-cols-3">
{#each Object.entries(container.labels) as [key, value] (key)}
- <div class="border-border flex items-start justify-between border-b py-2 last:border-b-0">
- <div class="text-muted-foreground text-sm font-medium break-all">{key}</div>
- <div class="text-foreground ml-4 cursor-pointer font-mono text-sm break-all select-all" title="Click to select">
- {value?.toString() || ''}
- </div>
- </div>
+ <Card.Root variant="subtle">
+ <Card.Content class="flex flex-col gap-2 p-4">
+ <div class="text-muted-foreground text-xs font-semibold tracking-wide break-all uppercase">{key}</div>
+ <div
+ class="text-foreground cursor-pointer font-mono text-sm font-medium break-all select-all"
+ title="Click to select"
+ >
+ {value?.toString() || ''}
+ </div>
+ </Card.Content>
+ </Card.Root>
{/each}
</div>
{:else}
diff --git a/frontend/src/routes/containers/components/ContainerLogsPanel.svelte b/frontend/src/routes/containers/components/ContainerLogsPanel.svelte
index 0befa5683..b30dd59d6 100644
--- a/frontend/src/routes/containers/components/ContainerLogsPanel.svelte
+++ b/frontend/src/routes/containers/components/ContainerLogsPanel.svelte
@@ -1,9 +1,8 @@
<script lang="ts">
- import * as Card from '$lib/components/ui/card/index.js';
- import { Button } from '$lib/components/ui/button/index.js';
+ import * as Card from '$lib/components/ui/card';
import FileTextIcon from '@lucide/svelte/icons/file-text';
- import RefreshCwIcon from '@lucide/svelte/icons/refresh-cw';
- import LogViewer from '$lib/components/log-viewer.svelte';
+ import LogViewer from '$lib/components/logs/log-viewer.svelte';
+ import LogControls from '$lib/components/logs/log-controls.svelte';
import { m } from '$lib/paraglide/messages';
let {
@@ -27,80 +26,58 @@
function handleStart() {
isStreaming = true;
+ viewer?.startLogStream();
onStart();
}
function handleStop() {
isStreaming = false;
- onStop();
+ viewer?.stopLogStream();
}
function handleClear() {
+ viewer?.clearLogs();
onClear();
}
- function handleToggleAutoScroll() {
- onToggleAutoScroll();
+ function handleRefresh() {
+ viewer?.stopLogStream();
+ viewer?.startLogStream();
}
</script>
-<Card.Root class="gap-0 p-0">
- <Card.Header class="bg-muted rounded-t-xl p-4">
- <div class="flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between">
- <div class="flex items-center gap-2">
- <FileTextIcon class="text-primary size-5" />
- <Card.Title class="text-lg">
- <h2>
- {m.containers_logs_title()}
- </h2>
- </Card.Title>
- {#if isStreaming}
- <div class="flex items-center gap-2">
- <div class="size-2 animate-pulse rounded-full bg-green-500"></div>
- <span class="text-xs font-semibold text-green-600 sm:text-sm">{m.common_live()}</span>
- </div>
- {/if}
- </div>
-
- <div class="flex flex-col gap-3 sm:flex-row sm:items-center">
- <label class="flex items-center gap-2">
- <input type="checkbox" bind:checked={autoScroll} class="size-4" />
- <span class="text-sm font-medium">{m.common_autoscroll()}</span>
- </label>
-
+<Card.Root>
+ <Card.Header icon={FileTextIcon}>
+ <div class="flex flex-1 flex-col gap-4 sm:flex-row sm:items-start sm:justify-between">
+ <div class="flex flex-col gap-1.5">
<div class="flex items-center gap-2">
- <Button variant="outline" size="sm" class="text-xs font-medium" onclick={() => viewer?.clearLogs()}>
- {m.common_clear()}
- </Button>
+ <Card.Title>
+ <h2>
+ {m.containers_logs_title()}
+ </h2>
+ </Card.Title>
{#if isStreaming}
- <Button variant="outline" size="sm" class="text-xs font-medium" onclick={() => viewer?.stopLogStream()}>
- {m.common_stop()}
- </Button>
- {:else}
- <Button variant="outline" size="sm" class="text-xs font-medium" onclick={() => viewer?.startLogStream()} disabled={!containerId}>
- {m.common_start()}
- </Button>
+ <div class="flex items-center gap-2">
+ <div class="size-2 animate-pulse rounded-full bg-green-500"></div>
+ <span class="text-xs font-semibold text-green-600 sm:text-sm">{m.common_live()}</span>
+ </div>
{/if}
- <Button
- variant="outline"
- size="sm"
- class="px-2"
- onclick={() => {
- viewer?.stopLogStream();
- viewer?.startLogStream();
- }}
- aria-label="Refresh logs"
- title="Refresh"
- >
- <RefreshCwIcon class="size-4" />
- </Button>
</div>
+ <Card.Description>{m.containers_logs_description()}</Card.Description>
</div>
+ <LogControls
+ bind:autoScroll
+ {isStreaming}
+ disabled={!containerId}
+ onStart={handleStart}
+ onStop={handleStop}
+ onClear={handleClear}
+ onRefresh={handleRefresh}
+ />
</div>
- <Card.Description>{m.containers_logs_description()}</Card.Description>
</Card.Header>
<Card.Content class="p-0">
- <div class="rounded-lg border bg-card/50 p-0">
+ <div class="bg-card/50 rounded-lg border p-0">
<LogViewer
bind:this={viewer}
bind:autoScroll
@@ -112,7 +89,6 @@
onStart={handleStart}
onStop={handleStop}
onClear={handleClear}
- onToggleAutoScroll={handleToggleAutoScroll}
/>
</div>
</Card.Content>
diff --git a/frontend/src/routes/containers/components/ContainerNetwork.svelte b/frontend/src/routes/containers/components/ContainerNetwork.svelte
index 2a83fccfd..4e21ba765 100644
--- a/frontend/src/routes/containers/components/ContainerNetwork.svelte
+++ b/frontend/src/routes/containers/components/ContainerNetwork.svelte
@@ -1,5 +1,5 @@
<script lang="ts">
- import * as Card from '$lib/components/ui/card/index.js';
+ import * as Card from '$lib/components/ui/card';
import NetworkIcon from '@lucide/svelte/icons/network';
import { m } from '$lib/paraglide/messages';
import type { ContainerDetailsDto } from '$lib/types/container.type';
@@ -19,104 +19,138 @@
}
let { container }: Props = $props();
-
- function ensureNetworkConfig(config: any): NetworkConfig {
- return config as NetworkConfig;
- }
</script>
<div class="space-y-6">
- <Card.Root class="pt-0">
- <Card.Header class="bg-muted rounded-t-xl p-4">
- <Card.Title class="flex items-center gap-2 text-lg">
- <NetworkIcon class="text-primary size-5" />
- <h2>
- {m.containers_networks_title()}
- </h2>
- </Card.Title>
- <Card.Description>{m.containers_networks_description()}</Card.Description>
+ <Card.Root>
+ <Card.Header icon={NetworkIcon}>
+ <div class="flex flex-col space-y-1.5">
+ <Card.Title>
+ <h2>
+ {m.containers_networks_title()}
+ </h2>
+ </Card.Title>
+ <Card.Description>{m.containers_networks_description()}</Card.Description>
+ </div>
</Card.Header>
<Card.Content class="p-4">
{#if container.networkSettings?.networks && Object.keys(container.networkSettings.networks).length > 0}
- <div class="grid grid-cols-1 gap-6 lg:grid-cols-2 xl:grid-cols-3">
+ <div class="grid grid-cols-1 gap-4 lg:grid-cols-2">
{#each Object.entries(container.networkSettings.networks) as [networkName, rawNetworkConfig] (networkName)}
- {@const networkConfig = ensureNetworkConfig({
- IPAddress: rawNetworkConfig.ipAddress,
- IPPrefixLen: rawNetworkConfig.ipPrefixLen,
- Gateway: rawNetworkConfig.gateway,
- MacAddress: rawNetworkConfig.macAddress,
- Aliases: rawNetworkConfig.aliases
- })}
- <Card.Root class="pt-0">
- <Card.Header class="bg-muted/30 rounded-t-xl p-4">
- <div class="flex items-center gap-3">
- <div class="rounded-lg bg-blue-500/10 p-2.5">
+ <Card.Root variant="subtle">
+ <Card.Content class="p-4">
+ <div class="border-border mb-4 flex items-center gap-3 border-b pb-4">
+ <div class="rounded-lg bg-blue-500/10 p-2">
<NetworkIcon class="size-5 text-blue-500" />
</div>
<div class="min-w-0 flex-1">
- <Card.Title class="text-base break-all">
+ <div class="text-foreground text-base font-semibold break-all">
{networkName}
- </Card.Title>
- <Card.Description class="text-xs">{m.network_interface()}</Card.Description>
- </div>
- </div>
- </Card.Header>
- <Card.Content class="space-y-4 pt-0">
- <div class="space-y-2">
- <div class="text-muted-foreground text-xs font-semibold uppercase">
- {m.containers_ip_address()}
- </div>
- <div
- class="text-foreground cursor-pointer overflow-hidden font-mono text-sm font-medium break-all select-all"
- title="Click to select"
- >
- {rawNetworkConfig.ipAddress || m.common_na()}
- </div>
- </div>
- <div class="space-y-2">
- <div class="text-muted-foreground text-xs font-semibold uppercase">{m.containers_gateway()}</div>
- <div
- class="text-foreground cursor-pointer overflow-hidden font-mono text-sm font-medium break-all select-all"
- title="Click to select"
- >
- {rawNetworkConfig.gateway || m.common_na()}
- </div>
- </div>
- <div class="space-y-2">
- <div class="text-muted-foreground text-xs font-semibold uppercase">
- {m.containers_mac_address()}
- </div>
- <div
- class="text-foreground cursor-pointer overflow-hidden font-mono text-sm font-medium break-all select-all"
- title="Click to select"
- >
- {rawNetworkConfig.macAddress || m.common_na()}
+ </div>
+ <div class="text-muted-foreground text-xs">{m.network_interface()}</div>
</div>
</div>
- <div class="space-y-2">
- <div class="text-muted-foreground text-xs font-semibold uppercase">{m.containers_subnet()}</div>
- <div
- class="text-foreground cursor-pointer overflow-hidden font-mono text-sm font-medium break-all select-all"
- title="Click to select"
- >
- {rawNetworkConfig.ipPrefixLen
- ? `${rawNetworkConfig.ipAddress}/${rawNetworkConfig.ipPrefixLen}`
- : m.common_na()}
- </div>
+
+ <div class="grid grid-cols-1 gap-3 sm:grid-cols-2">
+ <Card.Root variant="outlined">
+ <Card.Content class="flex flex-col p-3">
+ <div class="text-muted-foreground mb-2 text-xs font-semibold">
+ {m.containers_ip_address()}
+ </div>
+ <div
+ class="text-foreground cursor-pointer font-mono text-sm font-medium break-all select-all"
+ title="Click to select"
+ >
+ {rawNetworkConfig.ipAddress || m.common_na()}
+ </div>
+ </Card.Content>
+ </Card.Root>
+
+ <Card.Root variant="outlined">
+ <Card.Content class="flex flex-col p-3">
+ <div class="text-muted-foreground mb-2 text-xs font-semibold">{m.containers_gateway()}</div>
+ <div
+ class="text-foreground cursor-pointer font-mono text-sm font-medium break-all select-all"
+ title="Click to select"
+ >
+ {rawNetworkConfig.gateway || m.common_na()}
+ </div>
+ </Card.Content>
+ </Card.Root>
+
+ <Card.Root variant="outlined">
+ <Card.Content class="flex flex-col p-3">
+ <div class="text-muted-foreground mb-2 text-xs font-semibold">
+ {m.containers_mac_address()}
+ </div>
+ <div
+ class="text-foreground cursor-pointer font-mono text-sm font-medium break-all select-all"
+ title="Click to select"
+ >
+ {rawNetworkConfig.macAddress || m.common_na()}
+ </div>
+ </Card.Content>
+ </Card.Root>
+
+ <Card.Root variant="outlined">
+ <Card.Content class="flex flex-col p-3">
+ <div class="text-muted-foreground mb-2 text-xs font-semibold">{m.containers_subnet()}</div>
+ <div
+ class="text-foreground cursor-pointer font-mono text-sm font-medium break-all select-all"
+ title="Click to select"
+ >
+ {rawNetworkConfig.ipPrefixLen
+ ? `${rawNetworkConfig.ipAddress}/${rawNetworkConfig.ipPrefixLen}`
+ : m.common_na()}
+ </div>
+ </Card.Content>
+ </Card.Root>
+
+ {#if rawNetworkConfig.networkId}
+ <Card.Root variant="outlined" class="sm:col-span-2">
+ <Card.Content class="flex flex-col p-3">
+ <div class="text-muted-foreground mb-2 text-xs font-semibold">Network ID</div>
+ <div
+ class="text-foreground cursor-pointer font-mono text-sm font-medium break-all select-all"
+ title="Click to select"
+ >
+ {rawNetworkConfig.networkId}
+ </div>
+ </Card.Content>
+ </Card.Root>
+ {/if}
+
+ {#if rawNetworkConfig.endpointId}
+ <Card.Root variant="outlined" class="sm:col-span-2">
+ <Card.Content class="flex flex-col p-3">
+ <div class="text-muted-foreground mb-2 text-xs font-semibold">Endpoint ID</div>
+ <div
+ class="text-foreground cursor-pointer font-mono text-sm font-medium break-all select-all"
+ title="Click to select"
+ >
+ {rawNetworkConfig.endpointId}
+ </div>
+ </Card.Content>
+ </Card.Root>
+ {/if}
+
+ {#if rawNetworkConfig.aliases && rawNetworkConfig.aliases.length > 0}
+ <Card.Root variant="outlined" class="sm:col-span-2">
+ <Card.Content class="flex flex-col p-3">
+ <div class="text-muted-foreground mb-2 text-xs font-semibold">
+ {m.containers_aliases()}
+ </div>
+ <div class="text-foreground space-y-1 text-sm font-medium">
+ {#each rawNetworkConfig.aliases as alias}
+ <div class="cursor-pointer font-mono break-all select-all" title="Click to select">
+ {alias}
+ </div>
+ {/each}
+ </div>
+ </Card.Content>
+ </Card.Root>
+ {/if}
</div>
- {#if rawNetworkConfig.aliases && rawNetworkConfig.aliases.length > 0}
- <div class="space-y-2">
- <div class="text-muted-foreground text-xs font-semibold uppercase">
- {m.containers_aliases()}
- </div>
- <div
- class="text-foreground cursor-pointer overflow-hidden font-mono text-sm font-medium break-all select-all"
- title="Click to select"
- >
- {rawNetworkConfig.aliases.join(', ')}
- </div>
- </div>
- {/if}
</Card.Content>
</Card.Root>
{/each}
diff --git a/frontend/src/routes/containers/components/ContainerOverview.svelte b/frontend/src/routes/containers/components/ContainerOverview.svelte
index 8bda40257..616cf769d 100644
--- a/frontend/src/routes/containers/components/ContainerOverview.svelte
+++ b/frontend/src/routes/containers/components/ContainerOverview.svelte
@@ -1,22 +1,24 @@
<script lang="ts">
- import * as Card from '$lib/components/ui/card/index.js';
+ import * as Card from '$lib/components/ui/card';
import HardDriveIcon from '@lucide/svelte/icons/hard-drive';
- import ClockIcon from '@lucide/svelte/icons/clock';
import NetworkIcon from '@lucide/svelte/icons/network';
- import TerminalIcon from '@lucide/svelte/icons/terminal';
import InfoIcon from '@lucide/svelte/icons/info';
- import CpuIcon from '@lucide/svelte/icons/cpu';
+ import PlayIcon from '@lucide/svelte/icons/play';
+ import StopCircleIcon from '@lucide/svelte/icons/stop-circle';
+ import HeartPulseIcon from '@lucide/svelte/icons/heart-pulse';
import StatusBadge from '$lib/components/badges/status-badge.svelte';
+ import { PortBadge } from '$lib/components/badges';
import { m } from '$lib/paraglide/messages';
import type { ContainerDetailsDto } from '$lib/types/container.type';
- import { format } from 'date-fns';
+ import { format, formatDistanceToNow } from 'date-fns';
interface Props {
container: ContainerDetailsDto;
primaryIpAddress: string;
+ baseServerUrl: string;
}
- let { container, primaryIpAddress }: Props = $props();
+ let { container, primaryIpAddress, baseServerUrl }: Props = $props();
function parseDockerDate(input: string | Date | undefined | null): Date | null {
if (!input) return null;
@@ -42,137 +44,286 @@
const d = parseDockerDate(input);
return d ? format(d, fmt) : 'N/A';
}
+
+ function formatRelativeDate(input: string | Date | undefined | null): string {
+ const d = parseDockerDate(input);
+ if (!d) return 'N/A';
+ try {
+ return formatDistanceToNow(d, { addSuffix: true });
+ } catch {
+ return 'N/A';
+ }
+ }
+
+ function getUptime(input: string | Date | undefined | null): string {
+ const d = parseDockerDate(input);
+ if (!d) return 'N/A';
+ try {
+ return formatDistanceToNow(d, { addSuffix: false });
+ } catch {
+ return 'N/A';
+ }
+ }
+
+ const restartPolicy = $derived(container.hostConfig?.restartPolicy || 'no');
+ const portCount = $derived(container.ports?.length || 0);
+ const mountCount = $derived(container.mounts?.length || 0);
+ const networkCount = $derived(container.networkSettings?.networks ? Object.keys(container.networkSettings.networks).length : 0);
</script>
-<Card.Root class="pt-0">
- <Card.Header class="bg-muted rounded-t-xl p-4">
- <Card.Title class="flex items-center gap-2 text-lg">
- <InfoIcon class="text-primary size-5" />
- <h2>
- {m.containers_details_title()}
- </h2>
- </Card.Title>
- <Card.Description>{m.containers_details_description()}</Card.Description>
+<Card.Root>
+ <Card.Header icon={InfoIcon}>
+ <div class="flex flex-col space-y-1.5">
+ <Card.Title>
+ <h2>
+ {m.containers_details_title()}
+ </h2>
+ </Card.Title>
+ <Card.Description>{m.containers_details_description()}</Card.Description>
+ </div>
</Card.Header>
<Card.Content class="p-4">
- <div class="grid grid-cols-1 gap-x-4 gap-y-6 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-6">
- <div class="flex items-start gap-3">
- <div class="flex size-10 shrink-0 items-center justify-center rounded-full bg-blue-500/10 p-2">
- <HardDriveIcon class="size-5 text-blue-500" />
+ <div class="mb-6 grid grid-cols-1 gap-6 sm:grid-cols-2 lg:grid-cols-4">
+ <div>
+ <div class="text-muted-foreground mb-2 text-xs font-semibold tracking-wide uppercase">
+ {m.common_image()}
</div>
- <div class="min-w-0 flex-1">
- <p class="text-muted-foreground text-sm font-medium">{m.common_image()}</p>
- <p class="mt-1 cursor-pointer text-sm font-semibold break-all select-all sm:text-base" title="Click to select">
+ <div class="flex items-center gap-3">
+ <div class="flex size-10 shrink-0 items-center justify-center rounded-full bg-blue-500/10">
+ <HardDriveIcon class="size-5 text-blue-500" />
+ </div>
+ <div class="text-foreground cursor-pointer text-base font-semibold break-all select-all" title="Click to select">
{container.image || m.common_na()}
- </p>
+ </div>
</div>
</div>
- <div class="flex items-start gap-3">
- <div class="flex size-10 shrink-0 items-center justify-center rounded-full bg-green-500/10 p-2">
- <ClockIcon class="size-5 text-green-500" />
+ {#if container.state?.running}
+ <div>
+ <div class="text-muted-foreground mb-2 text-xs font-semibold tracking-wide uppercase">Uptime</div>
+ <div class="flex items-center gap-3">
+ <div class="flex size-10 shrink-0 items-center justify-center rounded-full bg-green-500/10">
+ <PlayIcon class="size-5 text-green-500" />
+ </div>
+ <div class="text-foreground text-base font-semibold">
+ {getUptime(container.state.startedAt)}
+ </div>
+ </div>
</div>
- <div class="min-w-0 flex-1">
- <p class="text-muted-foreground text-sm font-medium">{m.common_created()}</p>
- <p class="mt-1 cursor-pointer text-sm font-semibold select-all sm:text-base" title="Click to select">
- {formatDockerDate(container?.created)}
- </p>
+ {:else}
+ <div>
+ <div class="text-muted-foreground mb-2 text-xs font-semibold tracking-wide uppercase">Status</div>
+ <div class="flex items-center gap-3">
+ <div class="flex size-10 shrink-0 items-center justify-center rounded-full bg-gray-500/10">
+ <StopCircleIcon class="size-5 text-gray-500" />
+ </div>
+ <div class="text-foreground text-base font-semibold">
+ {container.state?.status || 'Stopped'}
+ </div>
+ </div>
</div>
- </div>
+ {/if}
- <div class="flex items-start gap-3">
- <div class="flex size-10 shrink-0 items-center justify-center rounded-full bg-purple-500/10 p-2">
- <NetworkIcon class="size-5 text-purple-500" />
+ <div>
+ <div class="text-muted-foreground mb-2 text-xs font-semibold tracking-wide uppercase">
+ {m.containers_ip_address()}
</div>
- <div class="min-w-0 flex-1">
- <p class="text-muted-foreground text-sm font-medium">{m.containers_ip_address()}</p>
- <p class="mt-1 cursor-pointer font-mono text-sm font-semibold select-all sm:text-base" title="Click to select">
+ <div class="flex items-center gap-3">
+ <div class="flex size-10 shrink-0 items-center justify-center rounded-full bg-purple-500/10">
+ <NetworkIcon class="size-5 text-purple-500" />
+ </div>
+ <div class="text-foreground cursor-pointer font-mono text-base font-semibold select-all" title="Click to select">
{primaryIpAddress}
- </p>
+ </div>
</div>
</div>
- <div class="flex items-start gap-3">
- <div class="flex size-10 shrink-0 items-center justify-center rounded-full bg-gray-500/10 p-2">
- <CpuIcon class="size-5 text-gray-500" />
+ {#if container.state?.health}
+ <div>
+ <div class="text-muted-foreground mb-2 text-xs font-semibold tracking-wide uppercase">Health Status</div>
+ <div class="flex items-center gap-3">
+ <div class="flex size-10 shrink-0 items-center justify-center rounded-full bg-pink-500/10">
+ <HeartPulseIcon class="size-5 text-pink-500" />
+ </div>
+ <StatusBadge
+ variant={container.state.health.status === 'healthy'
+ ? 'green'
+ : container.state.health.status === 'unhealthy'
+ ? 'red'
+ : 'amber'}
+ text={container.state.health.status}
+ size="md"
+ />
+ </div>
</div>
- <div class="min-w-0 flex-1">
- <p class="text-muted-foreground text-sm font-medium">{m.common_id()}</p>
- <p class="mt-1 cursor-pointer font-mono text-xs font-semibold break-all select-all sm:text-sm" title="Click to select">
+ {/if}
+ </div>
+
+ <div class="grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4">
+ <Card.Root variant="subtle">
+ <Card.Content class="flex flex-col gap-2 p-4">
+ <div class="text-muted-foreground text-xs font-semibold tracking-wide uppercase">
+ {m.common_id()}
+ </div>
+ <div class="text-foreground cursor-pointer font-mono text-sm font-medium break-all select-all" title="Click to select">
{container.id}
- </p>
- </div>
- </div>
+ </div>
+ </Card.Content>
+ </Card.Root>
+
+ <Card.Root variant="subtle">
+ <Card.Content class="flex flex-col gap-2 p-4">
+ <div class="text-muted-foreground text-xs font-semibold tracking-wide uppercase">
+ {m.common_created()}
+ </div>
+ <div class="text-foreground text-sm font-medium">
+ {formatRelativeDate(container?.created)}
+ </div>
+ <div class="text-muted-foreground text-xs">
+ {formatDockerDate(container?.created)}
+ </div>
+ </Card.Content>
+ </Card.Root>
+
+ {#if container.state?.running}
+ <Card.Root variant="subtle">
+ <Card.Content class="flex flex-col gap-2 p-4">
+ <div class="text-muted-foreground text-xs font-semibold tracking-wide uppercase">Started</div>
+ <div class="text-foreground text-sm font-medium">
+ {formatRelativeDate(container.state.startedAt)}
+ </div>
+ <div class="text-muted-foreground text-xs">
+ {formatDockerDate(container.state.startedAt)}
+ </div>
+ </Card.Content>
+ </Card.Root>
+ {:else if container.state?.finishedAt && !container.state.finishedAt.startsWith('0001')}
+ <Card.Root variant="subtle">
+ <Card.Content class="flex flex-col gap-2 p-4">
+ <div class="text-muted-foreground text-xs font-semibold tracking-wide uppercase">Finished</div>
+ <div class="text-foreground text-sm font-medium">
+ {formatRelativeDate(container.state.finishedAt)}
+ </div>
+ <div class="text-muted-foreground text-xs">
+ {formatDockerDate(container.state.finishedAt)}
+ </div>
+ </Card.Content>
+ </Card.Root>
+ {/if}
+
+ <Card.Root variant="subtle">
+ <Card.Content class="flex flex-col gap-2 p-4">
+ <div class="text-muted-foreground text-xs font-semibold tracking-wide uppercase">Restart Policy</div>
+ <div class="text-foreground text-sm font-medium capitalize">
+ {restartPolicy}
+ </div>
+ </Card.Content>
+ </Card.Root>
+
+ <Card.Root variant="subtle">
+ <Card.Content class="flex flex-col gap-2 p-4">
+ <div class="text-muted-foreground text-xs font-semibold tracking-wide uppercase">Ports</div>
+ <div class="text-foreground text-sm font-medium">
+ {portCount}
+ {portCount === 1 ? 'port' : 'ports'} exposed
+ </div>
+ </Card.Content>
+ </Card.Root>
+
+ <Card.Root variant="subtle">
+ <Card.Content class="flex flex-col gap-2 p-4">
+ <div class="text-muted-foreground text-xs font-semibold tracking-wide uppercase">Volumes</div>
+ <div class="text-foreground text-sm font-medium">
+ {mountCount}
+ {mountCount === 1 ? 'mount' : 'mounts'}
+ </div>
+ </Card.Content>
+ </Card.Root>
+
+ <Card.Root variant="subtle">
+ <Card.Content class="flex flex-col gap-2 p-4">
+ <div class="text-muted-foreground text-xs font-semibold tracking-wide uppercase">Networks</div>
+ <div class="text-foreground text-sm font-medium">
+ {networkCount}
+ {networkCount === 1 ? 'network' : 'networks'}
+ </div>
+ </Card.Content>
+ </Card.Root>
+
+ <Card.Root variant="subtle">
+ <Card.Content class="flex flex-col gap-2 p-4">
+ <div class="text-muted-foreground text-xs font-semibold tracking-wide uppercase">Image ID</div>
+ <div class="text-foreground cursor-pointer font-mono text-sm font-medium break-all select-all" title="Click to select">
+ {container.imageId}
+ </div>
+ </Card.Content>
+ </Card.Root>
{#if container.config?.workingDir}
- <div class="flex items-start gap-3">
- <div class="flex size-10 shrink-0 items-center justify-center rounded-full bg-indigo-500/10 p-2">
- <InfoIcon class="size-5 text-indigo-500" />
- </div>
- <div class="min-w-0 flex-1">
- <p class="text-muted-foreground text-sm font-medium">{m.containers_working_directory()}</p>
- <p
- class="mt-1 cursor-pointer font-mono text-xs font-semibold break-all select-all sm:text-sm"
+ <Card.Root variant="subtle">
+ <Card.Content class="flex flex-col gap-2 p-4">
+ <div class="text-muted-foreground text-xs font-semibold tracking-wide uppercase">
+ {m.containers_working_directory()}
+ </div>
+ <div
+ class="text-foreground cursor-pointer font-mono text-sm font-medium break-all select-all"
title="Click to select"
>
{container.config.workingDir}
- </p>
- </div>
- </div>
+ </div>
+ </Card.Content>
+ </Card.Root>
{/if}
{#if container.config?.user}
- <div class="flex items-start gap-3">
- <div class="flex size-10 shrink-0 items-center justify-center rounded-full bg-orange-500/10 p-2">
- <InfoIcon class="size-5 text-orange-500" />
- </div>
- <div class="min-w-0 flex-1">
- <p class="text-muted-foreground text-sm font-medium">User</p>
- <p class="mt-1 cursor-pointer font-mono text-sm font-semibold select-all" title="Click to select">
+ <Card.Root variant="subtle">
+ <Card.Content class="flex flex-col gap-2 p-4">
+ <div class="text-muted-foreground text-xs font-semibold tracking-wide uppercase">User</div>
+ <div class="text-foreground cursor-pointer font-mono text-sm font-medium select-all" title="Click to select">
{container.config.user}
- </p>
- </div>
- </div>
+ </div>
+ </Card.Content>
+ </Card.Root>
{/if}
- {#if container.state?.health}
- <div class="flex items-start gap-3">
- <div class="flex size-10 shrink-0 items-center justify-center rounded-full bg-pink-500/10 p-2">
- <InfoIcon class="size-5 text-pink-500" />
- </div>
- <div class="min-w-0 flex-1">
- <p class="text-muted-foreground text-sm font-medium">Health Status</p>
- <div class="mt-2">
- <StatusBadge
- variant={container.state.health.status === 'healthy'
- ? 'green'
- : container.state.health.status === 'unhealthy'
- ? 'red'
- : 'amber'}
- text={container.state.health.status}
- size="sm"
- />
+ {#if container.config?.entrypoint && container.config.entrypoint.length > 0}
+ <Card.Root variant="subtle" class="sm:col-span-2">
+ <Card.Content class="flex flex-col gap-2 p-4">
+ <div class="text-muted-foreground text-xs font-semibold tracking-wide uppercase">Entrypoint</div>
+ <div
+ class="text-foreground cursor-pointer font-mono text-sm font-medium break-all select-all"
+ title="Click to select"
+ >
+ {container.config.entrypoint.join(' ')}
</div>
- </div>
- </div>
+ </Card.Content>
+ </Card.Root>
{/if}
{#if container.config?.cmd && container.config.cmd.length > 0}
- <div class="col-span-1 flex items-start gap-3 sm:col-span-2 lg:col-span-3 xl:col-span-4 2xl:col-span-6">
- <div class="flex size-10 shrink-0 items-center justify-center rounded-full bg-amber-500/10 p-2">
- <TerminalIcon class="size-5 text-amber-500" />
- </div>
- <div class="min-w-0 flex-1">
- <p class="text-muted-foreground text-sm font-medium">{m.containers_command()}</p>
- <p
- class="mt-1 cursor-pointer font-mono text-xs leading-relaxed font-medium break-all select-all sm:text-sm"
+ <Card.Root variant="subtle" class="sm:col-span-2 lg:col-span-3 xl:col-span-4">
+ <Card.Content class="flex flex-col gap-2 p-4">
+ <div class="text-muted-foreground text-xs font-semibold tracking-wide uppercase">
+ {m.containers_command()}
+ </div>
+ <div
+ class="text-foreground cursor-pointer font-mono text-sm font-medium break-all select-all"
title="Click to select"
>
{container.config.cmd.join(' ')}
- </p>
- </div>
- </div>
+ </div>
+ </Card.Content>
+ </Card.Root>
{/if}
</div>
+
+ {#if container.ports && container.ports.length > 0}
+ <div class="mt-6">
+ <div class="text-muted-foreground mb-3 text-xs font-semibold tracking-wide uppercase">
+ {m.containers_port_mappings()}
+ </div>
+ <PortBadge ports={container.ports} {baseServerUrl} />
+ </div>
+ {/if}
</Card.Content>
</Card.Root>
diff --git a/frontend/src/routes/containers/components/ContainerShell.svelte b/frontend/src/routes/containers/components/ContainerShell.svelte
index cf772b6af..92cad2c0c 100644
--- a/frontend/src/routes/containers/components/ContainerShell.svelte
+++ b/frontend/src/routes/containers/components/ContainerShell.svelte
@@ -1,7 +1,8 @@
<script lang="ts">
- import * as Card from '$lib/components/ui/card/index.js';
+ import * as Card from '$lib/components/ui/card';
import Terminal from '$lib/components/terminal/terminal.svelte';
- import TerminalHeader from '$lib/components/terminal/terminal-header.svelte';
+ import TerminalControls from '$lib/components/terminal/terminal-controls.svelte';
+ import TerminalIcon from '@lucide/svelte/icons/terminal';
import { m } from '$lib/paraglide/messages';
import { environmentStore } from '$lib/stores/environment.store';
import settingsStore from '$lib/stores/config-store';
@@ -55,10 +56,27 @@
}
</script>
-<Card.Root class="flex flex-col gap-0 p-0">
- <Card.Header class="bg-muted rounded-t-xl p-4">
- <TerminalHeader {isConnected} bind:selectedShell onShellChange={handleShellChange} onReconnect={handleReconnect} />
- <Card.Description class="mt-4">{m.shell_interactive_access()}</Card.Description>
+<Card.Root>
+ <Card.Header icon={TerminalIcon}>
+ <div class="flex flex-1 flex-col gap-4 sm:flex-row sm:items-start sm:justify-between">
+ <div class="flex flex-col gap-1.5">
+ <div class="flex items-center gap-2">
+ <Card.Title>
+ <h2>
+ {m.shell_title()}
+ </h2>
+ </Card.Title>
+ {#if isConnected}
+ <div class="flex items-center gap-2">
+ <div class="size-2 animate-pulse rounded-full bg-green-500"></div>
+ <span class="text-xs font-semibold text-green-600 sm:text-sm">{m.common_live()}</span>
+ </div>
+ {/if}
+ </div>
+ <Card.Description>{m.shell_interactive_access()}</Card.Description>
+ </div>
+ <TerminalControls bind:selectedShell onShellChange={handleShellChange} onReconnect={handleReconnect} />
+ </div>
</Card.Header>
<Card.Content class="overflow-hidden p-2">
<div class="h-full overflow-hidden rounded-lg border">
diff --git a/frontend/src/routes/containers/components/ContainerStats.svelte b/frontend/src/routes/containers/components/ContainerStats.svelte
index 147e8d982..3b842b4e1 100644
--- a/frontend/src/routes/containers/components/ContainerStats.svelte
+++ b/frontend/src/routes/containers/components/ContainerStats.svelte
@@ -1,8 +1,8 @@
<script lang="ts">
- import * as Card from '$lib/components/ui/card/index.js';
+ import * as Card from '$lib/components/ui/card';
import ActivityIcon from '@lucide/svelte/icons/activity';
- import { Progress } from '$lib/components/ui/progress/index.js';
- import { Skeleton } from '$lib/components/ui/skeleton/index.js';
+ import { Progress } from '$lib/components/ui/progress';
+ import { Skeleton } from '$lib/components/ui/skeleton';
import { m } from '$lib/paraglide/messages';
import bytes from 'bytes';
import type { ContainerDetailsDto, ContainerStats as ContainerStatsType } from '$lib/types/container.type';
@@ -86,77 +86,88 @@
{/snippet}
{#snippet statCardSkeleton()}
- <div class="bg-muted/30 flex flex-col rounded-lg p-4">
- <Skeleton class="mb-3 h-3 w-24" />
- <div class="grid flex-1 grid-cols-2 gap-3">
- <div class="space-y-1">
- <Skeleton class="h-3 w-16" />
- <Skeleton class="h-5 w-20" />
- <Skeleton class="h-3 w-24" />
- </div>
- <div class="space-y-1">
- <Skeleton class="h-3 w-16" />
- <Skeleton class="h-5 w-20" />
- <Skeleton class="h-3 w-24" />
+ <Card.Root variant="subtle" class="flex flex-col">
+ <Card.Content class="flex flex-col p-4">
+ <Skeleton class="mb-3 h-3 w-24" />
+ <div class="grid flex-1 grid-cols-2 gap-3">
+ <div class="space-y-1">
+ <Skeleton class="h-3 w-16" />
+ <Skeleton class="h-5 w-20" />
+ <Skeleton class="h-3 w-24" />
+ </div>
+ <div class="space-y-1">
+ <Skeleton class="h-3 w-16" />
+ <Skeleton class="h-5 w-20" />
+ <Skeleton class="h-3 w-24" />
+ </div>
</div>
- </div>
- </div>
+ </Card.Content>
+ </Card.Root>
{/snippet}
{#snippet processCardSkeleton()}
- <div class="bg-muted/30 flex flex-col justify-center rounded-lg p-4">
- <Skeleton class="mb-2 h-3 w-32" />
- <Skeleton class="h-8 w-16" />
- <Skeleton class="mt-1 h-3 w-24" />
- </div>
+ <Card.Root variant="subtle" class="flex flex-col justify-center">
+ <Card.Content class="flex flex-col justify-center p-4">
+ <Skeleton class="mb-2 h-3 w-32" />
+ <Skeleton class="h-8 w-16" />
+ <Skeleton class="mt-1 h-3 w-24" />
+ </Card.Content>
+ </Card.Root>
{/snippet}
{#snippet networkInterfacesSkeleton()}
- <div class="bg-muted/30 rounded-lg p-4">
- <Skeleton class="mb-3 h-3 w-36" />
- <div class="grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4">
- {#each Array(4) as _}
- <div class="border-border bg-background flex flex-col rounded-md border p-3">
- <Skeleton class="mb-2 h-4 w-16" />
- <div class="flex-1 space-y-1">
- <div class="flex justify-between">
- <Skeleton class="h-3 w-8" />
- <Skeleton class="h-3 w-16" />
- </div>
- <div class="flex justify-between">
- <Skeleton class="h-3 w-8" />
- <Skeleton class="h-3 w-16" />
- </div>
- </div>
- </div>
- {/each}
- </div>
- </div>
+ <Card.Root variant="subtle">
+ <Card.Content class="p-4">
+ <Skeleton class="mb-3 h-3 w-36" />
+ <div class="grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4">
+ {#each Array(4) as _}
+ <Card.Root class="flex flex-col">
+ <Card.Content class="flex flex-col p-3">
+ <Skeleton class="mb-2 h-4 w-16" />
+ <div class="flex-1 space-y-1">
+ <div class="flex justify-between">
+ <Skeleton class="h-3 w-8" />
+ <Skeleton class="h-3 w-16" />
+ </div>
+ <div class="flex justify-between">
+ <Skeleton class="h-3 w-8" />
+ <Skeleton class="h-3 w-16" />
+ </div>
+ </div>
+ </Card.Content>
+ </Card.Root>
+ {/each}
+ </div>
+ </Card.Content>
+ </Card.Root>
{/snippet}
{#snippet detailsSkeleton()}
- <div class="bg-muted/30 flex flex-col rounded-lg p-4">
- <Skeleton class="mb-3 h-3 w-28" />
- <div class="grid flex-1 grid-cols-2 gap-x-4 gap-y-2">
- {#each Array(8) as _}
- <div class="flex justify-between">
- <Skeleton class="h-3 w-24" />
- <Skeleton class="h-3 w-16" />
- </div>
- {/each}
- </div>
- </div>
+ <Card.Root variant="subtle" class="flex flex-col">
+ <Card.Content class="flex flex-col p-4">
+ <Skeleton class="mb-3 h-3 w-28" />
+ <div class="grid flex-1 grid-cols-2 gap-x-4 gap-y-2">
+ {#each Array(8) as _}
+ <div class="flex justify-between">
+ <Skeleton class="h-3 w-24" />
+ <Skeleton class="h-3 w-16" />
+ </div>
+ {/each}
+ </div>
+ </Card.Content>
+ </Card.Root>
{/snippet}
-<Card.Root class="pt-0">
- <Card.Header class="bg-muted rounded-t-xl p-4">
- <Card.Title class="flex items-center gap-2 text-lg">
- <ActivityIcon class="text-primary size-5" />
- <h2>
- {m.containers_resource_metrics()}
- </h2>
- </Card.Title>
- <Card.Description>{m.containers_resource_metrics_description()}</Card.Description>
+<Card.Root>
+ <Card.Header icon={ActivityIcon}>
+ <div class="flex flex-col space-y-1.5">
+ <Card.Title>
+ <h2>
+ {m.containers_resource_metrics()}
+ </h2>
+ </Card.Title>
+ <Card.Description>{m.containers_resource_metrics_description()}</Card.Description>
+ </div>
</Card.Header>
<Card.Content class="p-4">
{#if loading}
@@ -256,209 +267,223 @@
<div class="mt-4 grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3">
<!-- Process Count -->
{#if stats.pids_stats && stats.pids_stats.current !== undefined}
- <div class="bg-muted/30 flex flex-col justify-center rounded-lg p-4">
- <div class="text-muted-foreground mb-2 text-xs font-semibold uppercase tracking-wide">
- {m.containers_process_count()}
- </div>
- <div class="text-foreground text-2xl font-bold">{stats.pids_stats.current}</div>
- {#if stats.pids_stats.limit && stats.pids_stats.limit < Number.MAX_SAFE_INTEGER}
- <div class="text-muted-foreground mt-1 text-xs">
- {m.containers_process_limit()}: {stats.pids_stats.limit}
+ <Card.Root variant="subtle" class="flex flex-col justify-center">
+ <Card.Content class="flex flex-col justify-center p-4">
+ <div class="text-muted-foreground mb-2 text-xs font-semibold tracking-wide uppercase">
+ {m.containers_process_count()}
</div>
- {/if}
- </div>
+ <div class="text-foreground text-2xl font-bold">{stats.pids_stats.current}</div>
+ {#if stats.pids_stats.limit && stats.pids_stats.limit < Number.MAX_SAFE_INTEGER}
+ <div class="text-muted-foreground mt-1 text-xs">
+ {m.containers_process_limit()}: {stats.pids_stats.limit}
+ </div>
+ {/if}
+ </Card.Content>
+ </Card.Root>
{/if}
<!-- Network I/O Summary -->
- <div class="bg-muted/30 flex flex-col rounded-lg p-4">
- <div class="text-muted-foreground mb-3 text-xs font-semibold uppercase tracking-wide">
- {m.containers_network_io()}
- </div>
- <div class="grid flex-1 grid-cols-2 gap-3">
- <div>
- <div class="text-muted-foreground text-xs font-medium">
- {m.containers_network_received()}
- </div>
- <div class="text-foreground text-sm font-bold">
- {bytes.format(totalNetworkRx)}
- </div>
- <div class="text-muted-foreground text-xs">
- {totalNetworkRxPackets}
- {m.containers_stats_packets()}
- </div>
- </div>
- <div>
- <div class="text-muted-foreground text-xs font-medium">
- {m.containers_network_transmitted()}
- </div>
- <div class="text-foreground text-sm font-bold">
- {bytes.format(totalNetworkTx)}
- </div>
- <div class="text-muted-foreground text-xs">
- {totalNetworkTxPackets}
- {m.containers_stats_packets()}
- </div>
- </div>
- </div>
- </div>
-
- <!-- Block I/O -->
- {#if stats.blkio_stats && stats.blkio_stats.io_service_bytes_recursive && stats.blkio_stats.io_service_bytes_recursive.length > 0}
- <div class="bg-muted/30 flex flex-col rounded-lg p-4">
- <div class="text-muted-foreground mb-3 text-xs font-semibold uppercase tracking-wide">
- {m.containers_block_io()}
+ <Card.Root variant="subtle" class="flex flex-col">
+ <Card.Content class="flex flex-col p-4">
+ <div class="text-muted-foreground mb-3 text-xs font-semibold tracking-wide uppercase">
+ {m.containers_network_io()}
</div>
<div class="grid flex-1 grid-cols-2 gap-3">
<div>
<div class="text-muted-foreground text-xs font-medium">
- {m.containers_block_io_read()}
+ {m.containers_network_received()}
</div>
<div class="text-foreground text-sm font-bold">
- {bytes.format(blockIoRead)}
+ {bytes.format(totalNetworkRx)}
+ </div>
+ <div class="text-muted-foreground text-xs">
+ {totalNetworkRxPackets}
+ {m.containers_stats_packets()}
</div>
</div>
<div>
<div class="text-muted-foreground text-xs font-medium">
- {m.containers_block_io_write()}
+ {m.containers_network_transmitted()}
</div>
<div class="text-foreground text-sm font-bold">
- {bytes.format(blockIoWrite)}
+ {bytes.format(totalNetworkTx)}
+ </div>
+ <div class="text-muted-foreground text-xs">
+ {totalNetworkTxPackets}
+ {m.containers_stats_packets()}
</div>
</div>
</div>
- </div>
+ </Card.Content>
+ </Card.Root>
+
+ <!-- Block I/O -->
+ {#if stats.blkio_stats && stats.blkio_stats.io_service_bytes_recursive && stats.blkio_stats.io_service_bytes_recursive.length > 0}
+ <Card.Root variant="subtle" class="flex flex-col">
+ <Card.Content class="flex flex-col p-4">
+ <div class="text-muted-foreground mb-3 text-xs font-semibold tracking-wide uppercase">
+ {m.containers_block_io()}
+ </div>
+ <div class="grid flex-1 grid-cols-2 gap-3">
+ <div>
+ <div class="text-muted-foreground text-xs font-medium">
+ {m.containers_block_io_read()}
+ </div>
+ <div class="text-foreground text-sm font-bold">
+ {bytes.format(blockIoRead)}
+ </div>
+ </div>
+ <div>
+ <div class="text-muted-foreground text-xs font-medium">
+ {m.containers_block_io_write()}
+ </div>
+ <div class="text-foreground text-sm font-bold">
+ {bytes.format(blockIoWrite)}
+ </div>
+ </div>
+ </div>
+ </Card.Content>
+ </Card.Root>
{/if}
</div>
<!-- Network Interfaces Details -->
{#if networkInterfaces.length > 0}
<div class="mt-4">
- <div class="bg-muted/30 rounded-lg p-4">
- <div class="text-muted-foreground mb-3 text-xs font-semibold uppercase tracking-wide">
- {m.containers_stats_network_interfaces()}
- </div>
- <div class="grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4">
- {#each networkInterfaces as [interfaceName, interfaceStats]}
- <div class="border-border bg-background flex flex-col rounded-md border p-3">
- <div class="text-foreground mb-2 text-sm font-semibold">
- {interfaceName}
- </div>
- <div class="flex-1 space-y-1 text-xs">
- <div class="flex justify-between">
- <span class="text-muted-foreground">RX:</span>
- <span class="text-foreground font-medium">{bytes.format(interfaceStats.rx_bytes)}</span>
- </div>
- <div class="flex justify-between">
- <span class="text-muted-foreground">TX:</span>
- <span class="text-foreground font-medium">{bytes.format(interfaceStats.tx_bytes)}</span>
- </div>
- {#if interfaceStats.rx_errors > 0 || interfaceStats.tx_errors > 0}
- <div class="text-destructive mt-1 text-xs">
- {m.containers_stats_errors()}: {interfaceStats.rx_errors + interfaceStats.tx_errors}
+ <Card.Root variant="subtle">
+ <Card.Content class="p-4">
+ <div class="text-muted-foreground mb-3 text-xs font-semibold tracking-wide uppercase">
+ {m.containers_stats_network_interfaces()}
+ </div>
+ <div class="grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4">
+ {#each networkInterfaces as [interfaceName, interfaceStats]}
+ <Card.Root variant="outlined" class="flex flex-col">
+ <Card.Content class="flex flex-col p-3">
+ <div class="text-foreground mb-2 text-sm font-semibold">
+ {interfaceName}
</div>
- {/if}
- {#if interfaceStats.rx_dropped > 0 || interfaceStats.tx_dropped > 0}
- <div class="text-warning mt-1 text-xs">
- {m.containers_stats_dropped()}: {interfaceStats.rx_dropped + interfaceStats.tx_dropped}
+ <div class="flex-1 space-y-1 text-xs">
+ <div class="flex justify-between">
+ <span class="text-muted-foreground">RX:</span>
+ <span class="text-foreground font-medium">{bytes.format(interfaceStats.rx_bytes)}</span>
+ </div>
+ <div class="flex justify-between">
+ <span class="text-muted-foreground">TX:</span>
+ <span class="text-foreground font-medium">{bytes.format(interfaceStats.tx_bytes)}</span>
+ </div>
+ {#if interfaceStats.rx_errors > 0 || interfaceStats.tx_errors > 0}
+ <div class="text-destructive mt-1 text-xs">
+ {m.containers_stats_errors()}: {interfaceStats.rx_errors + interfaceStats.tx_errors}
+ </div>
+ {/if}
+ {#if interfaceStats.rx_dropped > 0 || interfaceStats.tx_dropped > 0}
+ <div class="text-warning mt-1 text-xs">
+ {m.containers_stats_dropped()}: {interfaceStats.rx_dropped + interfaceStats.tx_dropped}
+ </div>
+ {/if}
</div>
- {/if}
- </div>
- </div>
- {/each}
- </div>
- </div>
+ </Card.Content>
+ </Card.Root>
+ {/each}
+ </div>
+ </Card.Content>
+ </Card.Root>
</div>
{/if}
<div class="mt-4 grid grid-cols-1 gap-4 lg:grid-cols-2">
<!-- Memory Details -->
{#if stats.memory_stats?.stats}
- <div class="bg-muted/30 flex flex-col rounded-lg p-4">
- <div class="text-muted-foreground mb-3 text-xs font-semibold uppercase tracking-wide">
- {m.containers_stats_memory_details()}
- </div>
- <div class="grid flex-1 grid-cols-2 gap-x-4 gap-y-2 text-xs">
- <div class="flex justify-between">
- <span class="text-muted-foreground">{m.containers_stats_memory_usage()}:</span>
- <span class="text-foreground font-medium">{memoryUsageFormatted}</span>
- </div>
- <div class="flex justify-between">
- <span class="text-muted-foreground">{m.containers_stats_memory_limit()}:</span>
- <span class="text-foreground font-medium">{memoryLimitFormatted}</span>
- </div>
- <div class="flex justify-between">
- <span class="text-muted-foreground">{m.containers_stats_cache()}:</span>
- <span class="text-foreground font-medium">{bytes.format(memoryCacheBytes)}</span>
+ <Card.Root variant="subtle" class="flex flex-col">
+ <Card.Content class="flex flex-col p-4">
+ <div class="text-muted-foreground mb-3 text-xs font-semibold tracking-wide uppercase">
+ {m.containers_stats_memory_details()}
</div>
- <div class="flex justify-between">
- <span class="text-muted-foreground">{m.containers_stats_memory_rss()}:</span>
- <span class="text-foreground font-medium">{bytes.format(stats.memory_stats.stats.anon || 0)}</span>
- </div>
- <div class="flex justify-between">
- <span class="text-muted-foreground">{m.containers_stats_memory_active_file()}:</span>
- <span class="text-foreground font-medium">{bytes.format(stats.memory_stats.stats.active_file || 0)}</span>
- </div>
- <div class="flex justify-between">
- <span class="text-muted-foreground">{m.containers_stats_memory_inactive_file()}:</span>
- <span class="text-foreground font-medium">{bytes.format(stats.memory_stats.stats.inactive_file || 0)}</span>
- </div>
- {#if stats.memory_stats.stats.pgfault}
+ <div class="grid flex-1 grid-cols-2 gap-x-4 gap-y-2 text-xs">
<div class="flex justify-between">
- <span class="text-muted-foreground">{m.containers_stats_memory_page_faults()}:</span>
- <span class="text-foreground font-medium">{stats.memory_stats.stats.pgfault.toLocaleString()}</span>
+ <span class="text-muted-foreground">{m.containers_stats_memory_usage()}:</span>
+ <span class="text-foreground font-medium">{memoryUsageFormatted}</span>
</div>
- {/if}
- {#if stats.memory_stats.stats.pgmajfault}
<div class="flex justify-between">
- <span class="text-muted-foreground">{m.containers_stats_memory_major_faults()}:</span>
- <span class="text-foreground font-medium">{stats.memory_stats.stats.pgmajfault.toLocaleString()}</span>
+ <span class="text-muted-foreground">{m.containers_stats_memory_limit()}:</span>
+ <span class="text-foreground font-medium">{memoryLimitFormatted}</span>
</div>
- {/if}
- </div>
- </div>
+ <div class="flex justify-between">
+ <span class="text-muted-foreground">{m.containers_stats_cache()}:</span>
+ <span class="text-foreground font-medium">{bytes.format(memoryCacheBytes)}</span>
+ </div>
+ <div class="flex justify-between">
+ <span class="text-muted-foreground">{m.containers_stats_memory_rss()}:</span>
+ <span class="text-foreground font-medium">{bytes.format(stats.memory_stats.stats.anon || 0)}</span>
+ </div>
+ <div class="flex justify-between">
+ <span class="text-muted-foreground">{m.containers_stats_memory_active_file()}:</span>
+ <span class="text-foreground font-medium">{bytes.format(stats.memory_stats.stats.active_file || 0)}</span>
+ </div>
+ <div class="flex justify-between">
+ <span class="text-muted-foreground">{m.containers_stats_memory_inactive_file()}:</span>
+ <span class="text-foreground font-medium">{bytes.format(stats.memory_stats.stats.inactive_file || 0)}</span>
+ </div>
+ {#if stats.memory_stats.stats.pgfault}
+ <div class="flex justify-between">
+ <span class="text-muted-foreground">{m.containers_stats_memory_page_faults()}:</span>
+ <span class="text-foreground font-medium">{stats.memory_stats.stats.pgfault.toLocaleString()}</span>
+ </div>
+ {/if}
+ {#if stats.memory_stats.stats.pgmajfault}
+ <div class="flex justify-between">
+ <span class="text-muted-foreground">{m.containers_stats_memory_major_faults()}:</span>
+ <span class="text-foreground font-medium">{stats.memory_stats.stats.pgmajfault.toLocaleString()}</span>
+ </div>
+ {/if}
+ </div>
+ </Card.Content>
+ </Card.Root>
{/if}
<!-- CPU Details -->
{#if stats.cpu_stats}
- <div class="bg-muted/30 flex flex-col rounded-lg p-4">
- <div class="text-muted-foreground mb-3 text-xs font-semibold uppercase tracking-wide">
- {m.containers_stats_cpu_details()}
- </div>
- <div class="grid flex-1 grid-cols-2 gap-x-4 gap-y-2 text-xs">
- <div class="flex justify-between">
- <span class="text-muted-foreground">{m.containers_stats_online_cpus()}:</span>
- <span class="text-foreground font-medium">{stats.cpu_stats.online_cpus}</span>
- </div>
- <div class="flex justify-between">
- <span class="text-muted-foreground">{m.containers_stats_cpu_usage()}:</span>
- <span class="text-foreground font-medium">{cpuUsagePercent.toFixed(2)}%</span>
- </div>
- <div class="flex justify-between">
- <span class="text-muted-foreground">{m.containers_stats_cpu_user_mode()}:</span>
- <span class="text-foreground font-medium"
- >{(stats.cpu_stats.cpu_usage.usage_in_usermode / 1000000000).toFixed(2)}s</span
- >
+ <Card.Root variant="subtle" class="flex flex-col">
+ <Card.Content class="flex flex-col p-4">
+ <div class="text-muted-foreground mb-3 text-xs font-semibold tracking-wide uppercase">
+ {m.containers_stats_cpu_details()}
</div>
- <div class="flex justify-between">
- <span class="text-muted-foreground">{m.containers_stats_cpu_kernel_mode()}:</span>
- <span class="text-foreground font-medium"
- >{(stats.cpu_stats.cpu_usage.usage_in_kernelmode / 1000000000).toFixed(2)}s</span
- >
- </div>
- {#if stats.cpu_stats.throttling_data}
+ <div class="grid flex-1 grid-cols-2 gap-x-4 gap-y-2 text-xs">
+ <div class="flex justify-between">
+ <span class="text-muted-foreground">{m.containers_stats_online_cpus()}:</span>
+ <span class="text-foreground font-medium">{stats.cpu_stats.online_cpus}</span>
+ </div>
<div class="flex justify-between">
- <span class="text-muted-foreground">{m.containers_stats_cpu_throttled_periods()}:</span>
- <span class="text-foreground font-medium">{stats.cpu_stats.throttling_data.throttled_periods}</span>
+ <span class="text-muted-foreground">{m.containers_stats_cpu_usage()}:</span>
+ <span class="text-foreground font-medium">{cpuUsagePercent.toFixed(2)}%</span>
</div>
<div class="flex justify-between">
- <span class="text-muted-foreground">{m.containers_stats_cpu_throttled_time()}:</span>
+ <span class="text-muted-foreground">{m.containers_stats_cpu_user_mode()}:</span>
<span class="text-foreground font-medium"
- >{(stats.cpu_stats.throttling_data.throttled_time / 1000000000).toFixed(2)}s</span
+ >{(stats.cpu_stats.cpu_usage.usage_in_usermode / 1000000000).toFixed(2)}s</span
>
</div>
- {/if}
- </div>
- </div>
+ <div class="flex justify-between">
+ <span class="text-muted-foreground">{m.containers_stats_cpu_kernel_mode()}:</span>
+ <span class="text-foreground font-medium"
+ >{(stats.cpu_stats.cpu_usage.usage_in_kernelmode / 1000000000).toFixed(2)}s</span
+ >
+ </div>
+ {#if stats.cpu_stats.throttling_data}
+ <div class="flex justify-between">
+ <span class="text-muted-foreground">{m.containers_stats_cpu_throttled_periods()}:</span>
+ <span class="text-foreground font-medium">{stats.cpu_stats.throttling_data.throttled_periods}</span>
+ </div>
+ <div class="flex justify-between">
+ <span class="text-muted-foreground">{m.containers_stats_cpu_throttled_time()}:</span>
+ <span class="text-foreground font-medium"
+ >{(stats.cpu_stats.throttling_data.throttled_time / 1000000000).toFixed(2)}s</span
+ >
+ </div>
+ {/if}
+ </div>
+ </Card.Content>
+ </Card.Root>
{/if}
</div>
{:else if !container.state?.running}
diff --git a/frontend/src/routes/containers/components/ContainerStorage.svelte b/frontend/src/routes/containers/components/ContainerStorage.svelte
index db12ff1ee..493a45b1c 100644
--- a/frontend/src/routes/containers/components/ContainerStorage.svelte
+++ b/frontend/src/routes/containers/components/ContainerStorage.svelte
@@ -1,6 +1,6 @@
<script lang="ts">
- import * as Card from '$lib/components/ui/card/index.js';
- import { Badge } from '$lib/components/ui/badge/index.js';
+ import * as Card from '$lib/components/ui/card';
+ import { Badge } from '$lib/components/ui/badge';
import DatabaseIcon from '@lucide/svelte/icons/database';
import HardDriveIcon from '@lucide/svelte/icons/hard-drive';
import TerminalIcon from '@lucide/svelte/icons/terminal';
@@ -15,26 +15,27 @@
</script>
<div class="space-y-6">
- <Card.Root class="pt-0">
- <Card.Header class="bg-muted rounded-t-xl p-4">
- <Card.Title class="flex items-center gap-2 text-lg">
- <DatabaseIcon class="text-primary size-5" />
- <h2>
- {m.containers_storage_title()}
- </h2>
- </Card.Title>
- <Card.Description>{m.containers_storage_description()}</Card.Description>
+ <Card.Root>
+ <Card.Header icon={DatabaseIcon}>
+ <div class="flex flex-col space-y-1.5">
+ <Card.Title>
+ <h2>
+ {m.containers_storage_title()}
+ </h2>
+ </Card.Title>
+ <Card.Description>{m.containers_storage_description()}</Card.Description>
+ </div>
</Card.Header>
<Card.Content class="p-4">
{#if container.mounts && container.mounts.length > 0}
- <div class="grid grid-cols-1 gap-6 lg:grid-cols-2 xl:grid-cols-3">
+ <div class="grid grid-cols-1 gap-4 lg:grid-cols-2 xl:grid-cols-3">
{#each container.mounts as mount (mount.destination)}
- <Card.Root class="pt-0">
- <Card.Header class="bg-muted/30 rounded-t-xl p-4">
- <div class="flex items-center justify-between">
+ <Card.Root variant="subtle">
+ <Card.Content class="p-4">
+ <div class="border-border mb-4 flex items-center justify-between border-b pb-4">
<div class="flex items-center gap-3">
<div
- class="rounded-lg p-2.5 {mount.type === 'volume'
+ class="rounded-lg p-2 {mount.type === 'volume'
? 'bg-purple-500/10'
: mount.type === 'bind'
? 'bg-blue-500/10'
@@ -49,43 +50,77 @@
{/if}
</div>
<div class="min-w-0 flex-1">
- <Card.Title class="text-base break-all">
+ <div class="text-foreground text-base font-semibold break-all">
{mount.type === 'tmpfs'
? m.containers_mount_type_tmpfs()
: mount.type === 'volume'
? mount.name || m.containers_mount_type_volume()
: m.containers_mount_type_bind()}
- </Card.Title>
- <Card.Description class="text-xs">
+ </div>
+ <div class="text-muted-foreground text-xs">
{mount.type} mount
- </Card.Description>
+ </div>
</div>
</div>
<Badge variant={mount.rw ? 'outline' : 'secondary'} class="text-xs font-semibold">
{mount.rw ? m.common_rw() : m.common_ro()}
</Badge>
</div>
- </Card.Header>
- <Card.Content class="pt-0 space-y-4">
- <div class="space-y-2">
- <div class="text-muted-foreground text-xs font-semibold uppercase">
- {m.containers_mount_label_container()}
- </div>
- <div class="text-foreground overflow-hidden font-mono text-sm font-medium break-all select-all cursor-pointer" title="Click to select">
- {mount.destination}
- </div>
- </div>
- <div class="space-y-2">
- <div class="text-muted-foreground text-xs font-semibold uppercase">
- {mount.type === 'volume'
- ? m.containers_mount_label_volume()
- : mount.type === 'bind'
- ? m.containers_mount_label_host()
- : m.containers_mount_label_source()}
- </div>
- <div class="text-foreground overflow-hidden font-mono text-sm font-medium break-all select-all cursor-pointer" title="Click to select">
- {mount.source}
- </div>
+
+ <div class="grid grid-cols-1 gap-3 sm:grid-cols-2">
+ <Card.Root variant="outlined" class="sm:col-span-2">
+ <Card.Content class="flex flex-col p-3">
+ <div class="text-muted-foreground mb-2 text-xs font-semibold">
+ {m.containers_mount_label_container()}
+ </div>
+ <div
+ class="text-foreground cursor-pointer font-mono text-sm font-medium break-all select-all"
+ title="Click to select"
+ >
+ {mount.destination}
+ </div>
+ </Card.Content>
+ </Card.Root>
+
+ <Card.Root variant="outlined" class="sm:col-span-2">
+ <Card.Content class="flex flex-col p-3">
+ <div class="text-muted-foreground mb-2 text-xs font-semibold">
+ {mount.type === 'volume'
+ ? m.containers_mount_label_volume()
+ : mount.type === 'bind'
+ ? m.containers_mount_label_host()
+ : m.containers_mount_label_source()}
+ </div>
+ <div
+ class="text-foreground cursor-pointer font-mono text-sm font-medium break-all select-all"
+ title="Click to select"
+ >
+ {mount.source}
+ </div>
+ </Card.Content>
+ </Card.Root>
+
+ {#if mount.type === 'volume' && mount.driver}
+ <Card.Root variant="outlined">
+ <Card.Content class="flex flex-col p-3">
+ <div class="text-muted-foreground mb-2 text-xs font-semibold">Driver</div>
+ <div class="text-foreground text-sm font-medium">
+ {mount.driver}
+ </div>
+ </Card.Content>
+ </Card.Root>
+ {/if}
+
+ {#if mount.propagation}
+ <Card.Root variant="outlined">
+ <Card.Content class="flex flex-col p-3">
+ <div class="text-muted-foreground mb-2 text-xs font-semibold">Propagation</div>
+ <div class="text-foreground text-sm font-medium">
+ {mount.propagation}
+ </div>
+ </Card.Content>
+ </Card.Root>
+ {/if}
</div>
</Card.Content>
</Card.Root>
diff --git a/frontend/src/routes/containers/container-table.svelte b/frontend/src/routes/containers/container-table.svelte
index 62376d363..9609ad715 100644
--- a/frontend/src/routes/containers/container-table.svelte
+++ b/frontend/src/routes/containers/container-table.svelte
@@ -23,6 +23,11 @@
import type { ColumnSpec } from '$lib/components/arcane-table';
import { m } from '$lib/paraglide/messages';
import { PortBadge } from '$lib/components/badges/index.js';
+ import { UniversalMobileCard } from '$lib/components/arcane-table/index.js';
+ import BoxIcon from '@lucide/svelte/icons/box';
+ import ImageIcon from '@lucide/svelte/icons/image';
+ import NetworkIcon from '@lucide/svelte/icons/network';
+ import ClockIcon from '@lucide/svelte/icons/clock';
import { containerService } from '$lib/services/container-service';
let {
@@ -128,12 +133,23 @@
const columns = [
{ accessorKey: 'names', title: m.common_name(), sortable: true, cell: NameCell },
{ accessorKey: 'id', title: m.common_id(), cell: IdCell },
- { accessorKey: 'image', title: m.common_image(), sortable: true },
{ accessorKey: 'state', title: m.common_state(), sortable: true, cell: StateCell },
+ { accessorKey: 'image', title: m.common_image(), sortable: true },
{ accessorKey: 'status', title: m.common_status() },
{ accessorKey: 'ports', title: m.ports(), cell: PortsCell },
{ accessorKey: 'created', title: m.common_created(), sortable: true, cell: CreatedCell }
] satisfies ColumnSpec<ContainerSummaryDto>[];
+
+ const mobileFields = [
+ { id: 'id', label: m.common_id(), defaultVisible: true },
+ { id: 'state', label: m.common_state(), defaultVisible: true },
+ { id: 'image', label: m.common_image(), defaultVisible: true },
+ { id: 'status', label: m.common_status(), defaultVisible: true },
+ { id: 'ports', label: m.ports(), defaultVisible: true },
+ { id: 'created', label: m.common_created(), defaultVisible: true }
+ ];
+
+ let mobileFieldVisibility = $state<Record<string, boolean>>({});
</script>
{#snippet PortsCell({ item }: { item: ContainerSummaryDto })}
@@ -167,6 +183,86 @@
</span>
{/snippet}
+{#snippet ContainerMobileCardSnippet({
+ row,
+ item,
+ mobileFieldVisibility
+}: {
+ row: any;
+ item: ContainerSummaryDto;
+ mobileFieldVisibility: Record<string, boolean>;
+})}
+ <UniversalMobileCard
+ {item}
+ icon={(item) => {
+ const state = item.state;
+ return {
+ component: BoxIcon,
+ variant: state === 'running' ? 'emerald' : state === 'exited' ? 'red' : 'amber'
+ };
+ }}
+ title={(item) => {
+ if (item.names && item.names.length > 0) {
+ return item.names[0].startsWith('/') ? item.names[0].substring(1) : item.names[0];
+ }
+ return item.id.substring(0, 12);
+ }}
+ subtitle={(item) => ((mobileFieldVisibility.id ?? true) ? (item.id.length > 12 ? item.id : null) : null)}
+ badges={[
+ (item) =>
+ (mobileFieldVisibility.state ?? true)
+ ? {
+ variant: item.state === 'running' ? 'green' : item.state === 'exited' ? 'red' : 'amber',
+ text: capitalizeFirstLetter(item.state)
+ }
+ : null
+ ]}
+ fields={[
+ {
+ label: m.common_image(),
+ getValue: (item: ContainerSummaryDto) => item.image,
+ icon: ImageIcon,
+ iconVariant: 'blue' as const,
+ show: mobileFieldVisibility.image ?? true
+ },
+ {
+ label: m.common_status(),
+ getValue: (item: ContainerSummaryDto) => item.status,
+ icon: ClockIcon,
+ iconVariant: 'purple' as const,
+ show: (mobileFieldVisibility.status ?? true) && item.status !== undefined
+ },
+ ]}
+ footer={(mobileFieldVisibility.created ?? true)
+ ? {
+ label: m.common_created(),
+ getValue: (item) => format(new Date(item.created * 1000), 'PP p'),
+ icon: ClockIcon
+ }
+ : undefined}
+ rowActions={RowActions}
+ onclick={(item: ContainerSummaryDto) => goto(`/containers/${item.id}`)}
+ >
+ {#snippet children()}
+ {#if (mobileFieldVisibility.ports ?? true) && item.ports && item.ports.length > 0}
+ <div class="flex items-start gap-2.5 border-t pt-3">
+ <div class="flex size-7 shrink-0 items-center justify-center rounded-lg bg-sky-500/10">
+ <NetworkIcon class="size-3.5 text-sky-500" />
+ </div>
+ <div class="min-w-0 flex-1">
+ <div class="text-muted-foreground text-[10px] font-medium uppercase tracking-wide">
+ {m.ports()}
+ </div>
+ <div class="mt-1">
+ <PortBadge ports={item.ports} {baseServerUrl} />
+ </div>
+ </div>
+ </div>
+ {/if}
+ {/snippet}
+ </UniversalMobileCard>
+{/snippet}
+
{#snippet RowActions({ item }: { item: ContainerSummaryDto })}
<DropdownMenu.Root>
<DropdownMenu.Trigger>
@@ -235,16 +331,19 @@
</DropdownMenu.Root>
{/snippet}
-<Card.Root class="border shadow-sm">
- <Card.Content>
+<Card.Root class="flex flex-col gap-6 py-3">
+ <Card.Content class="px-6 py-5">
<ArcaneTable
persistKey="arcane-container-table"
items={containers}
bind:requestOptions
bind:selectedIds
+ bind:mobileFieldVisibility
onRefresh={async (options) => (containers = await containerService.getContainers(options))}
{columns}
+ {mobileFields}
rowActions={RowActions}
+ mobileCard={ContainerMobileCardSnippet}
selectionDisabled
/>
</Card.Content>
diff --git a/frontend/src/routes/customize/registries/+page.svelte b/frontend/src/routes/customize/registries/+page.svelte
index 3439311b9..3cc861fd2 100644
--- a/frontend/src/routes/customize/registries/+page.svelte
+++ b/frontend/src/routes/customize/registries/+page.svelte
@@ -97,8 +97,10 @@
<ResourcePageLayout title={m.registries_title()} subtitle={m.registries_subtitle()} {actionButtons}>
{#snippet mainContent()}
<div class="space-y-6">
- <Card.Root class="border shadow-sm">
- <Card.Header class="pb-4">
+ <Card.Root class="flex flex-col gap-6 border py-3 shadow-sm">
+ <Card.Header
+ class="@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 pb-4 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6"
+ >
<div class="flex items-center gap-3">
<div class="rounded-full bg-green-500/10 p-2">
<KeyIcon class="size-5 text-green-500" />
@@ -111,17 +113,19 @@
</div>
</div>
</Card.Header>
- <Card.Content>
+ <Card.Content class="px-6">
<RegistryTable bind:registries bind:selectedIds bind:requestOptions onEditRegistry={openEditRegistryDialog} />
</Card.Content>
</Card.Root>
- <Card.Root class="border shadow-sm">
- <Card.Header>
+ <Card.Root class="flex flex-col gap-6 border py-3 shadow-sm">
+ <Card.Header
+ class="@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6"
+ >
<Card.Title class="text-lg">{m.registries_info_title()}</Card.Title>
<Card.Description>{m.registries_info_description()}</Card.Description>
</Card.Header>
- <Card.Content>
+ <Card.Content class="px-6">
<div class="grid grid-cols-1 gap-4 md:grid-cols-2">
<div class="space-y-3">
<h4 class="text-sm font-medium">{m.registries_popular_public_title()}</h4>
diff --git a/frontend/src/routes/customize/registries/+page.ts b/frontend/src/routes/customize/registries/+page.ts
index 49fccbc3c..13b00473f 100644
--- a/frontend/src/routes/customize/registries/+page.ts
+++ b/frontend/src/routes/customize/registries/+page.ts
@@ -1,18 +1,19 @@
import { containerRegistryService } from '$lib/services/container-registry-service';
import type { SearchPaginationSortRequest } from '$lib/types/pagination.type';
+import { resolveInitialTableRequest } from '$lib/utils/table-persistence.util';
import type { PageLoad } from './$types';
export const load: PageLoad = async () => {
- const registryRequestOptions: SearchPaginationSortRequest = {
+ const registryRequestOptions = resolveInitialTableRequest('arcane-registries-table', {
pagination: {
page: 1,
limit: 20
},
sort: {
column: 'url',
- direction: 'asc' as const
+ direction: 'asc'
}
- };
+ } satisfies SearchPaginationSortRequest);
const registries = await containerRegistryService.getRegistries(registryRequestOptions);
diff --git a/frontend/src/routes/customize/registries/registry-table.svelte b/frontend/src/routes/customize/registries/registry-table.svelte
index 485037ca8..0ed77366a 100644
--- a/frontend/src/routes/customize/registries/registry-table.svelte
+++ b/frontend/src/routes/customize/registries/registry-table.svelte
@@ -14,6 +14,10 @@
import type { Paginated, SearchPaginationSortRequest } from '$lib/types/pagination.type';
import type { ContainerRegistry } from '$lib/types/container-registry.type';
import type { ColumnSpec } from '$lib/components/arcane-table';
+ import { UniversalMobileCard } from '$lib/components/arcane-table/index.js';
+ import PackageIcon from '@lucide/svelte/icons/package';
+ import UserIcon from '@lucide/svelte/icons/user';
+ import LinkIcon from '@lucide/svelte/icons/link';
import { format } from 'date-fns';
import { m } from '$lib/paraglide/messages';
import { containerRegistryService } from '$lib/services/container-registry-service';
@@ -158,6 +162,14 @@
cell: CreatedCell
}
] satisfies ColumnSpec<ContainerRegistry>[];
+
+ const mobileFields = [
+ { id: 'id', label: m.common_id(), defaultVisible: true },
+ { id: 'username', label: m.common_username(), defaultVisible: true },
+ { id: 'description', label: m.common_description(), defaultVisible: true }
+ ];
+
+ let mobileFieldVisibility = $state<Record<string, boolean>>({});
</script>
{#snippet UrlCell({ item }: { item: ContainerRegistry })}
@@ -184,6 +196,41 @@
<span class="text-sm">{value ? format(new Date(String(value)), 'PP p') : m.common_na()}</span>
{/snippet}
+{#snippet RegistryMobileCardSnippet({
+ row,
+ item,
+ mobileFieldVisibility
+}: {
+ row: any;
+ item: ContainerRegistry;
+ mobileFieldVisibility: Record<string, boolean>;
+})}
+ <UniversalMobileCard
+ {item}
+ icon={{ component: PackageIcon, variant: 'purple' as const }}
+ title={(item) => item.url}
+ subtitle={(item) => ((mobileFieldVisibility.id ?? true) ? item.id : null)}
+ badges={[{ variant: 'purple' as const, text: m.common_registry() }]}
+ fields={[
+ {
+ label: m.common_username(),
+ getValue: (item: ContainerRegistry) => item.username,
+ icon: UserIcon,
+ iconVariant: 'gray' as const,
+ show: (mobileFieldVisibility.username ?? true) && item.username !== undefined
+ },
+ {
+ label: m.common_description(),
+ getValue: (item: ContainerRegistry) => item.description,
+ icon: LinkIcon,
+ iconVariant: 'gray' as const,
+ show: (mobileFieldVisibility.description ?? true) && item.description !== undefined
+ }
+ ]}
+ rowActions={RowActions}
+ />
+{/snippet}
+
{#snippet RowActions({ item }: { item: ContainerRegistry })}
<DropdownMenu.Root>
<DropdownMenu.Trigger>
@@ -215,12 +262,16 @@
<div>
<ArcaneTable
+ persistKey="arcane-registries-table"
items={registries}
bind:requestOptions
bind:selectedIds
+ bind:mobileFieldVisibility
onRemoveSelected={(ids) => handleDeleteSelected(ids)}
onRefresh={async (options) => (registries = await containerRegistryService.getRegistries(options))}
{columns}
+ {mobileFields}
rowActions={RowActions}
+ mobileCard={RegistryMobileCardSnippet}
/>
</div>
diff --git a/frontend/src/routes/dashboard/dash-container-table.svelte b/frontend/src/routes/dashboard/dash-container-table.svelte
index ed2c2bcdb..a0719ca2b 100644
--- a/frontend/src/routes/dashboard/dash-container-table.svelte
+++ b/frontend/src/routes/dashboard/dash-container-table.svelte
@@ -4,6 +4,8 @@
import ArrowRightIcon from '@lucide/svelte/icons/arrow-right';
import * as Card from '$lib/components/ui/card/index.js';
import StatusBadge from '$lib/components/badges/status-badge.svelte';
+ import { UniversalMobileCard } from '$lib/components/arcane-table/index.js';
+ import BoxIcon from '@lucide/svelte/icons/box';
import { getStatusVariant } from '$lib/utils/status.utils';
import { capitalizeFirstLetter } from '$lib/utils/string.utils';
import type { SearchPaginationSortRequest, Paginated } from '$lib/types/pagination.type';
@@ -11,6 +13,7 @@
import type { ColumnSpec } from '$lib/components/arcane-table';
import { m } from '$lib/paraglide/messages';
import { containerService } from '$lib/services/container-service';
+ import { goto } from '$app/navigation';
let {
containers = $bindable(),
@@ -50,38 +53,70 @@
<StatusBadge variant={stateVariant} text={capitalizeFirstLetter(item.state)} />
{/snippet}
-<Card.Root class="relative flex flex-col rounded-lg border shadow-sm">
- <Card.Header class="px-6 pb-3 pt-5">
- <div class="flex items-center justify-between">
- <div>
- <Card.Title>
- <a class="font-medium hover:underline" href="/containers">{m.containers_title()}</a>
- </Card.Title>
- <Card.Description class="pb-2">{m.containers_recent()}</Card.Description>
- </div>
- <Button variant="ghost" size="sm" href="/containers" disabled={isLoading}>
- {m.common_view_all()}
- <ArrowRightIcon class="ml-2 size-4" />
- </Button>
+{#snippet DashContainerMobileCard({ row, item }: { row: any; item: ContainerSummaryDto })}
+ <UniversalMobileCard
+ {item}
+ icon={(item) => {
+ const state = item.state;
+ return {
+ component: BoxIcon,
+ variant: state === 'running' ? 'emerald' : state === 'exited' ? 'red' : 'amber'
+ };
+ }}
+ title={(item) => {
+ if (item.names && item.names.length > 0) {
+ return item.names[0].startsWith('/') ? item.names[0].substring(1) : item.names[0];
+ }
+ return item.id.substring(0, 12);
+ }}
+ badges={[
+ (item: ContainerSummaryDto) => ({
+ variant: item.state === 'running' ? 'green' : item.state === 'exited' ? 'red' : 'amber',
+ text: capitalizeFirstLetter(item.state)
+ })
+ ]}
+ fields={[
+ {
+ label: m.common_status(),
+ getValue: (item: ContainerSummaryDto) => item.status,
+ show: item.status !== undefined
+ }
+ ]}
+ compact
+ class="mx-2"
+ onclick={(item: ContainerSummaryDto) => goto(`/containers/${item.id}`)}
+ />
+{/snippet}
+
+<Card.Root class="pb-2">
+ <Card.Header class="flex items-center justify-between p-4">
+ <div>
+ <Card.Title>
+ {m.containers_title()}
+ </Card.Title>
+ <Card.Description>{m.containers_recent()}</Card.Description>
</div>
+ <Button variant="ghost" size="sm" href="/containers" disabled={isLoading}>
+ {m.common_view_all()}
+ <ArrowRightIcon class="ml-2 size-4" />
+ </Button>
</Card.Header>
- <Card.Content class="flex-1 p-0">
- <div class="flex h-full flex-col">
- <ArcaneTable
- items={containers}
- bind:requestOptions
- bind:selectedIds
- onRefresh={async (options) => (containers = await containerService.getContainers(options))}
- withoutSearch={true}
- withoutPagination={true}
- selectionDisabled={true}
- {columns}
- />
- {#if containers.data.length > 5}
- <div class="bg-muted/40 text-muted-foreground border-t px-6 py-2 text-xs">
- {m.containers_showing_of_total({ shown: 5, total: containers.pagination.totalItems })}
- </div>
- {/if}
- </div>
+ <Card.Content class="p-0 pt-2">
+ <ArcaneTable
+ items={containers}
+ bind:requestOptions
+ bind:selectedIds
+ onRefresh={async (options) => (containers = await containerService.getContainers(options))}
+ withoutSearch={true}
+ withoutPagination={true}
+ selectionDisabled={true}
+ {columns}
+ mobileCard={DashContainerMobileCard}
+ />
+ {#if containers.data.length > 5}
+ <div class="bg-muted/40 text-muted-foreground border-t px-6 py-3 text-xs">
+ {m.containers_showing_of_total({ shown: 5, total: containers.pagination.totalItems })}
+ </div>
+ {/if}
</Card.Content>
</Card.Root>
diff --git a/frontend/src/routes/dashboard/dash-image-table.svelte b/frontend/src/routes/dashboard/dash-image-table.svelte
index 3ef532eba..f16a1f89f 100644
--- a/frontend/src/routes/dashboard/dash-image-table.svelte
+++ b/frontend/src/routes/dashboard/dash-image-table.svelte
@@ -8,8 +8,11 @@
import type { ImageSummaryDto } from '$lib/types/image.type';
import bytes from 'bytes';
import type { ColumnSpec } from '$lib/components/arcane-table';
+ import { UniversalMobileCard } from '$lib/components/arcane-table';
import { m } from '$lib/paraglide/messages';
import { imageService } from '$lib/services/image-service';
+ import { goto } from '$app/navigation';
+ import HardDriveIcon from '@lucide/svelte/icons/hard-drive';
let {
images = $bindable(),
@@ -38,8 +41,8 @@
<div class="flex items-center gap-2">
<div class="flex flex-1 items-center">
<a class="shrink truncate font-medium hover:underline" href="/images/{item.id}">
- {#if item.repoTags && item.repoTags.length > 0 && item.repoTags[0] !== '<none>:<none>'}
- {item.repoTags[0].split(':')[0]}
+ {#if item.repo && item.repo !== '<none>'}
+ {item.repo}
{:else}
<span class="text-muted-foreground italic">{m.images_untagged()}</span>
{/if}
@@ -57,8 +60,8 @@
{/snippet}
{#snippet TagCell({ item }: { item: ImageSummaryDto })}
- {#if item.repoTags && item.repoTags.length > 0 && item.repoTags[0] !== '<none>:<none>'}
- {item.repoTags[0].split(':')[1] || m.images_tag_latest()}
+ {#if item.tag && item.tag !== '<none>'}
+ {item.tag}
{:else}
<span class="text-muted-foreground italic">{m.images_none_label()}</span>
{/if}
@@ -68,40 +71,64 @@
{bytes.format(item.size)}
{/snippet}
-<Card.Root class="relative flex flex-col rounded-lg border shadow-sm">
- <Card.Header class="px-6 pb-3 pt-5">
- <div class="flex items-center justify-between">
- <div>
- <Card.Title>
- <a class="font-medium hover:underline" href="/images">{m.images_title()}</a>
- </Card.Title>
- <Card.Description class="pb-2">{m.images_top_largest()}</Card.Description>
- </div>
- <div class="flex items-center gap-3">
- <Button variant="ghost" size="sm" href="/images" disabled={isLoading}>
- {m.common_view_all()}
- <ArrowRightIcon class="ml-2 size-4" />
- </Button>
- </div>
+{#snippet DashImageMobileCard({ row, item }: { row: any; item: ImageSummaryDto })}
+ <UniversalMobileCard
+ {item}
+ icon={(item: ImageSummaryDto) => ({
+ component: HardDriveIcon,
+ variant: item.inUse ? 'emerald' : 'amber'
+ })}
+ title={(item: ImageSummaryDto) => {
+ if (item.repo && item.repo !== '<none>') {
+ return item.repo;
+ }
+ return m.images_untagged();
+ }}
+ badges={[
+ (item: ImageSummaryDto) =>
+ item.inUse ? { variant: 'green', text: m.common_in_use() } : { variant: 'amber', text: m.common_unused() }
+ ]}
+ fields={[
+ {
+ label: m.images_size(),
+ getValue: (item: ImageSummaryDto) => bytes.format(item.size),
+ }
+ ]}
+ compact
+ class="mx-2"
+ onclick={(item: ImageSummaryDto) => goto(`/images/${item.id}`)}
+ />
+{/snippet}
+
+<Card.Root class="pb-2">
+ <Card.Header class="flex items-center justify-between p-4">
+ <div>
+ <Card.Title>
+ <a class="font-medium hover:underline" href="/images">{m.images_title()}</a>
+ </Card.Title>
+ <Card.Description>{m.images_top_largest()}</Card.Description>
</div>
+ <Button variant="ghost" size="sm" href="/images" disabled={isLoading}>
+ {m.common_view_all()}
+ <ArrowRightIcon class="ml-2 size-4" />
+ </Button>
</Card.Header>
- <Card.Content class="flex-1 p-0">
- <div class="flex h-full flex-col">
- <ArcaneTable
- items={images}
- bind:requestOptions
- bind:selectedIds
- onRefresh={async (options) => (images = await imageService.getImages(options))}
- withoutSearch={true}
- selectionDisabled={true}
- withoutPagination={true}
- {columns}
- />
- {#if images.data.length > 5}
- <div class="bg-muted/40 text-muted-foreground border-t px-6 py-2 text-xs">
- {m.images_showing_of_total({ shown: 5, total: images.pagination.totalItems })}
- </div>
- {/if}
- </div>
+ <Card.Content class="p-0 pt-2">
+ <ArcaneTable
+ items={images}
+ bind:requestOptions
+ bind:selectedIds
+ onRefresh={async (options) => (images = await imageService.getImages(options))}
+ withoutSearch={true}
+ selectionDisabled={true}
+ withoutPagination={true}
+ {columns}
+ mobileCard={DashImageMobileCard}
+ />
+ {#if images.data.length > 5}
+ <div class="bg-muted/40 text-muted-foreground border-t px-6 py-3 text-xs">
+ {m.images_showing_of_total({ shown: 5, total: images.pagination.totalItems })}
+ </div>
+ {/if}
</Card.Content>
</Card.Root>
diff --git a/frontend/src/routes/environments/+page.ts b/frontend/src/routes/environments/+page.ts
index 15c1fe60e..f8874a7cb 100644
--- a/frontend/src/routes/environments/+page.ts
+++ b/frontend/src/routes/environments/+page.ts
@@ -1,18 +1,19 @@
import type { PageLoad } from './$types';
import type { SearchPaginationSortRequest } from '$lib/types/pagination.type';
import { environmentManagementService } from '$lib/services/env-mgmt-service';
+import { resolveInitialTableRequest } from '$lib/utils/table-persistence.util';
export const load: PageLoad = async () => {
- const environmentRequestOptions: SearchPaginationSortRequest = {
+ const environmentRequestOptions = resolveInitialTableRequest('arcane-environments-table', {
pagination: {
page: 1,
limit: 20
},
sort: {
column: 'timestamp',
- direction: 'desc' as const
+ direction: 'desc'
}
- };
+ } satisfies SearchPaginationSortRequest);
const environments = await environmentManagementService.getEnvironments(environmentRequestOptions);
diff --git a/frontend/src/routes/environments/[id]/+page.svelte b/frontend/src/routes/environments/[id]/+page.svelte
index 0295c50be..2fee2e6c9 100644
--- a/frontend/src/routes/environments/[id]/+page.svelte
+++ b/frontend/src/routes/environments/[id]/+page.svelte
@@ -154,11 +154,13 @@
<div class="grid grid-cols-1 gap-6 lg:grid-cols-4">
<div class="lg:col-span-1">
- <Card.Root>
- <Card.Header>
+ <Card.Root class="flex flex-col gap-6 py-3">
+ <Card.Header
+ class="@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6"
+ >
<Card.Title class="text-lg">{m.environments_sections_title()}</Card.Title>
</Card.Header>
- <Card.Content class="p-0">
+ <Card.Content class="p-0 px-6">
<nav class="space-y-1">
{#each sections as section}
{@const Icon = section.icon}
@@ -181,14 +183,16 @@
<div class="lg:col-span-3">
{#if activeSection === 'overview'}
<div class="space-y-6">
- <Card.Root>
- <Card.Header>
+ <Card.Root class="flex flex-col gap-6 py-3">
+ <Card.Header
+ class="@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6"
+ >
<Card.Title class="flex items-center gap-2">
<MonitorIcon class="size-5" />
{m.environments_overview_title()}
</Card.Title>
</Card.Header>
- <Card.Content class="space-y-6">
+ <Card.Content class="space-y-6 px-6">
<div class="grid grid-cols-1 gap-6 md:grid-cols-2">
<div class="space-y-4">
<div>
@@ -394,21 +398,23 @@
</div>
{:else if activeSection === 'connection'}
<div class="space-y-6">
- <Card.Root>
- <Card.Header>
+ <Card.Root class="flex flex-col gap-6 py-3">
+ <Card.Header
+ class="@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6"
+ >
<Card.Title class="flex items-center gap-2">
<GlobeIcon class="h-5 w-5" />
{m.environments_connection_title()}
</Card.Title>
</Card.Header>
- <Card.Content class="space-y-4">
+ <Card.Content class="space-y-4 px-6">
<div>
<Label class="text-muted-foreground text-sm font-medium">{m.common_name()}</Label>
<div class="mt-1 text-sm">{environmentDisplayName()}</div>
</div>
<div>
<Label class="text-muted-foreground text-sm font-medium">{m.environments_api_url()}</Label>
- <div class="bg-muted mt-1 break-all rounded-md px-3 py-2 font-mono text-sm">{environment.apiUrl}</div>
+ <div class="bg-muted mt-1 rounded-md px-3 py-2 font-mono text-sm break-all">{environment.apiUrl}</div>
</div>
<div class="pt-4">
<Button onclick={testConnection} disabled={isTestingConnection} class="w-full">
@@ -426,8 +432,10 @@
</div>
{:else if activeSection === 'pairing'}
<div class="space-y-6">
- <Card.Root>
- <Card.Header>
+ <Card.Root class="flex flex-col gap-6 py-3">
+ <Card.Header
+ class="@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6"
+ >
<Card.Title class="flex items-center gap-2">
<SettingsIcon class="h-5 w-5" />
{m.environments_pair_rotate_title()}
@@ -436,7 +444,7 @@
{m.environments_pair_rotate_description()}
</Card.Description>
</Card.Header>
- <Card.Content class="space-y-4">
+ <Card.Content class="space-y-4 px-6">
<div>
<Label class="text-muted-foreground text-sm font-medium">{m.environments_bootstrap_label()}</Label>
<input
@@ -465,7 +473,7 @@
</div>
{#if isRefreshing}
- <div class="fixed bottom-4 right-4 flex items-center gap-2 rounded-lg bg-blue-600 px-3 py-2 text-white shadow-lg">
+ <div class="fixed right-4 bottom-4 flex items-center gap-2 rounded-lg bg-blue-600 px-3 py-2 text-white shadow-lg">
<RefreshCwIcon class="h-4 w-4 animate-spin" />
<span class="text-sm">{m.environments_refreshing()}</span>
</div>
diff --git a/frontend/src/routes/environments/environment-table.svelte b/frontend/src/routes/environments/environment-table.svelte
index b966dca09..d188d8e72 100644
--- a/frontend/src/routes/environments/environment-table.svelte
+++ b/frontend/src/routes/environments/environment-table.svelte
@@ -16,9 +16,11 @@
import { toast } from 'svelte-sonner';
import type { Paginated, SearchPaginationSortRequest } from '$lib/types/pagination.type';
import type { ColumnSpec } from '$lib/components/arcane-table';
+ import { UniversalMobileCard } from '$lib/components/arcane-table';
import type { Environment } from '$lib/types/environment.type';
import { m } from '$lib/paraglide/messages';
import { environmentManagementService } from '$lib/services/env-mgmt-service';
+ import CloudIcon from '@lucide/svelte/icons/cloud';
let {
environments = $bindable(),
@@ -139,18 +141,25 @@
sortable: true,
cell: StatusCell
},
- {
- accessorKey: 'apiUrl',
- title: m.environments_api_url(),
- cell: ApiCell
- },
{
accessorKey: 'enabled',
title: m.common_enabled(),
sortable: true,
cell: EnabledCell
+ },
+ {
+ accessorKey: 'apiUrl',
+ title: m.environments_api_url(),
+ cell: ApiCell
}
] satisfies ColumnSpec<Environment>[];
+
+ const mobileFields = [
+ { id: 'id', label: m.common_id(), defaultVisible: true },
+ { id: 'apiUrl', label: m.environments_api_url(), defaultVisible: true }
+ ];
+
+ let mobileFieldVisibility = $state<Record<string, boolean>>({});
</script>
{#snippet EnvironmentCell({ item }: { item: Environment })}
@@ -184,6 +193,34 @@
<StatusBadge text={Boolean(value) ? 'Enabled' : 'Disabled'} variant={Boolean(value) ? 'green' : 'gray'} />
{/snippet}
+{#snippet EnvironmentMobileCardSnippet({
+ row,
+ item,
+ mobileFieldVisibility
+}: {
+ row: any;
+ item: Environment;
+ mobileFieldVisibility: Record<string, boolean>;
+})}
+ <UniversalMobileCard
+ {item}
+ icon={{ component: CloudIcon, variant: 'emerald' }}
+ title={(item: Environment) => item.name || item.id}
+ subtitle={(item: Environment) => ((mobileFieldVisibility.id ?? true) ? item.id : null)}
+ badges={[{ variant: 'green', text: m.sidebar_environment_label() }]}
+ fields={[
+ {
+ label: m.environments_api_url(),
+ getValue: (item: Environment) => item.apiUrl,
+ icon: CloudIcon,
+ iconVariant: 'gray' as const,
+ show: (mobileFieldVisibility.apiUrl ?? true) && !!item.apiUrl
+ }
+ ]}
+ rowActions={RowActions}
+ />
+{/snippet}
+
{#snippet RowActions({ item }: { item: Environment })}
<DropdownMenu.Root>
<DropdownMenu.Trigger>
@@ -218,18 +255,20 @@
</DropdownMenu.Root>
{/snippet}
-<div>
- <Card.Root>
- <Card.Content class="py-5">
- <ArcaneTable
- items={environments}
- bind:requestOptions
- bind:selectedIds
- onRemoveSelected={(ids) => handleDeleteSelected(ids)}
- onRefresh={async (options) => (environments = await environmentManagementService.getEnvironments(options))}
- {columns}
- rowActions={RowActions}
- />
- </Card.Content>
- </Card.Root>
-</div>
+<Card.Root class="flex flex-col gap-6 py-3">
+ <Card.Content class="px-6 py-5">
+ <ArcaneTable
+ persistKey="arcane-environments-table"
+ items={environments}
+ bind:requestOptions
+ bind:selectedIds
+ bind:mobileFieldVisibility
+ onRemoveSelected={(ids) => handleDeleteSelected(ids)}
+ onRefresh={async (options) => (environments = await environmentManagementService.getEnvironments(options))}
+ {columns}
+ {mobileFields}
+ rowActions={RowActions}
+ mobileCard={EnvironmentMobileCardSnippet}
+ />
+ </Card.Content>
+</Card.Root>
diff --git a/frontend/src/routes/events/+page.ts b/frontend/src/routes/events/+page.ts
index 7cc153dd2..19ce2ba72 100644
--- a/frontend/src/routes/events/+page.ts
+++ b/frontend/src/routes/events/+page.ts
@@ -1,18 +1,19 @@
import { eventService } from '$lib/services/event-service';
import type { SearchPaginationSortRequest } from '$lib/types/pagination.type';
+import { resolveInitialTableRequest } from '$lib/utils/table-persistence.util';
import type { PageLoad } from './$types';
export const load: PageLoad = async () => {
- const eventRequestOptions: SearchPaginationSortRequest = {
+ const eventRequestOptions = resolveInitialTableRequest('arcane-events-table', {
pagination: {
page: 1,
limit: 20
},
sort: {
column: 'timestamp',
- direction: 'desc' as const
+ direction: 'desc'
}
- };
+ } satisfies SearchPaginationSortRequest);
const events = await eventService.getEvents(eventRequestOptions);
diff --git a/frontend/src/routes/events/event-table.svelte b/frontend/src/routes/events/event-table.svelte
index 15f7024e2..c10af29e9 100644
--- a/frontend/src/routes/events/event-table.svelte
+++ b/frontend/src/routes/events/event-table.svelte
@@ -15,10 +15,15 @@
import type { Paginated, SearchPaginationSortRequest } from '$lib/types/pagination.type';
import type { Event } from '$lib/types/event.type';
import type { ColumnSpec } from '$lib/components/arcane-table';
+ import { UniversalMobileCard } from '$lib/components/arcane-table';
import EventDetailsDialog from '$lib/components/dialogs/event-details-dialog.svelte';
import InfoIcon from '@lucide/svelte/icons/info';
import { m } from '$lib/paraglide/messages';
import { eventService } from '$lib/services/event-service';
+ import BellIcon from '@lucide/svelte/icons/bell';
+ import TagIcon from '@lucide/svelte/icons/tag';
+ import ServerIcon from '@lucide/svelte/icons/server';
+ import UserIcon from '@lucide/svelte/icons/user';
let {
events = $bindable(),
@@ -48,6 +53,14 @@
}
}
+ function getIconVariant(severity: string): 'emerald' | 'red' | 'amber' | 'blue' {
+ const variant = getSeverityBadgeVariant(severity);
+ if (variant === 'green') return 'emerald';
+ if (variant === 'red') return 'red';
+ if (variant === 'amber') return 'amber';
+ return 'blue';
+ }
+
function formatTimestamp(timestamp: string) {
const date = new Date(timestamp);
return formatDistanceToNow(date, { addSuffix: true });
@@ -113,6 +126,16 @@
cell: TimeCell
}
] satisfies ColumnSpec<Event>[];
+
+ const mobileFields = [
+ { id: 'severity', label: m.events_col_severity(), defaultVisible: true },
+ { id: 'type', label: m.events_col_type(), defaultVisible: true },
+ { id: 'resource', label: m.events_col_resource(), defaultVisible: true },
+ { id: 'username', label: m.common_user(), defaultVisible: true },
+ { id: 'timestamp', label: m.events_col_time(), defaultVisible: true }
+ ];
+
+ let mobileFieldVisibility = $state<Record<string, boolean>>({});
</script>
{#snippet SeverityCell({ value }: { value: unknown })}
@@ -148,6 +171,64 @@
<span class="text-sm">{formatTimestamp(String(value ?? new Date().toISOString()))}</span>
{/snippet}
+{#snippet EventMobileCardSnippet({
+ row,
+ item,
+ mobileFieldVisibility
+}: {
+ row: any;
+ item: Event;
+ mobileFieldVisibility: Record<string, boolean>;
+})}
+ <UniversalMobileCard
+ {item}
+ icon={(item: Event) => ({
+ component: BellIcon,
+ variant: getIconVariant(item.severity)
+ })}
+ title={(item: Event) => item.title}
+ subtitle={(item: Event) => ((mobileFieldVisibility.timestamp ?? true) ? formatTimestamp(item.timestamp) : null)}
+ badges={[
+ (item: Event) =>
+ (mobileFieldVisibility.severity ?? true)
+ ? {
+ variant: getSeverityBadgeVariant(item.severity),
+ text: item.severity
+ }
+ : null
+ ]}
+ fields={[
+ {
+ label: m.events_col_type(),
+ getValue: (item: Event) => item.type,
+ icon: TagIcon,
+ iconVariant: 'gray' as const,
+ show: mobileFieldVisibility.type ?? true
+ },
+ {
+ label: m.events_col_resource(),
+ getValue: (item: Event) => {
+ if (!item.resourceType && !item.resourceName) return null;
+ const parts = [item.resourceType || '-'];
+ if (item.resourceName) parts.push(item.resourceName);
+ return parts.join(' - ');
+ },
+ icon: ServerIcon,
+ iconVariant: 'gray' as const,
+ show: (mobileFieldVisibility.resource ?? true) && (!!item.resourceType || !!item.resourceName)
+ },
+ {
+ label: m.common_user(),
+ getValue: (item: Event) => item.username,
+ icon: UserIcon,
+ iconVariant: 'gray' as const,
+ show: (mobileFieldVisibility.username ?? true) && !!item.username
+ }
+ ]}
+ rowActions={RowActions}
+ />
+{/snippet}
+
{#snippet RowActions({ item }: { item: Event })}
<DropdownMenu.Root>
<DropdownMenu.Trigger>
@@ -177,19 +258,21 @@
</DropdownMenu.Root>
{/snippet}
-<div>
- <Card.Root>
- <Card.Content class="py-5">
- <ArcaneTable
- items={events}
- bind:requestOptions
- bind:selectedIds
- onRefresh={async (options) => (events = await eventService.getEvents(options))}
- {columns}
- rowActions={RowActions}
- />
- </Card.Content>
- </Card.Root>
-</div>
+<Card.Root class="flex flex-col gap-6 py-3">
+ <Card.Content class="px-6 py-5">
+ <ArcaneTable
+ persistKey="arcane-events-table"
+ items={events}
+ bind:requestOptions
+ bind:selectedIds
+ bind:mobileFieldVisibility
+ onRefresh={async (options) => (events = await eventService.getEvents(options))}
+ {columns}
+ {mobileFields}
+ rowActions={RowActions}
+ mobileCard={EventMobileCardSnippet}
+ />
+ </Card.Content>
+</Card.Root>
<EventDetailsDialog bind:open={detailsOpen} event={detailsEvent} />
diff --git a/frontend/src/routes/images/+page.ts b/frontend/src/routes/images/+page.ts
index c81e07694..53c08a3db 100644
--- a/frontend/src/routes/images/+page.ts
+++ b/frontend/src/routes/images/+page.ts
@@ -1,22 +1,25 @@
import { imageService } from '$lib/services/image-service';
import { settingsService } from '$lib/services/settings-service';
import type { SearchPaginationSortRequest } from '$lib/types/pagination.type';
+import { resolveInitialTableRequest } from '$lib/utils/table-persistence.util';
import type { PageLoad } from './$types';
export const load: PageLoad = async () => {
- const imageRequestOptions: SearchPaginationSortRequest = {
+ const imageRequestOptions = resolveInitialTableRequest('arcane-image-table', {
pagination: {
page: 1,
limit: 20
},
sort: {
column: 'created',
- direction: 'desc' as const
+ direction: 'desc'
}
- };
- const images = await imageService.getImages(imageRequestOptions);
- const settings = await settingsService.getSettings();
- const imageUsageCounts = await imageService.getImageUsageCounts();
+ } satisfies SearchPaginationSortRequest);
+ const [images, settings, imageUsageCounts] = await Promise.all([
+ imageService.getImages(imageRequestOptions),
+ settingsService.getSettings(),
+ imageService.getImageUsageCounts()
+ ]);
return { images, imageRequestOptions, settings, imageUsageCounts };
};
diff --git a/frontend/src/routes/images/[imageId]/+page.svelte b/frontend/src/routes/images/[imageId]/+page.svelte
index 11a26d294..b6ea2046b 100644
--- a/frontend/src/routes/images/[imageId]/+page.svelte
+++ b/frontend/src/routes/images/[imageId]/+page.svelte
@@ -1,5 +1,5 @@
<script lang="ts">
- import * as Card from '$lib/components/ui/card/index.js';
+ import * as Card from '$lib/components/ui/card';
import HardDriveIcon from '@lucide/svelte/icons/hard-drive';
import ClockIcon from '@lucide/svelte/icons/clock';
import TagIcon from '@lucide/svelte/icons/tag';
@@ -8,17 +8,17 @@
import CpuIcon from '@lucide/svelte/icons/cpu';
import InfoIcon from '@lucide/svelte/icons/info';
import SettingsIcon from '@lucide/svelte/icons/settings';
- import * as Breadcrumb from '$lib/components/ui/breadcrumb/index.js';
+ import * as Breadcrumb from '$lib/components/ui/breadcrumb';
import { goto } from '$app/navigation';
- import { Separator } from '$lib/components/ui/separator/index.js';
- import { Badge } from '$lib/components/ui/badge/index.js';
+ import { Separator } from '$lib/components/ui/separator';
+ import { Badge } from '$lib/components/ui/badge';
import { format } from 'date-fns';
import bytes from 'bytes';
import { openConfirmDialog } from '$lib/components/confirm-dialog';
import { handleApiResultWithCallbacks } from '$lib/utils/api.util';
import { tryCatch } from '$lib/utils/try-catch';
import { toast } from 'svelte-sonner';
- import { ArcaneButton } from '$lib/components/arcane-button/index.js';
+ import { ArcaneButton } from '$lib/components/arcane-button';
import { m } from '$lib/paraglide/messages';
import { imageService } from '$lib/services/image-service.js';
@@ -105,13 +105,12 @@
{#if image}
<div class="space-y-6">
- <Card.Root class="pt-0">
- <Card.Header class="bg-muted rounded-t-xl p-4">
- <Card.Title class="flex items-center gap-2 text-lg">
- <InfoIcon class="text-primary size-5" />
- {m.images_details_title()}
- </Card.Title>
- <Card.Description>{m.images_details_description()}</Card.Description>
+ <Card.Root>
+ <Card.Header icon={InfoIcon}>
+ <div class="flex flex-col space-y-1.5">
+ <Card.Title>{m.images_details_title()}</Card.Title>
+ <Card.Description>{m.images_details_description()}</Card.Description>
+ </div>
</Card.Header>
<Card.Content class="p-4">
<div class="grid grid-cols-1 gap-x-4 gap-y-6 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-6">
@@ -227,13 +226,12 @@
</Card.Root>
{#if image.repoTags && image.repoTags.length > 0}
- <Card.Root class="pt-0">
- <Card.Header class="bg-muted rounded-t-xl p-4">
- <Card.Title class="flex items-center gap-2 text-lg">
- <TagIcon class="text-primary size-5" />
- {m.images_tags_title()}
- </Card.Title>
- <Card.Description>{m.images_tags_description()}</Card.Description>
+ <Card.Root>
+ <Card.Header icon={TagIcon}>
+ <div class="flex flex-col space-y-1.5">
+ <Card.Title>{m.images_tags_title()}</Card.Title>
+ <Card.Description>{m.images_tags_description()}</Card.Description>
+ </div>
</Card.Header>
<Card.Content class="p-4">
<div class="flex flex-wrap gap-2">
@@ -246,29 +244,45 @@
{/if}
{#if image.config?.env && image.config.env.length > 0}
- <Card.Root class="pt-0">
- <Card.Header class="bg-muted rounded-t-xl p-4">
- <Card.Title class="flex items-center gap-2 text-lg">
- <SettingsIcon class="text-primary size-5" />
- {m.images_env_vars_title()}
- </Card.Title>
- <Card.Description>{m.images_env_vars_description()}</Card.Description>
+ <Card.Root>
+ <Card.Header icon={SettingsIcon}>
+ <div class="flex flex-col space-y-1.5">
+ <Card.Title>{m.images_env_vars_title()}</Card.Title>
+ <Card.Description>{m.images_env_vars_description()}</Card.Description>
+ </div>
</Card.Header>
- <Card.Content class="space-y-2 p-4">
- {#each image.config.env as env (env)}
- {@const [key, ...valueParts] = env.split('=')}
- {@const value = valueParts.join('=')}
- <div class="flex flex-col text-sm sm:flex-row sm:items-center">
- <span class="text-muted-foreground w-full font-medium break-all sm:w-1/4">{key}:</span>
- <span
- class="w-full cursor-pointer font-mono text-xs break-all select-all sm:w-3/4 sm:text-sm"
- title="Click to select">{value}</span
- >
- </div>
- {#if env !== image.config.env[image.config.env.length - 1]}
- <Separator class="my-2" />
- {/if}
- {/each}
+ <Card.Content class="p-4">
+ <div class="grid grid-cols-1 gap-3 lg:grid-cols-2 2xl:grid-cols-3">
+ {#each image.config.env as env (env)}
+ {#if env.includes('=')}
+ {@const [key, ...valueParts] = env.split('=')}
+ {@const value = valueParts.join('=')}
+ <Card.Root variant="subtle">
+ <Card.Content class="flex flex-col gap-2 p-4">
+ <div class="text-muted-foreground text-xs font-semibold tracking-wide break-all uppercase">{key}</div>
+ <div
+ class="text-foreground cursor-pointer font-mono text-sm font-medium break-all select-all"
+ title="Click to select"
+ >
+ {value}
+ </div>
+ </Card.Content>
+ </Card.Root>
+ {:else}
+ <Card.Root variant="subtle">
+ <Card.Content class="flex flex-col gap-2 p-4">
+ <div class="text-muted-foreground text-xs font-semibold tracking-wide uppercase">ENV_VAR</div>
+ <div
+ class="text-foreground cursor-pointer font-mono text-sm font-medium break-all select-all"
+ title="Click to select"
+ >
+ {env}
+ </div>
+ </Card.Content>
+ </Card.Root>
+ {/if}
+ {/each}
+ </div>
</Card.Content>
</Card.Root>
{/if}
diff --git a/frontend/src/routes/images/image-table.svelte b/frontend/src/routes/images/image-table.svelte
index ac3a776f0..d8fdb36b5 100644
--- a/frontend/src/routes/images/image-table.svelte
+++ b/frontend/src/routes/images/image-table.svelte
@@ -16,6 +16,10 @@
import { handleApiResultWithCallbacks } from '$lib/utils/api.util';
import { tryCatch } from '$lib/utils/try-catch';
import ImageUpdateItem from '$lib/components/image-update-item.svelte';
+ import UniversalMobileCard from '$lib/components/arcane-table/cards/universal-mobile-card.svelte';
+ import ImageIcon from '@lucide/svelte/icons/image';
+ import HardDriveIcon from '@lucide/svelte/icons/hard-drive';
+ import ClockIcon from '@lucide/svelte/icons/clock';
import type { Paginated, SearchPaginationSortRequest } from '$lib/types/pagination.type';
import type { ImageSummaryDto, ImageUpdateInfoDto } from '$lib/types/image.type';
import { format } from 'date-fns';
@@ -137,20 +141,6 @@
isPullingInline[imageId] = false;
}
- function extractRepoAndTag(repoTags: string[] | undefined) {
- if (!repoTags || repoTags.length === 0 || repoTags[0] === '<none>:<none>') {
- return { repo: '<none>', tag: '<none>' };
- }
-
- const repoTag = repoTags[0];
- const lastColonIndex = repoTag.lastIndexOf(':');
- if (lastColonIndex === -1) return { repo: repoTag, tag: 'latest' };
-
- const repo = repoTag.substring(0, lastColonIndex);
- const tag = repoTag.substring(lastColonIndex + 1);
- return { repo: repo || '<none>', tag: tag || '<none>' };
- }
-
async function handleUpdateInfoChanged(imageId: string, newUpdateInfo: ImageUpdateInfoDto) {
const imageIndex = images.data.findIndex((img) => img.id === imageId);
if (imageIndex !== -1) {
@@ -162,22 +152,33 @@
const columns = [
{ accessorKey: 'id', title: m.common_id(), hidden: true },
- { accessorKey: 'repoTags', title: m.images_repository(), sortable: true, cell: RepoCell },
- { accessorKey: 'size', title: m.images_size(), sortable: true, cell: SizeCell },
- { accessorKey: 'created', title: m.common_created(), sortable: true, cell: CreatedCell },
+ {
+ id: 'updates',
+ accessorFn: (row) => row.updateInfo?.hasUpdate ?? false,
+ title: m.images_updates(),
+ cell: UpdatesCell
+ },
{
accessorKey: 'inUse',
title: m.common_status(),
sortable: true,
cell: StatusCell
},
- {
- id: 'updates',
- accessorFn: (row) => row.updateInfo?.hasUpdate ?? false,
- title: m.images_updates(),
- cell: UpdatesCell
- }
+ { accessorKey: 'created', title: m.common_created(), sortable: true, cell: CreatedCell },
+ { accessorKey: 'size', title: m.images_size(), sortable: true, cell: SizeCell },
+ { accessorKey: 'repoTags', title: m.images_repository(), sortable: true, cell: RepoCell }
] satisfies ColumnSpec<ImageSummaryDto>[];
+
+ const mobileFields = [
+ { id: 'id', label: m.common_id(), defaultVisible: true },
+ { id: 'updates', label: m.images_updates(), defaultVisible: true },
+ { id: 'inUse', label: m.common_in_use(), defaultVisible: true },
+ { id: 'created', label: m.common_created(), defaultVisible: true },
+ { id: 'size', label: m.images_size(), defaultVisible: true },
+ { id: 'repoTags', label: m.images_repository(), defaultVisible: true }
+ ];
+
+ let mobileFieldVisibility = $state<Record<string, boolean>>({});
</script>
{#snippet RepoCell({ item }: { item: ImageSummaryDto })}
@@ -205,16 +206,92 @@
{/snippet}
{#snippet UpdatesCell({ item }: { item: ImageSummaryDto })}
- {@const { repo, tag } = extractRepoAndTag(item.repoTags)}
<ImageUpdateItem
updateInfo={item.updateInfo}
imageId={item.id}
- {repo}
- {tag}
+ repo={item.repo}
+ tag={item.tag}
onUpdated={(newInfo) => handleUpdateInfoChanged(item.id, newInfo)}
/>
{/snippet}
+{#snippet ImageMobileCardSnippet({
+ row,
+ item,
+ mobileFieldVisibility
+}: {
+ row: any;
+ item: ImageSummaryDto;
+ mobileFieldVisibility: Record<string, boolean>;
+})}
+ <UniversalMobileCard
+ {item}
+ icon={(item) => ({
+ component: ImageIcon,
+ variant: item.inUse ? 'emerald' : 'amber'
+ })}
+ title={(item) =>
+ item.repoTags && item.repoTags.length > 0 && item.repoTags[0] !== '<none>:<none>' ? item.repoTags[0] : m.images_untagged()}
+ subtitle={(item) => ((mobileFieldVisibility.id ?? false) ? item.id : null)}
+ badges={[
+ (item: ImageSummaryDto) =>
+ (mobileFieldVisibility.inUse ?? true)
+ ? item.inUse
+ ? { variant: 'green' as const, text: m.common_in_use() }
+ : { variant: 'amber' as const, text: m.common_unused() }
+ : null
+ ]}
+ fields={[
+ {
+ label: m.images_size(),
+ getValue: (item: ImageSummaryDto) => bytes.format(Number(item.size ?? 0)),
+ icon: HardDriveIcon,
+ iconVariant: 'blue' as const,
+ show: mobileFieldVisibility.size ?? true
+ },
+ {
+ label: m.images_repository(),
+ getValue: (item: ImageSummaryDto) => item.repoTags?.[0] || m.images_untagged(),
+ icon: ImageIcon,
+ iconVariant: 'purple' as const,
+ show:
+ (mobileFieldVisibility.repoTags ?? true) &&
+ item.repoTags &&
+ item.repoTags.length > 0 &&
+ item.repoTags[0] !== '<none>:<none>'
+ }
+ ]}
+ footer={(mobileFieldVisibility.created ?? true)
+ ? {
+ label: m.common_created(),
+ getValue: (item) => format(new Date(Number(item.created || 0) * 1000), 'PP p'),
+ icon: ClockIcon
+ }
+ : undefined}
+ rowActions={RowActions}
+ onclick={(item: ImageSummaryDto) => goto(`/images/${item.id}`)}
+ >
+ <div class="flex flex-wrap gap-x-4 gap-y-3 border-t pt-3">
+ {#if (mobileFieldVisibility.updates ?? true) && item.updateInfo !== undefined}
+ <div class="flex min-w-0 flex-1 basis-[180px] flex-col">
+ <div class="text-muted-foreground text-[10px] font-medium tracking-wide uppercase">
+ {m.images_updates()}
+ </div>
+ <div class="mt-0.5">
+ <ImageUpdateItem
+ updateInfo={item.updateInfo}
+ imageId={item.id}
+ repo={item.repo}
+ tag={item.tag}
+ onUpdated={(newInfo) => handleUpdateInfoChanged(item.id, newInfo)}
+ />
+ </div>
+ </div>
+ {/if}
+ </div>
+ </UniversalMobileCard>
+{/snippet}
+
{#snippet RowActions({ item }: { item: ImageSummaryDto })}
<DropdownMenu.Root>
<DropdownMenu.Trigger>
@@ -257,17 +334,20 @@
</DropdownMenu.Root>
{/snippet}
-<Card.Root>
- <Card.Content class="py-5">
+<Card.Root class="flex flex-col gap-6 py-3">
+ <Card.Content class="px-6 py-5">
<ArcaneTable
persistKey="arcane-image-table"
items={images}
bind:requestOptions
bind:selectedIds
+ bind:mobileFieldVisibility
onRemoveSelected={(ids) => handleDeleteSelected(ids)}
onRefresh={async (options) => (images = await imageService.getImages(options))}
{columns}
+ {mobileFields}
rowActions={RowActions}
+ mobileCard={ImageMobileCardSnippet}
/>
</Card.Content>
</Card.Root>
diff --git a/frontend/src/routes/networks/+page.ts b/frontend/src/routes/networks/+page.ts
index b2bd49775..5bbaf4c77 100644
--- a/frontend/src/routes/networks/+page.ts
+++ b/frontend/src/routes/networks/+page.ts
@@ -1,21 +1,24 @@
import { networkService } from '$lib/services/network-service';
import type { SearchPaginationSortRequest } from '$lib/types/pagination.type';
+import { resolveInitialTableRequest } from '$lib/utils/table-persistence.util';
import type { PageLoad } from './$types';
export const load: PageLoad = async () => {
- const networkRequestOptions: SearchPaginationSortRequest = {
+ const networkRequestOptions = resolveInitialTableRequest('arcane-networks-table', {
pagination: {
page: 1,
limit: 20
},
sort: {
column: 'name',
- direction: 'asc' as const
+ direction: 'asc'
}
- };
+ } satisfies SearchPaginationSortRequest);
- const networks = await networkService.getNetworks(networkRequestOptions);
- const networkUsageCounts = await networkService.getNetworkUsageCounts();
+ const [networks, networkUsageCounts] = await Promise.all([
+ networkService.getNetworks(networkRequestOptions),
+ networkService.getNetworkUsageCounts()
+ ]);
return { networks, networkRequestOptions, networkUsageCounts };
};
diff --git a/frontend/src/routes/networks/[networkId]/+page.svelte b/frontend/src/routes/networks/[networkId]/+page.svelte
index c92336f10..f08b81f0b 100644
--- a/frontend/src/routes/networks/[networkId]/+page.svelte
+++ b/frontend/src/routes/networks/[networkId]/+page.svelte
@@ -1,6 +1,6 @@
<script lang="ts">
+ import * as Card from '$lib/components/ui/card';
import type { PageData } from './$types';
- import * as Card from '$lib/components/ui/card/index.js';
import CircleAlertIcon from '@lucide/svelte/icons/alert-circle';
import HardDriveIcon from '@lucide/svelte/icons/hard-drive';
import ClockIcon from '@lucide/svelte/icons/clock';
@@ -13,13 +13,13 @@
import ListTreeIcon from '@lucide/svelte/icons/list-tree';
import ContainerIcon from '@lucide/svelte/icons/container';
import InfoIcon from '@lucide/svelte/icons/info';
- import * as Breadcrumb from '$lib/components/ui/breadcrumb/index.js';
- import * as Alert from '$lib/components/ui/alert/index.js';
+ import * as Breadcrumb from '$lib/components/ui/breadcrumb';
+ import * as Alert from '$lib/components/ui/alert';
import StatusBadge from '$lib/components/badges/status-badge.svelte';
import { format } from 'date-fns';
import { toast } from 'svelte-sonner';
import { openConfirmDialog } from '$lib/components/confirm-dialog';
- import { ArcaneButton } from '$lib/components/arcane-button/index.js';
+ import { ArcaneButton } from '$lib/components/arcane-button';
import { goto } from '$app/navigation';
import { handleApiResultWithCallbacks } from '$lib/utils/api.util';
import { tryCatch } from '$lib/utils/try-catch';
@@ -142,13 +142,12 @@
{#if network}
<div class="space-y-6">
- <Card.Root class="pt-0">
- <Card.Header class="bg-muted rounded-t-xl p-4">
- <Card.Title class="flex items-center gap-2 text-lg">
- <InfoIcon class="text-primary size-5" />
- {m.networks_details_title()}
- </Card.Title>
- <Card.Description>{m.networks_details_description()}</Card.Description>
+ <Card.Root>
+ <Card.Header icon={InfoIcon}>
+ <div class="flex flex-col space-y-1.5">
+ <Card.Title>{m.networks_details_title()}</Card.Title>
+ <Card.Description>{m.networks_details_description()}</Card.Description>
+ </div>
</Card.Header>
<Card.Content class="p-4">
<div class="grid grid-cols-1 gap-x-4 gap-y-6 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-6">
@@ -158,7 +157,12 @@
</div>
<div class="min-w-0 flex-1">
<p class="text-muted-foreground text-sm font-medium">{m.networks_id()}</p>
- <p class="mt-1 cursor-pointer font-mono text-xs font-semibold break-all select-all sm:text-sm" title="Click to select">{network.id}</p>
+ <p
+ class="mt-1 cursor-pointer font-mono text-xs font-semibold break-all select-all sm:text-sm"
+ title="Click to select"
+ >
+ {network.id}
+ </p>
</div>
</div>
@@ -168,7 +172,9 @@
</div>
<div class="min-w-0 flex-1">
<p class="text-muted-foreground text-sm font-medium">{m.networks_name()}</p>
- <p class="mt-1 cursor-pointer text-sm font-semibold break-all select-all sm:text-base" title="Click to select">{network.name}</p>
+ <p class="mt-1 cursor-pointer text-sm font-semibold break-all select-all sm:text-base" title="Click to select">
+ {network.name}
+ </p>
</div>
</div>
@@ -178,7 +184,9 @@
</div>
<div class="min-w-0 flex-1">
<p class="text-muted-foreground text-sm font-medium">{m.networks_driver()}</p>
- <p class="mt-1 cursor-pointer text-sm font-semibold select-all sm:text-base" title="Click to select">{network.driver}</p>
+ <p class="mt-1 cursor-pointer text-sm font-semibold select-all sm:text-base" title="Click to select">
+ {network.driver}
+ </p>
</div>
</div>
@@ -188,7 +196,9 @@
</div>
<div class="min-w-0 flex-1">
<p class="text-muted-foreground text-sm font-medium">{m.networks_scope()}</p>
- <p class="mt-1 cursor-pointer text-sm font-semibold capitalize select-all sm:text-base" title="Click to select">{network.scope}</p>
+ <p class="mt-1 cursor-pointer text-sm font-semibold capitalize select-all sm:text-base" title="Click to select">
+ {network.scope}
+ </p>
</div>
</div>
@@ -198,7 +208,9 @@
</div>
<div class="min-w-0 flex-1">
<p class="text-muted-foreground text-sm font-medium">{m.networks_created()}</p>
- <p class="mt-1 cursor-pointer text-sm font-semibold select-all sm:text-base" title="Click to select">{createdDate}</p>
+ <p class="mt-1 cursor-pointer text-sm font-semibold select-all sm:text-base" title="Click to select">
+ {createdDate}
+ </p>
</div>
</div>
@@ -251,73 +263,82 @@
</Card.Root>
{#if network.ipam?.Config && network.ipam.Config.length > 0}
- <Card.Root class="pt-0">
- <Card.Header class="bg-muted rounded-t-xl p-4">
- <Card.Title class="flex items-center gap-2 text-lg">
- <SettingsIcon class="text-primary size-5" />
- {m.networks_ipam_title()}
- </Card.Title>
- <Card.Description>{m.networks_ipam_description()}</Card.Description>
+ <Card.Root>
+ <Card.Header icon={SettingsIcon}>
+ <div class="flex flex-col space-y-1.5">
+ <Card.Title>{m.networks_ipam_title()}</Card.Title>
+ <Card.Description>{m.networks_ipam_description()}</Card.Description>
+ </div>
</Card.Header>
<Card.Content class="p-4">
- {#each network.ipam.Config as config, i (i)}
- <div class="bg-card/50 mb-4 rounded-lg border p-4 last:mb-0">
- <div class="space-y-2">
- {#if config.Subnet}
- <div class="flex flex-col sm:flex-row sm:items-center">
- <span class="text-muted-foreground w-full text-sm font-medium sm:w-24"
- >{m.networks_ipam_subnet_label()}:</span
- >
- <code
- class="bg-muted text-muted-foreground mt-1 rounded px-1.5 py-0.5 font-mono text-xs sm:mt-0 sm:text-sm cursor-pointer select-all" title="Click to select"
- >
- {config.Subnet}
- </code>
- </div>
- {/if}
+ <div class="space-y-3">
+ {#each network.ipam.Config as config, i (i)}
+ <Card.Root variant="outlined">
+ <Card.Content class="p-4">
+ <div class="space-y-2">
+ {#if config.Subnet}
+ <div class="flex flex-col sm:flex-row sm:items-center">
+ <span class="text-muted-foreground w-full text-sm font-medium sm:w-24"
+ >{m.networks_ipam_subnet_label()}:</span
+ >
+ <code
+ class="bg-muted text-muted-foreground mt-1 cursor-pointer rounded px-1.5 py-0.5 font-mono text-xs select-all sm:mt-0 sm:text-sm"
+ title="Click to select"
+ >
+ {config.Subnet}
+ </code>
+ </div>
+ {/if}
- {#if config.Gateway}
- <div class="flex flex-col sm:flex-row sm:items-center">
- <span class="text-muted-foreground w-full text-sm font-medium sm:w-24"
- >{m.networks_ipam_gateway_label()}:</span
- >
- <code
- class="bg-muted text-muted-foreground mt-1 rounded px-1.5 py-0.5 font-mono text-xs sm:mt-0 sm:text-sm cursor-pointer select-all" title="Click to select"
- >
- {config.Gateway}
- </code>
- </div>
- {/if}
+ {#if config.Gateway}
+ <div class="flex flex-col sm:flex-row sm:items-center">
+ <span class="text-muted-foreground w-full text-sm font-medium sm:w-24"
+ >{m.networks_ipam_gateway_label()}:</span
+ >
+ <code
+ class="bg-muted text-muted-foreground mt-1 cursor-pointer rounded px-1.5 py-0.5 font-mono text-xs select-all sm:mt-0 sm:text-sm"
+ title="Click to select"
+ >
+ {config.Gateway}
+ </code>
+ </div>
+ {/if}
- {#if config.IPRange}
- <div class="flex flex-col sm:flex-row sm:items-center">
- <span class="text-muted-foreground w-full text-sm font-medium sm:w-24"
- >{m.networks_ipam_iprange_label()}:</span
- >
- <code
- class="bg-muted text-muted-foreground mt-1 rounded px-1.5 py-0.5 font-mono text-xs sm:mt-0 sm:text-sm cursor-pointer select-all" title="Click to select"
- >
- {config.IPRange}
- </code>
- </div>
- {/if}
+ {#if config.IPRange}
+ <div class="flex flex-col sm:flex-row sm:items-center">
+ <span class="text-muted-foreground w-full text-sm font-medium sm:w-24"
+ >{m.networks_ipam_iprange_label()}:</span
+ >
+ <code
+ class="bg-muted text-muted-foreground mt-1 cursor-pointer rounded px-1.5 py-0.5 font-mono text-xs select-all sm:mt-0 sm:text-sm"
+ title="Click to select"
+ >
+ {config.IPRange}
+ </code>
+ </div>
+ {/if}
- {#if (config.AuxiliaryAddresses && Object.keys(config.AuxiliaryAddresses).length > 0) || (config.AuxAddress && Object.keys(config.AuxAddress).length > 0)}
- <div class="mt-3">
- <p class="text-muted-foreground mb-1 text-sm font-medium">{m.networks_ipam_aux_addresses_label()}:</p>
- <ul class="ml-4 space-y-1">
- {#each Object.entries(config.AuxiliaryAddresses ?? config.AuxAddress ?? {}) as [name, addr] (name)}
- <li class="flex font-mono text-xs">
- <span class="text-muted-foreground mr-2">{name}:</span>
- <code class="bg-muted text-muted-foreground rounded px-1 py-0.5 cursor-pointer select-all" title="Click to select">{addr}</code>
- </li>
- {/each}
- </ul>
+ {#if (config.AuxiliaryAddresses && Object.keys(config.AuxiliaryAddresses).length > 0) || (config.AuxAddress && Object.keys(config.AuxAddress).length > 0)}
+ <div class="mt-3">
+ <p class="text-muted-foreground mb-1 text-sm font-medium">{m.networks_ipam_aux_addresses_label()}:</p>
+ <ul class="ml-4 space-y-1">
+ {#each Object.entries(config.AuxiliaryAddresses ?? config.AuxAddress ?? {}) as [name, addr] (name)}
+ <li class="flex font-mono text-xs">
+ <span class="text-muted-foreground mr-2">{name}:</span>
+ <code
+ class="bg-muted text-muted-foreground cursor-pointer rounded px-1 py-0.5 select-all"
+ title="Click to select">{addr}</code
+ >
+ </li>
+ {/each}
+ </ul>
+ </div>
+ {/if}
</div>
- {/if}
- </div>
- </div>
- {/each}
+ </Card.Content>
+ </Card.Root>
+ {/each}
+ </div>
{#if network.ipam.Driver}
<div class="mt-4 flex items-center">
@@ -344,58 +365,64 @@
{/if}
{#if connectedContainers.length > 0}
- <Card.Root class="pt-0">
- <Card.Header class="bg-muted rounded-t-xl p-4">
- <Card.Title class="flex items-center gap-2 text-lg">
- <ContainerIcon class="text-primary size-5" />
- {m.networks_connected_containers_title()}
- </Card.Title>
- <Card.Description
- >{m.networks_connected_containers_description({ count: connectedContainers.length })}</Card.Description
- >
+ <Card.Root>
+ <Card.Header icon={ContainerIcon}>
+ <div class="flex flex-col space-y-1.5">
+ <Card.Title>{m.networks_connected_containers_title()}</Card.Title>
+ <Card.Description
+ >{m.networks_connected_containers_description({ count: connectedContainers.length })}</Card.Description
+ >
+ </div>
</Card.Header>
<Card.Content class="p-4">
- <div class="bg-card divide-y rounded-lg border">
- {#each connectedContainers as container (container.id)}
- <div class="flex flex-col p-3 sm:flex-row sm:items-center">
- <div class="mb-2 w-full break-all font-medium sm:mb-0 sm:w-1/3">
- <a href="/containers/{container.id}" class="text-primary flex items-center hover:underline">
- <ContainerIcon class="text-muted-foreground mr-1.5 size-3.5" />
- {container.Name}
- </a>
- </div>
- <div class="w-full pl-0 sm:w-2/3 sm:pl-4">
- <code class="bg-muted text-muted-foreground break-all rounded px-1.5 py-0.5 font-mono text-xs sm:text-sm cursor-pointer select-all" title="Click to select">
- {container.IPv4Address || container.IPv6Address || m.common_unknown()}
- </code>
+ <Card.Root variant="outlined">
+ <Card.Content class="divide-y p-0">
+ {#each connectedContainers as container (container.id)}
+ <div class="flex flex-col p-3 sm:flex-row sm:items-center">
+ <div class="mb-2 w-full font-medium break-all sm:mb-0 sm:w-1/3">
+ <a href="/containers/{container.id}" class="text-primary flex items-center hover:underline">
+ <ContainerIcon class="text-muted-foreground mr-1.5 size-3.5" />
+ {container.Name}
+ </a>
+ </div>
+ <div class="w-full pl-0 sm:w-2/3 sm:pl-4">
+ <code
+ class="bg-muted text-muted-foreground cursor-pointer rounded px-1.5 py-0.5 font-mono text-xs break-all select-all sm:text-sm"
+ title="Click to select"
+ >
+ {container.IPv4Address || container.IPv6Address || m.common_unknown()}
+ </code>
+ </div>
</div>
- </div>
- {/each}
- </div>
+ {/each}
+ </Card.Content>
+ </Card.Root>
</Card.Content>
</Card.Root>
{/if}
{#if network.labels && Object.keys(network.labels).length > 0}
- <Card.Root class="pt-0">
- <Card.Header class="bg-muted rounded-t-xl p-4">
- <Card.Title class="flex items-center gap-2 text-lg">
- <TagIcon class="text-primary size-5" />
- {m.networks_labels_title()}
- </Card.Title>
- <Card.Description>{m.networks_labels_description()}</Card.Description>
+ <Card.Root>
+ <Card.Header icon={TagIcon}>
+ <div class="flex flex-col space-y-1.5">
+ <Card.Title>{m.networks_labels_title()}</Card.Title>
+ <Card.Description>{m.networks_labels_description()}</Card.Description>
+ </div>
</Card.Header>
<Card.Content class="p-4">
- <div class="bg-card divide-y rounded-lg border">
+ <div class="grid grid-cols-1 gap-3 lg:grid-cols-2 2xl:grid-cols-3">
{#each Object.entries(network.labels) as [key, value] (key)}
- <div class="flex flex-col p-3 sm:flex-row">
- <div class="text-muted-foreground mb-2 w-full break-all font-medium sm:mb-0 sm:w-1/3">
- {key}
- </div>
- <div class="bg-muted/50 w-full break-all rounded p-2 font-mono text-xs sm:w-2/3 sm:text-sm cursor-pointer select-all" title="Click to select">
- {value}
- </div>
- </div>
+ <Card.Root variant="subtle">
+ <Card.Content class="flex flex-col gap-2 p-4">
+ <div class="text-muted-foreground text-xs font-semibold tracking-wide break-all uppercase">{key}</div>
+ <div
+ class="text-foreground cursor-pointer font-mono text-sm font-medium break-all select-all"
+ title="Click to select"
+ >
+ {value}
+ </div>
+ </Card.Content>
+ </Card.Root>
{/each}
</div>
</Card.Content>
@@ -403,25 +430,27 @@
{/if}
{#if network.options && Object.keys(network.options).length > 0}
- <Card.Root class="pt-0">
- <Card.Header class="bg-muted rounded-t-xl p-4">
- <Card.Title class="flex items-center gap-2 text-lg">
- <SettingsIcon class="text-primary size-5" />
- {m.networks_options_title()}
- </Card.Title>
- <Card.Description>{m.networks_options_description()}</Card.Description>
+ <Card.Root>
+ <Card.Header icon={SettingsIcon}>
+ <div class="flex flex-col space-y-1.5">
+ <Card.Title>{m.networks_options_title()}</Card.Title>
+ <Card.Description>{m.networks_options_description()}</Card.Description>
+ </div>
</Card.Header>
<Card.Content class="p-4">
- <div class="bg-card divide-y rounded-lg border">
+ <div class="grid grid-cols-1 gap-3 lg:grid-cols-2 2xl:grid-cols-3">
{#each Object.entries(network.options) as [key, value] (key)}
- <div class="flex flex-col p-3 sm:flex-row">
- <div class="text-muted-foreground mb-2 w-full break-all font-medium sm:mb-0 sm:w-1/3">
- {key}
- </div>
- <div class="bg-muted/50 w-full break-all rounded p-2 font-mono text-xs sm:w-2/3 sm:text-sm cursor-pointer select-all" title="Click to select">
- {value}
- </div>
- </div>
+ <Card.Root variant="subtle">
+ <Card.Content class="flex flex-col gap-2 p-4">
+ <div class="text-muted-foreground text-xs font-semibold tracking-wide break-all uppercase">{key}</div>
+ <div
+ class="text-foreground cursor-pointer font-mono text-sm font-medium break-all select-all"
+ title="Click to select"
+ >
+ {value}
+ </div>
+ </Card.Content>
+ </Card.Root>
{/each}
</div>
</Card.Content>
diff --git a/frontend/src/routes/networks/network-table.svelte b/frontend/src/routes/networks/network-table.svelte
index 64ae51927..3b7090088 100644
--- a/frontend/src/routes/networks/network-table.svelte
+++ b/frontend/src/routes/networks/network-table.svelte
@@ -17,8 +17,12 @@
import type { SearchPaginationSortRequest, Paginated } from '$lib/types/pagination.type';
import { capitalizeFirstLetter } from '$lib/utils/string.utils';
import type { ColumnSpec } from '$lib/components/arcane-table';
+ import { UniversalMobileCard } from '$lib/components/arcane-table';
import { m } from '$lib/paraglide/messages';
import { networkService } from '$lib/services/network-service';
+ import NetworkIcon from '@lucide/svelte/icons/network';
+ import RouteIcon from '@lucide/svelte/icons/route';
+ import GlobeIcon from '@lucide/svelte/icons/globe';
let {
networks = $bindable(),
@@ -110,6 +114,16 @@
const isAnyLoading = $derived(Object.values(isLoading).some((l) => l));
const hasNetworks = $derived(networks?.data?.length > 0);
+ function getDriverVariant(driver: string): 'blue' | 'purple' | 'red' | 'orange' | 'gray' {
+ const variantMap: Record<string, 'blue' | 'purple' | 'red' | 'orange' | 'gray'> = {
+ bridge: 'blue',
+ overlay: 'purple',
+ ipvlan: 'red',
+ macvlan: 'orange'
+ };
+ return variantMap[driver] || 'gray';
+ }
+
const columns = [
{
accessorKey: 'name',
@@ -141,6 +155,15 @@
cell: ScopeCell
}
] satisfies ColumnSpec<NetworkSummaryDto>[];
+
+ const mobileFields = [
+ { id: 'id', label: m.common_id(), defaultVisible: true },
+ { id: 'status', label: m.common_status(), defaultVisible: true },
+ { id: 'driver', label: m.common_driver(), defaultVisible: true },
+ { id: 'scope', label: m.common_scope(), defaultVisible: true }
+ ];
+
+ let mobileFieldVisibility = $state<Record<string, boolean>>({});
</script>
{#snippet NameCell({ item }: { item: NetworkSummaryDto })}
@@ -178,6 +201,56 @@
{/if}
{/snippet}
+{#snippet NetworkMobileCardSnippet({
+ row,
+ item,
+ mobileFieldVisibility
+}: {
+ row: any;
+ item: NetworkSummaryDto;
+ mobileFieldVisibility: Record<string, boolean>;
+})}
+ <UniversalMobileCard
+ {item}
+ icon={(item: NetworkSummaryDto) => ({
+ component: NetworkIcon,
+ variant: item.inUse ? 'emerald' : 'amber'
+ })}
+ title={(item: NetworkSummaryDto) => item.name}
+ subtitle={(item: NetworkSummaryDto) => ((mobileFieldVisibility.id ?? true) ? item.id : null)}
+ badges={[
+ (item: NetworkSummaryDto) =>
+ (mobileFieldVisibility.status ?? true)
+ ? item.inUse
+ ? { variant: 'green', text: m.common_in_use() }
+ : { variant: 'amber', text: m.common_unused() }
+ : null
+ ]}
+ fields={[
+ {
+ label: m.common_driver(),
+ getValue: (item: NetworkSummaryDto) => capitalizeFirstLetter(item.driver),
+ icon: RouteIcon,
+ iconVariant: 'gray' as const,
+ type: 'badge' as const,
+ badgeVariant: getDriverVariant(item.driver),
+ show: mobileFieldVisibility.driver ?? true
+ },
+ {
+ label: m.common_scope(),
+ getValue: (item: NetworkSummaryDto) => capitalizeFirstLetter(item.scope),
+ icon: GlobeIcon,
+ iconVariant: 'gray' as const,
+ type: 'badge' as const,
+ badgeVariant: item.scope === 'local' ? ('green' as const) : ('amber' as const),
+ show: mobileFieldVisibility.scope ?? true
+ }
+ ]}
+ rowActions={RowActions}
+ onclick={() => goto(`/networks/${item.id}`)}
+ />
+{/snippet}
+
{#snippet RowActions({ item }: { item: NetworkSummaryDto })}
<DropdownMenu.Root>
<DropdownMenu.Trigger>
@@ -208,17 +281,20 @@
</DropdownMenu.Root>
{/snippet}
-<Card.Root>
- <Card.Content class="py-5">
+<Card.Root class="flex flex-col gap-6 py-3">
+ <Card.Content class="px-6 py-5">
<ArcaneTable
persistKey="arcane-networks-table"
items={networks}
bind:requestOptions
bind:selectedIds
+ bind:mobileFieldVisibility
onRemoveSelected={(ids) => handleDeleteSelectedNetworks(ids)}
onRefresh={async (options) => (networks = await networkService.getNetworks(options))}
{columns}
+ {mobileFields}
rowActions={RowActions}
+ mobileCard={NetworkMobileCardSnippet}
/>
</Card.Content>
</Card.Root>
diff --git a/frontend/src/routes/onboarding/docker/+page.svelte b/frontend/src/routes/onboarding/docker/+page.svelte
index a2c451faf..21a375210 100644
--- a/frontend/src/routes/onboarding/docker/+page.svelte
+++ b/frontend/src/routes/onboarding/docker/+page.svelte
@@ -115,12 +115,14 @@
{/if}
<div class="grid gap-6 md:grid-cols-2">
- <Card.Root>
- <Card.Header>
+ <Card.Root class="flex flex-col gap-6 py-3">
+ <Card.Header
+ class="@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6"
+ >
<Card.Title>{m.docker_title()}</Card.Title>
<Card.Description>{m.docker_description()}</Card.Description>
</Card.Header>
- <Card.Content class="space-y-6">
+ <Card.Content class="space-y-6 px-6">
<SwitchWithLabel
id="pollingEnabled"
label={m.docker_enable_polling_label()}
@@ -180,12 +182,14 @@
</Card.Content>
</Card.Root>
- <Card.Root>
- <Card.Header>
+ <Card.Root class="flex flex-col gap-6 py-3">
+ <Card.Header
+ class="@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6"
+ >
<Card.Title>{m.docker_prune_action_label()}</Card.Title>
<Card.Description>{pruneModeDescription}</Card.Description>
</Card.Header>
- <Card.Content>
+ <Card.Content class="px-6">
<SelectWithLabel
id="dockerPruneMode"
name="pruneMode"
diff --git a/frontend/src/routes/projects/+page.ts b/frontend/src/routes/projects/+page.ts
index 2e6c3910e..069679c25 100644
--- a/frontend/src/routes/projects/+page.ts
+++ b/frontend/src/routes/projects/+page.ts
@@ -1,21 +1,24 @@
import { projectService } from '$lib/services/project-service';
import type { SearchPaginationSortRequest } from '$lib/types/pagination.type';
+import { resolveInitialTableRequest } from '$lib/utils/table-persistence.util';
import type { PageLoad } from './$types';
export const load: PageLoad = async () => {
- const projectRequestOptions: SearchPaginationSortRequest = {
+ const projectRequestOptions = resolveInitialTableRequest('arcane-project-table', {
pagination: {
page: 1,
limit: 20
},
sort: {
column: 'name',
- direction: 'asc' as const
+ direction: 'asc'
}
- };
+ } satisfies SearchPaginationSortRequest);
- const projects = await projectService.getProjects(projectRequestOptions);
- const projectStatusCounts = await projectService.getProjectStatusCounts();
+ const [projects, projectStatusCounts] = await Promise.all([
+ projectService.getProjects(projectRequestOptions),
+ projectService.getProjectStatusCounts()
+ ]);
return { projects, projectRequestOptions, projectStatusCounts };
};
diff --git a/frontend/src/routes/projects/components/CodePanel.svelte b/frontend/src/routes/projects/components/CodePanel.svelte
index d0984bfbe..0733b29e0 100644
--- a/frontend/src/routes/projects/components/CodePanel.svelte
+++ b/frontend/src/routes/projects/components/CodePanel.svelte
@@ -1,5 +1,5 @@
<script lang="ts">
- import * as Card from '$lib/components/ui/card/index.js';
+ import * as Card from '$lib/components/ui/card';
import CodeEditor from '$lib/components/code-editor/editor.svelte';
import FileTextIcon from '@lucide/svelte/icons/file-text';
@@ -22,11 +22,12 @@
} = $props();
</script>
-<Card.Root class="gap-0 p-0">
- <Card.Header class="bg-muted rounded-t-xl p-4">
- <Card.Title class="flex items-center gap-2 text-lg">
- <FileTextIcon class="text-primary size-5" />
- {title}
+<Card.Root>
+ <Card.Header icon={FileTextIcon} class="items-center">
+ <Card.Title>
+ <h2>
+ {title}
+ </h2>
</Card.Title>
</Card.Header>
<Card.Content class="p-0">
diff --git a/frontend/src/routes/projects/components/ProjectLogsPanel.svelte b/frontend/src/routes/projects/components/ProjectLogsPanel.svelte
index 5427cad89..2684892ff 100644
--- a/frontend/src/routes/projects/components/ProjectLogsPanel.svelte
+++ b/frontend/src/routes/projects/components/ProjectLogsPanel.svelte
@@ -1,9 +1,8 @@
<script lang="ts">
- import * as Card from '$lib/components/ui/card/index.js';
- import { Button } from '$lib/components/ui/button/index.js';
+ import * as Card from '$lib/components/ui/card';
import TerminalIcon from '@lucide/svelte/icons/terminal';
- import RefreshCwIcon from '@lucide/svelte/icons/refresh-cw';
- import LogViewer from '$lib/components/log-viewer.svelte';
+ import LogViewer from '$lib/components/logs/log-viewer.svelte';
+ import LogControls from '$lib/components/logs/log-controls.svelte';
import { m } from '$lib/paraglide/messages';
let {
@@ -17,72 +16,55 @@
let isStreaming = $state(false);
let viewer = $state<LogViewer>();
- function onStart() {
+ function handleStart() {
isStreaming = true;
+ viewer?.startLogStream();
}
- function onStop() {
+
+ function handleStop() {
isStreaming = false;
+ viewer?.stopLogStream();
}
- function onClear() {}
- function onToggleAutoScroll() {}
-</script>
-<Card.Root class="gap-0 p-0">
- <Card.Header class="bg-muted rounded-t-xl p-4">
- <div class="flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between">
- <div class="flex items-center gap-2">
- <TerminalIcon class="text-primary size-5" />
- <Card.Title class="text-lg">{m.compose_logs_title()}</Card.Title>
- {#if isStreaming}
- <div class="flex items-center gap-2">
- <div class="size-2 animate-pulse rounded-full bg-green-500"></div>
- <span class="text-xs font-semibold text-green-600 sm:text-sm">{m.common_live()}</span>
- </div>
- {/if}
- </div>
+ function handleClear() {
+ viewer?.clearLogs();
+ }
- <div class="flex flex-col gap-3 sm:flex-row sm:items-center">
- <label class="flex items-center gap-2">
- <input type="checkbox" bind:checked={autoScroll} class="size-4" />
- <span class="text-sm font-medium">{m.common_autoscroll()}</span>
- </label>
+ function handleRefresh() {
+ viewer?.stopLogStream();
+ viewer?.startLogStream();
+ }
+</script>
+<Card.Root>
+ <Card.Header icon={TerminalIcon}>
+ <div class="flex flex-1 flex-col gap-4 sm:flex-row sm:items-start sm:justify-between">
+ <div class="flex flex-col gap-1.5">
<div class="flex items-center gap-2">
- <Button variant="outline" size="sm" class="text-xs font-medium" onclick={() => viewer?.clearLogs()}>
- {m.common_clear()}
- </Button>
+ <Card.Title>
+ <h2>
+ {m.compose_logs_title()}
+ </h2>
+ </Card.Title>
{#if isStreaming}
- <Button variant="outline" size="sm" class="text-xs font-medium" onclick={() => viewer?.stopLogStream()}>
- {m.common_stop()}
- </Button>
- {:else}
- <Button
- variant="outline"
- size="sm"
- class="text-xs font-medium"
- onclick={() => viewer?.startLogStream()}
- disabled={!projectId}
- >
- {m.common_start()}
- </Button>
+ <div class="flex items-center gap-2">
+ <div class="size-2 animate-pulse rounded-full bg-green-500"></div>
+ <span class="text-xs font-semibold text-green-600 sm:text-sm">{m.common_live()}</span>
+ </div>
{/if}
- <Button
- variant="outline"
- size="sm"
- class="px-2"
- onclick={() => {
- viewer?.stopLogStream();
- viewer?.startLogStream();
- }}
- aria-label="Refresh logs"
- title="Refresh"
- >
- <RefreshCwIcon class="size-4" />
- </Button>
</div>
+ <Card.Description>Real-time project logs</Card.Description>
</div>
+ <LogControls
+ bind:autoScroll
+ {isStreaming}
+ disabled={!projectId}
+ onStart={handleStart}
+ onStop={handleStop}
+ onClear={handleClear}
+ onRefresh={handleRefresh}
+ />
</div>
- <Card.Description>Real-time project logs</Card.Description>
</Card.Header>
<Card.Content class="p-0">
<LogViewer
@@ -93,10 +75,9 @@
maxLines={500}
showTimestamps={true}
height="calc(100vh - 320px)"
- {onStart}
- {onStop}
- {onClear}
- {onToggleAutoScroll}
+ onStart={handleStart}
+ onStop={handleStop}
+ onClear={handleClear}
/>
</Card.Content>
</Card.Root>
diff --git a/frontend/src/routes/projects/components/ServicesGrid.svelte b/frontend/src/routes/projects/components/ServicesGrid.svelte
index bebfc0526..a55d6eeee 100644
--- a/frontend/src/routes/projects/components/ServicesGrid.svelte
+++ b/frontend/src/routes/projects/components/ServicesGrid.svelte
@@ -1,5 +1,5 @@
<script lang="ts">
- import * as Card from '$lib/components/ui/card/index.js';
+ import * as Card from '$lib/components/ui/card';
import LayersIcon from '@lucide/svelte/icons/layers';
import StatusBadge from '$lib/components/badges/status-badge.svelte';
import { getStatusVariant } from '$lib/utils/status.utils';
@@ -15,15 +15,16 @@
let { services }: { services?: Service[] } = $props();
</script>
-<Card.Root class="pt-0">
- <Card.Header class="bg-muted rounded-t-xl p-4">
- <Card.Title class="flex items-center gap-2 text-lg">
- <LayersIcon class="text-primary size-5" />
- <h2>
- {m.compose_services()}
- </h2>
- </Card.Title>
- <Card.Description>{m.compose_services_description()}</Card.Description>
+<Card.Root>
+ <Card.Header icon={LayersIcon}>
+ <div class="flex flex-col space-y-1.5">
+ <Card.Title>
+ <h2>
+ {m.compose_services()}
+ </h2>
+ </Card.Title>
+ <Card.Description>{m.compose_services_description()}</Card.Description>
+ </div>
</Card.Header>
<Card.Content class="p-4">
{#if services && services.length > 0}
@@ -35,41 +36,38 @@
{#if service.container_id}
<a href={`/containers/${service.container_id}`} class="group">
<Card.Root
- class="group-hover:border-border/60 h-full cursor-pointer transition-all duration-200 group-hover:shadow-sm"
+ variant="subtle"
+ class="group-hover:border-border/60 group-hover:bg-muted/50 flex h-full cursor-pointer transition-all duration-200"
>
- <Card.Content class="p-6 py-2">
- <div class="flex items-start gap-4">
- <div class="rounded-lg bg-blue-500/10 p-2.5 transition-colors group-hover:bg-blue-500/15">
+ <Card.Content class="flex flex-col p-4">
+ <div class="flex items-start gap-3">
+ <div class="rounded-lg bg-blue-500/10 p-2 transition-colors group-hover:bg-blue-500/15">
<LayersIcon class="size-5 text-blue-500" />
</div>
<div class="min-w-0 flex-1">
- <h3 class="text-foreground text-lg font-semibold transition-colors">
+ <h3 class="text-foreground mb-2 text-base font-semibold transition-colors">
{service.name}
</h3>
- <div class="mt-3 flex items-center gap-2">
- <StatusBadge {variant} text={capitalizeFirstLetter(status)} />
- </div>
- <p class="text-muted-foreground mt-2 text-sm">{m.compose_active_container()}</p>
+ <StatusBadge {variant} text={capitalizeFirstLetter(status)} />
+ <p class="text-muted-foreground mt-2 text-xs">{m.compose_active_container()}</p>
</div>
</div>
</Card.Content>
</Card.Root>
</a>
{:else}
- <Card.Root class="h-full opacity-75">
- <Card.Content class="p-6 py-2">
- <div class="flex items-start gap-4">
- <div class="rounded-lg bg-amber-500/10 p-2.5">
+ <Card.Root variant="subtle" class="flex h-full opacity-60">
+ <Card.Content class="flex flex-col p-4">
+ <div class="flex items-start gap-3">
+ <div class="rounded-lg bg-amber-500/10 p-2">
<LayersIcon class="size-5 text-amber-500" />
</div>
<div class="min-w-0 flex-1">
- <h3 class="text-foreground text-lg font-semibold">
+ <h3 class="text-foreground mb-2 text-base font-semibold">
{service.name}
</h3>
- <div class="mt-3 flex items-center gap-2">
- <StatusBadge {variant} text={capitalizeFirstLetter(status)} />
- </div>
- <p class="text-muted-foreground mt-2 text-sm">
+ <StatusBadge {variant} text={capitalizeFirstLetter(status)} />
+ <p class="text-muted-foreground mt-2 text-xs">
{m.compose_service_not_created()}
</p>
</div>
diff --git a/frontend/src/routes/projects/projects-table.svelte b/frontend/src/routes/projects/projects-table.svelte
index 17c0ec97e..013b87642 100644
--- a/frontend/src/routes/projects/projects-table.svelte
+++ b/frontend/src/routes/projects/projects-table.svelte
@@ -22,8 +22,12 @@
import { capitalizeFirstLetter } from '$lib/utils/string.utils';
import { format } from 'date-fns';
import type { ColumnSpec } from '$lib/components/arcane-table';
+ import { UniversalMobileCard } from '$lib/components/arcane-table';
import { m } from '$lib/paraglide/messages';
import { projectService } from '$lib/services/project-service';
+ import FolderIcon from '@lucide/svelte/icons/folder';
+ import LayersIcon from '@lucide/svelte/icons/layers';
+ import CalendarIcon from '@lucide/svelte/icons/calendar';
let {
projects = $bindable(),
@@ -134,10 +138,19 @@
const columns = [
{ accessorKey: 'name', title: m.common_name(), sortable: true, cell: NameCell },
- { accessorKey: 'serviceCount', title: m.compose_services(), sortable: true },
{ accessorKey: 'status', title: m.common_status(), sortable: true, cell: StatusCell },
- { accessorKey: 'createdAt', title: m.common_created(), sortable: true, cell: CreatedCell }
+ { accessorKey: 'createdAt', title: m.common_created(), sortable: true, cell: CreatedCell },
+ { accessorKey: 'serviceCount', title: m.compose_services(), sortable: true }
] satisfies ColumnSpec<Project>[];
+
+ const mobileFields = [
+ { id: 'id', label: m.common_id(), defaultVisible: true },
+ { id: 'status', label: m.common_status(), defaultVisible: true },
+ { id: 'createdAt', label: m.common_created(), defaultVisible: true },
+ { id: 'serviceCount', label: m.compose_services(), defaultVisible: true }
+ ];
+
+ let mobileFieldVisibility = $state<Record<string, boolean>>({});
</script>
{#snippet NameCell({ item }: { item: Project })}
@@ -155,6 +168,56 @@
{#if value}{format(new Date(String(value)), 'PP p')}{/if}
{/snippet}
+{#snippet ProjectMobileCardSnippet({
+ row,
+ item,
+ mobileFieldVisibility
+}: {
+ row: any;
+ item: Project;
+ mobileFieldVisibility: Record<string, boolean>;
+})}
+ <UniversalMobileCard
+ {item}
+ icon={(item: Project) => ({
+ component: FolderIcon,
+ variant: item.status === 'running' ? 'emerald' : item.status === 'exited' ? 'red' : 'amber'
+ })}
+ title={(item: Project) => item.name}
+ subtitle={(item: Project) => ((mobileFieldVisibility.id ?? true) ? item.id : null)}
+ badges={[
+ (item: Project) =>
+ (mobileFieldVisibility.status ?? true)
+ ? {
+ variant: getStatusVariant(item.status),
+ text: capitalizeFirstLetter(item.status)
+ }
+ : null
+ ]}
+ fields={[
+ {
+ label: m.compose_services(),
+ getValue: (item: Project) => {
+ const serviceCount = item.serviceCount ? Number(item.serviceCount) : (item.services?.length ?? 0);
+ return `${serviceCount} ${Number(serviceCount) === 1 ? 'service' : 'services'}`;
+ },
+ icon: LayersIcon,
+ iconVariant: 'gray' as const,
+ show: mobileFieldVisibility.serviceCount ?? true
+ }
+ ]}
+ footer={(mobileFieldVisibility.createdAt ?? true) && item.createdAt
+ ? {
+ label: m.common_created(),
+ getValue: (item: Project) => format(new Date(item.createdAt), 'PP p'),
+ icon: CalendarIcon
+ }
+ : undefined}
+ rowActions={RowActions}
+ onclick={() => goto(`/projects/${item.id}`)}
+ />
+{/snippet}
+
{#snippet RowActions({ item }: { item: Project })}
<DropdownMenu.Root>
<DropdownMenu.Trigger>
@@ -232,16 +295,19 @@
</DropdownMenu.Root>
{/snippet}
-<Card.Root>
- <Card.Content class="py-5">
+<Card.Root class="flex flex-col gap-6 py-3">
+ <Card.Content class="px-6 py-5">
<ArcaneTable
persistKey="arcane-project-table"
items={projects}
bind:requestOptions
bind:selectedIds
+ bind:mobileFieldVisibility
onRefresh={async (options) => (projects = await projectService.getProjects(options))}
{columns}
+ {mobileFields}
rowActions={RowActions}
+ mobileCard={ProjectMobileCardSnippet}
/>
</Card.Content>
</Card.Root>
diff --git a/frontend/src/routes/settings/docker/+page.svelte b/frontend/src/routes/settings/docker/+page.svelte
index d979aa9c4..bb46ea13e 100644
--- a/frontend/src/routes/settings/docker/+page.svelte
+++ b/frontend/src/routes/settings/docker/+page.svelte
@@ -1,13 +1,13 @@
<script lang="ts">
+ import * as Card from '$lib/components/ui/card';
import ZapIcon from '@lucide/svelte/icons/zap';
- import * as Alert from '$lib/components/ui/alert/index.js';
+ import * as Alert from '$lib/components/ui/alert';
import { toast } from 'svelte-sonner';
import type { Settings } from '$lib/types/settings.type';
import { z } from 'zod/v4';
import { getContext, onMount } from 'svelte';
import { createForm } from '$lib/utils/form.utils';
import SwitchWithLabel from '$lib/components/form/labeled-switch.svelte';
- import * as Card from '$lib/components/ui/card';
import SelectWithLabel from '$lib/components/form/select-with-label.svelte';
import { m } from '$lib/paraglide/messages';
import ActivityIcon from '@lucide/svelte/icons/activity';
@@ -18,7 +18,7 @@
import settingsStore from '$lib/stores/config-store';
import BoxesIcon from '@lucide/svelte/icons/boxes';
import { settingsService } from '$lib/services/settings-service';
- import { SettingsPageLayout } from '$lib/layouts/index.js';
+ import { SettingsPageLayout } from '$lib/layouts';
let { data } = $props();
let currentSettings = $state<Settings>(data.settings);
@@ -193,16 +193,11 @@
{#snippet mainContent()}
<fieldset disabled={isReadOnly} class="relative">
<div class="space-y-4 sm:space-y-6">
- <Card.Root class="overflow-hidden pt-0">
- <Card.Header class="bg-muted/20 border-b !py-4">
- <div class="flex items-center gap-3">
- <div class="bg-primary/10 text-primary ring-primary/20 flex size-8 items-center justify-center rounded-lg ring-1">
- <ActivityIcon class="size-4" />
- </div>
- <div>
- <Card.Title class="text-base">{m.docker_image_polling_title()}</Card.Title>
- <Card.Description class="text-xs">{m.docker_image_polling_description()}</Card.Description>
- </div>
+ <Card.Root>
+ <Card.Header icon={ActivityIcon}>
+ <div class="flex flex-col space-y-1.5">
+ <Card.Title>{m.docker_image_polling_title()}</Card.Title>
+ <Card.Description>{m.docker_image_polling_description()}</Card.Description>
</div>
</Card.Header>
<Card.Content class="px-3 py-4 sm:px-6">
@@ -249,16 +244,11 @@
</Card.Root>
{#if $formInputs.pollingEnabled.value}
- <Card.Root class="overflow-hidden pt-0">
- <Card.Header class="bg-muted/20 border-b !py-4">
- <div class="flex items-center gap-3">
- <div class="bg-primary/10 text-primary ring-primary/20 flex size-8 items-center justify-center rounded-lg ring-1">
- <RefreshCwIcon class="size-4" />
- </div>
- <div>
- <Card.Title class="text-base">{m.docker_auto_updates_title()}</Card.Title>
- <Card.Description class="text-xs">{m.docker_auto_updates_description()}</Card.Description>
- </div>
+ <Card.Root>
+ <Card.Header icon={RefreshCwIcon}>
+ <div class="flex flex-col space-y-1.5">
+ <Card.Title>{m.docker_auto_updates_title()}</Card.Title>
+ <Card.Description>{m.docker_auto_updates_description()}</Card.Description>
</div>
</Card.Header>
<Card.Content class="px-3 py-4 sm:px-6">
@@ -286,16 +276,11 @@
</Card.Root>
{/if}
- <Card.Root class="overflow-hidden pt-0">
- <Card.Header class="bg-muted/20 border-b !py-4">
- <div class="flex items-center gap-3">
- <div class="bg-primary/10 text-primary ring-primary/20 flex size-8 items-center justify-center rounded-lg ring-1">
- <TrashIcon class="size-4" />
- </div>
- <div>
- <Card.Title class="text-base">{m.docker_cleanup_settings_title()}</Card.Title>
- <Card.Description class="text-xs">{m.docker_cleanup_settings_description()}</Card.Description>
- </div>
+ <Card.Root>
+ <Card.Header icon={TrashIcon}>
+ <div class="flex flex-col space-y-1.5">
+ <Card.Title>{m.docker_cleanup_settings_title()}</Card.Title>
+ <Card.Description>{m.docker_cleanup_settings_description()}</Card.Description>
</div>
</Card.Header>
<Card.Content class="px-3 py-4 sm:px-6">
@@ -312,16 +297,11 @@
</Card.Content>
</Card.Root>
- <Card.Root class="overflow-hidden pt-0">
- <Card.Header class="bg-muted/20 border-b !py-4">
- <div class="flex items-center gap-3">
- <div class="bg-primary/10 text-primary ring-primary/20 flex size-8 items-center justify-center rounded-lg ring-1">
- <TerminalIcon class="size-4" />
- </div>
- <div>
- <Card.Title class="text-base">{m.docker_terminal_settings_title()}</Card.Title>
- <Card.Description class="text-xs">{m.docker_terminal_settings_description()}</Card.Description>
- </div>
+ <Card.Root>
+ <Card.Header icon={TerminalIcon}>
+ <div class="flex flex-col space-y-1.5">
+ <Card.Title>{m.docker_terminal_settings_title()}</Card.Title>
+ <Card.Description>{m.docker_terminal_settings_description()}</Card.Description>
</div>
</Card.Header>
<Card.Content class="px-3 py-4 sm:px-6">
diff --git a/frontend/src/routes/settings/general/+page.svelte b/frontend/src/routes/settings/general/+page.svelte
index be0ead2e9..44b746e61 100644
--- a/frontend/src/routes/settings/general/+page.svelte
+++ b/frontend/src/routes/settings/general/+page.svelte
@@ -1,8 +1,8 @@
<script lang="ts">
+ import * as Card from '$lib/components/ui/card';
import { z } from 'zod/v4';
import { getContext, onMount } from 'svelte';
import { createForm } from '$lib/utils/form.utils';
- import * as Card from '$lib/components/ui/card';
import type { Settings } from '$lib/types/settings.type';
import { toast } from 'svelte-sonner';
import SwitchWithLabel from '$lib/components/form/labeled-switch.svelte';
@@ -13,7 +13,7 @@
import settingsStore from '$lib/stores/config-store';
import SettingsIcon from '@lucide/svelte/icons/settings';
import { settingsService } from '$lib/services/settings-service';
- import { SettingsPageLayout } from '$lib/layouts/index.js';
+ import { SettingsPageLayout } from '$lib/layouts';
let { data } = $props();
let currentSettings = $state(data.settings);
@@ -98,16 +98,11 @@
{#snippet mainContent()}
<fieldset disabled={isReadOnly} class="relative">
<div class="space-y-4 sm:space-y-6">
- <Card.Root class="overflow-hidden pt-0">
- <Card.Header class="bg-muted/20 border-b !py-4">
- <div class="flex items-center gap-3">
- <div class="bg-primary/10 text-primary ring-primary/20 flex size-8 items-center justify-center rounded-lg ring-1">
- <FolderIcon class="size-4" />
- </div>
- <div>
- <Card.Title class="text-base">{m.general_projects_heading()}</Card.Title>
- <Card.Description class="text-xs">{m.general_projects_description()}</Card.Description>
- </div>
+ <Card.Root>
+ <Card.Header icon={FolderIcon}>
+ <div class="flex flex-col space-y-1.5">
+ <Card.Title>{m.general_projects_heading()}</Card.Title>
+ <Card.Description>{m.general_projects_description()}</Card.Description>
</div>
</Card.Header>
<Card.Content class="px-3 py-4 sm:px-6">
@@ -131,16 +126,11 @@
</Card.Content>
</Card.Root>
- <Card.Root class="overflow-hidden pt-0">
- <Card.Header class="bg-muted/20 border-b !py-4">
- <div class="flex items-center gap-3">
- <div class="bg-primary/10 text-primary ring-primary/20 flex size-8 items-center justify-center rounded-lg ring-1">
- <UserIcon class="size-4" />
- </div>
- <div>
- <Card.Title class="text-base">{m.general_user_avatars_heading()}</Card.Title>
- <Card.Description class="text-xs">{m.general_user_avatars_description()}</Card.Description>
- </div>
+ <Card.Root>
+ <Card.Header icon={UserIcon}>
+ <div class="flex flex-col space-y-1.5">
+ <Card.Title>{m.general_user_avatars_heading()}</Card.Title>
+ <Card.Description>{m.general_user_avatars_description()}</Card.Description>
</div>
</Card.Header>
<Card.Content class="px-3 py-4 sm:px-6">
diff --git a/frontend/src/routes/settings/navigation/+page.svelte b/frontend/src/routes/settings/navigation/+page.svelte
index d3bc807ca..5a2f53b84 100644
--- a/frontend/src/routes/settings/navigation/+page.svelte
+++ b/frontend/src/routes/settings/navigation/+page.svelte
@@ -1,8 +1,8 @@
<script lang="ts">
+ import * as Card from '$lib/components/ui/card';
import { z } from 'zod/v4';
import { getContext, onMount } from 'svelte';
import { createForm } from '$lib/utils/form.utils';
- import * as Card from '$lib/components/ui/card';
import type { Settings } from '$lib/types/settings.type';
import { toast } from 'svelte-sonner';
import EyeIcon from '@lucide/svelte/icons/eye';
@@ -15,7 +15,7 @@
import { m } from '$lib/paraglide/messages';
import { navigationSettingsOverridesStore, resetNavigationVisibility } from '$lib/utils/navigation.utils';
import { settingsService } from '$lib/services/settings-service';
- import { SettingsPageLayout } from '$lib/layouts/index.js';
+ import { SettingsPageLayout } from '$lib/layouts';
let { data } = $props();
let currentSettings = $state(data.settings);
@@ -146,16 +146,11 @@
>
{#snippet mainContent()}
<div class="space-y-4 sm:space-y-6">
- <Card.Root class="overflow-hidden pt-0">
- <Card.Header class="bg-muted/20 border-b !py-4">
- <div class="flex items-center gap-3">
- <div class="bg-primary/10 text-primary ring-primary/20 flex size-8 items-center justify-center rounded-lg ring-1">
- <NavigationIcon class="size-4" />
- </div>
- <div>
- <Card.Title class="text-base">{m.navigation_mobile_appearance_title()}</Card.Title>
- <Card.Description class="text-xs">{m.navigation_mobile_appearance_description()}</Card.Description>
- </div>
+ <Card.Root>
+ <Card.Header icon={NavigationIcon}>
+ <div class="flex flex-col space-y-1.5">
+ <Card.Title>{m.navigation_mobile_appearance_title()}</Card.Title>
+ <Card.Description>{m.navigation_mobile_appearance_description()}</Card.Description>
</div>
</Card.Header>
<Card.Content class="px-3 py-3 sm:px-6 sm:py-4">
@@ -193,16 +188,11 @@
</Card.Content>
</Card.Root>
- <Card.Root class="overflow-hidden pt-0">
- <Card.Header class="bg-muted/20 border-b !py-4">
- <div class="flex items-center gap-3">
- <div class="bg-primary/10 text-primary ring-primary/20 flex size-8 items-center justify-center rounded-lg ring-1">
- <NavigationIcon class="size-4" />
- </div>
- <div>
- <Card.Title class="text-base">{m.navigation_mobile_behavior_title()}</Card.Title>
- <Card.Description class="text-xs">{m.navigation_mobile_behavior_description()}</Card.Description>
- </div>
+ <Card.Root>
+ <Card.Header icon={NavigationIcon}>
+ <div class="flex flex-col space-y-1.5">
+ <Card.Title>{m.navigation_mobile_behavior_title()}</Card.Title>
+ <Card.Description>{m.navigation_mobile_behavior_description()}</Card.Description>
</div>
</Card.Header>
<Card.Content class="px-3 py-3 sm:px-6 sm:py-4">
diff --git a/frontend/src/routes/settings/security/+page.svelte b/frontend/src/routes/settings/security/+page.svelte
index 8ee1fde53..73b8e250f 100644
--- a/frontend/src/routes/settings/security/+page.svelte
+++ b/frontend/src/routes/settings/security/+page.svelte
@@ -1,8 +1,8 @@
<script lang="ts">
+ import * as Card from '$lib/components/ui/card';
import { z } from 'zod/v4';
import { getContext, onMount } from 'svelte';
import { createForm } from '$lib/utils/form.utils';
- import * as Card from '$lib/components/ui/card';
import { Button } from '$lib/components/ui/button';
import SwitchWithLabel from '$lib/components/form/labeled-switch.svelte';
import OidcConfigDialog from '$lib/components/dialogs/oidc-config-dialog.svelte';
@@ -17,7 +17,7 @@
import TextInputWithLabel from '$lib/components/form/text-input-with-label.svelte';
import settingsStore from '$lib/stores/config-store';
import { settingsService } from '$lib/services/settings-service';
- import { SettingsPageLayout } from '$lib/layouts/index.js';
+ import { SettingsPageLayout } from '$lib/layouts';
let { data }: { data: PageData } = $props();
let currentSettings = $state<Settings>(data.settings);
@@ -222,16 +222,11 @@
{#snippet mainContent()}
<fieldset disabled={isReadOnly} class="relative">
<div class="space-y-4 sm:space-y-6">
- <Card.Root class="overflow-hidden pt-0">
- <Card.Header class="bg-muted/20 border-b !py-4">
- <div class="flex items-center gap-3">
- <div class="bg-primary/10 text-primary ring-primary/20 flex size-8 items-center justify-center rounded-lg ring-1">
- <LockIcon class="size-4" />
- </div>
- <div>
- <Card.Title class="text-base">{m.security_authentication_heading()}</Card.Title>
- <Card.Description class="text-xs">Configure login methods for your application</Card.Description>
- </div>
+ <Card.Root>
+ <Card.Header icon={LockIcon}>
+ <div class="flex flex-col space-y-1.5">
+ <Card.Title>{m.security_authentication_heading()}</Card.Title>
+ <Card.Description>Configure login methods for your application</Card.Description>
</div>
</Card.Header>
<Card.Content class="px-3 py-4 sm:px-6">
@@ -284,16 +279,11 @@
</Card.Content>
</Card.Root>
- <Card.Root class="overflow-hidden pt-0">
- <Card.Header class="bg-muted/20 border-b !py-4">
- <div class="flex items-center gap-3">
- <div class="bg-primary/10 text-primary ring-primary/20 flex size-8 items-center justify-center rounded-lg ring-1">
- <ClockIcon class="size-4" />
- </div>
- <div>
- <Card.Title class="text-base">{m.security_session_heading()}</Card.Title>
- <Card.Description class="text-xs">Configure session timeout and duration</Card.Description>
- </div>
+ <Card.Root>
+ <Card.Header icon={ClockIcon} class="items-start">
+ <div class="flex flex-col space-y-1.5">
+ <Card.Title>{m.security_session_heading()}</Card.Title>
+ <Card.Description>Configure session timeout and duration</Card.Description>
</div>
</Card.Header>
<Card.Content class="px-3 py-4 sm:px-6">
@@ -307,16 +297,11 @@
</Card.Content>
</Card.Root>
- <Card.Root class="overflow-hidden pt-0">
- <Card.Header class="bg-muted/20 border-b !py-4">
- <div class="flex items-center gap-3">
- <div class="bg-primary/10 text-primary ring-primary/20 flex size-8 items-center justify-center rounded-lg ring-1">
- <KeyIcon class="size-4" />
- </div>
- <div>
- <Card.Title class="text-base">{m.security_password_policy_label()}</Card.Title>
- <Card.Description class="text-xs">Set password strength requirements</Card.Description>
- </div>
+ <Card.Root>
+ <Card.Header icon={KeyIcon} class="items-start">
+ <div class="flex flex-col space-y-1.5">
+ <Card.Title>{m.security_password_policy_label()}</Card.Title>
+ <Card.Description>Set password strength requirements</Card.Description>
</div>
</Card.Header>
<Card.Content class="px-3 py-4 sm:px-6">
diff --git a/frontend/src/routes/settings/users/+page.ts b/frontend/src/routes/settings/users/+page.ts
index 165565917..4181e3043 100644
--- a/frontend/src/routes/settings/users/+page.ts
+++ b/frontend/src/routes/settings/users/+page.ts
@@ -1,20 +1,21 @@
import { settingsService } from '$lib/services/settings-service';
import { userService } from '$lib/services/user-service';
import type { SearchPaginationSortRequest } from '$lib/types/pagination.type';
+import { resolveInitialTableRequest } from '$lib/utils/table-persistence.util';
export const load = async () => {
const settings = await settingsService.getSettings();
- const userRequestOptions: SearchPaginationSortRequest = {
+ const userRequestOptions = resolveInitialTableRequest('arcane-users-table', {
pagination: {
page: 1,
limit: 20
},
sort: {
column: 'Username',
- direction: 'asc' as const
+ direction: 'asc'
}
- };
+ } satisfies SearchPaginationSortRequest);
const users = await userService.getUsers(userRequestOptions);
diff --git a/frontend/src/routes/settings/users/user-table.svelte b/frontend/src/routes/settings/users/user-table.svelte
index f6c28fd9e..66668d7bf 100644
--- a/frontend/src/routes/settings/users/user-table.svelte
+++ b/frontend/src/routes/settings/users/user-table.svelte
@@ -14,8 +14,10 @@
import type { Paginated, SearchPaginationSortRequest } from '$lib/types/pagination.type';
import type { User } from '$lib/types/user.type';
import type { ColumnSpec } from '$lib/components/arcane-table';
+ import { UniversalMobileCard } from '$lib/components/arcane-table';
import { m } from '$lib/paraglide/messages';
import { userService } from '$lib/services/user-service';
+ import UserIcon from '@lucide/svelte/icons/user';
let {
users = $bindable(),
@@ -124,6 +126,14 @@
{ accessorKey: 'email', title: m.common_email(), sortable: true, cell: EmailCell },
{ accessorKey: 'roles', title: m.common_role(), sortable: true, cell: RoleCell }
] satisfies ColumnSpec<User>[];
+
+ const mobileFields = [
+ { id: 'displayName', label: m.common_display_name(), defaultVisible: true },
+ { id: 'email', label: m.common_email(), defaultVisible: true },
+ { id: 'roles', label: m.common_role(), defaultVisible: true }
+ ];
+
+ let mobileFieldVisibility = $state<Record<string, boolean>>({});
</script>
{#snippet UsernameCell({ item }: { item: User })}
@@ -142,6 +152,42 @@
<StatusBadge text={getRoleText(item.roles)} variant={getRoleBadgeVariant(item.roles)} />
{/snippet}
+{#snippet UserMobileCardSnippet({
+ row,
+ item,
+ mobileFieldVisibility
+}: {
+ row: any;
+ item: User;
+ mobileFieldVisibility: Record<string, boolean>;
+})}
+ <UniversalMobileCard
+ {item}
+ icon={{ component: UserIcon, variant: 'blue' }}
+ title={(item: User) => item.username}
+ subtitle={(item: User) => ((mobileFieldVisibility.email ?? true) && item.email ? item.email : null)}
+ badges={[
+ (item: User) =>
+ (mobileFieldVisibility.roles ?? true)
+ ? {
+ variant: getRoleBadgeVariant(item.roles) === 'red' ? 'red' : 'green',
+ text: getRoleText(item.roles)
+ }
+ : null
+ ]}
+ fields={[
+ {
+ label: m.common_display_name(),
+ getValue: (item: User) => item.displayName,
+ icon: UserIcon,
+ iconVariant: 'gray' as const,
+ show: (mobileFieldVisibility.displayName ?? true) && !!item.displayName
+ }
+ ]}
+ rowActions={RowActions}
+ />
+{/snippet}
+
{#snippet RowActions({ item }: { item: User })}
<DropdownMenu.Root>
<DropdownMenu.Trigger>
@@ -169,12 +215,14 @@
</DropdownMenu.Root>
{/snippet}
-<Card.Root>
- <Card.Content class="py-5">
+<Card.Root class="flex flex-col gap-6 py-3">
+ <Card.Content class="px-6 py-5">
<ArcaneTable
+ persistKey="arcane-users-table"
items={users}
bind:requestOptions
bind:selectedIds
+ bind:mobileFieldVisibility
onRemoveSelected={(ids) => handleDeleteSelected()}
onRefresh={async (options) => {
requestOptions = options;
@@ -182,7 +230,9 @@
return users;
}}
{columns}
+ {mobileFields}
rowActions={RowActions}
+ mobileCard={UserMobileCardSnippet}
/>
</Card.Content>
</Card.Root>
diff --git a/frontend/src/routes/volumes/+page.ts b/frontend/src/routes/volumes/+page.ts
index c25f66452..c04c679dd 100644
--- a/frontend/src/routes/volumes/+page.ts
+++ b/frontend/src/routes/volumes/+page.ts
@@ -1,21 +1,24 @@
import { volumeService } from '$lib/services/volume-service';
import type { SearchPaginationSortRequest } from '$lib/types/pagination.type';
+import { resolveInitialTableRequest } from '$lib/utils/table-persistence.util';
import type { PageLoad } from './$types';
export const load: PageLoad = async () => {
- const volumeRequestOptions: SearchPaginationSortRequest = {
+ const volumeRequestOptions = resolveInitialTableRequest('arcane-volumes-table', {
pagination: {
page: 1,
limit: 20
},
sort: {
column: 'name',
- direction: 'asc' as const
+ direction: 'asc'
}
- };
+ } satisfies SearchPaginationSortRequest);
- const volumes = await volumeService.getVolumes(volumeRequestOptions);
- const volumeUsageCounts = await volumeService.getVolumeUsageCounts();
+ const [volumes, volumeUsageCounts] = await Promise.all([
+ volumeService.getVolumes(volumeRequestOptions),
+ volumeService.getVolumeUsageCounts()
+ ]);
return { volumes, volumeRequestOptions, volumeUsageCounts };
};
diff --git a/frontend/src/routes/volumes/[volumeName]/+page.svelte b/frontend/src/routes/volumes/[volumeName]/+page.svelte
index d3ecef158..6261af382 100644
--- a/frontend/src/routes/volumes/[volumeName]/+page.svelte
+++ b/frontend/src/routes/volumes/[volumeName]/+page.svelte
@@ -110,13 +110,12 @@
{#if volume}
<div class="space-y-6">
- <Card.Root class="pt-0">
- <Card.Header class="bg-muted rounded-t-xl p-4">
- <Card.Title class="flex items-center gap-2 text-lg">
- <InfoIcon class="text-primary size-5" />
- {m.volumes_details_title()}
- </Card.Title>
- <Card.Description>{m.volumes_details_description()}</Card.Description>
+ <Card.Root>
+ <Card.Header icon={InfoIcon}>
+ <div class="flex flex-col space-y-1.5">
+ <Card.Title>{m.volumes_details_title()}</Card.Title>
+ <Card.Description>{m.volumes_details_description()}</Card.Description>
+ </div>
</Card.Header>
<Card.Content class="p-4">
<div class="grid grid-cols-1 gap-x-4 gap-y-6 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-6">
@@ -126,7 +125,9 @@
</div>
<div class="min-w-0 flex-1">
<p class="text-muted-foreground text-sm font-medium">{m.common_name()}</p>
- <p class="mt-1 cursor-pointer text-sm font-semibold break-all select-all sm:text-base" title="Click to select">{volume.name}</p>
+ <p class="mt-1 cursor-pointer text-sm font-semibold break-all select-all sm:text-base" title="Click to select">
+ {volume.name}
+ </p>
</div>
</div>
@@ -136,7 +137,9 @@
</div>
<div class="min-w-0 flex-1">
<p class="text-muted-foreground text-sm font-medium">{m.common_driver()}</p>
- <p class="mt-1 cursor-pointer text-sm font-semibold select-all sm:text-base" title="Click to select">{volume.driver}</p>
+ <p class="mt-1 cursor-pointer text-sm font-semibold select-all sm:text-base" title="Click to select">
+ {volume.driver}
+ </p>
</div>
</div>
@@ -146,7 +149,9 @@
</div>
<div class="min-w-0 flex-1">
<p class="text-muted-foreground text-sm font-medium">{m.common_created()}</p>
- <p class="mt-1 cursor-pointer text-sm font-semibold select-all sm:text-base" title="Click to select">{createdDate}</p>
+ <p class="mt-1 cursor-pointer text-sm font-semibold select-all sm:text-base" title="Click to select">
+ {createdDate}
+ </p>
</div>
</div>
@@ -156,7 +161,9 @@
</div>
<div class="min-w-0 flex-1">
<p class="text-muted-foreground text-sm font-medium">{m.common_scope()}</p>
- <p class="mt-1 cursor-pointer text-sm font-semibold capitalize select-all sm:text-base" title="Click to select">{volume.scope}</p>
+ <p class="mt-1 cursor-pointer text-sm font-semibold capitalize select-all sm:text-base" title="Click to select">
+ {volume.scope}
+ </p>
</div>
</div>
@@ -182,8 +189,8 @@
</div>
<div class="min-w-0 flex-1">
<p class="text-muted-foreground text-sm font-medium">{m.common_mountpoint()}</p>
- <div class="bg-muted/50 mt-2 rounded-lg border p-3 cursor-pointer select-all" title="Click to select">
- <code class="break-all font-mono text-sm">{volume.mountpoint}</code>
+ <div class="bg-muted/50 mt-2 cursor-pointer rounded-lg border p-3 select-all" title="Click to select">
+ <code class="font-mono text-sm break-all">{volume.mountpoint}</code>
</div>
</div>
</div>
@@ -191,43 +198,49 @@
</Card.Content>
</Card.Root>
- <Card.Root class="pt-0">
- <Card.Header class="bg-muted rounded-t-xl p-4">
- <Card.Title class="flex items-center gap-2 text-lg">
- <ContainerIcon class="text-primary size-5" />
- {m.volumes_containers_using_title()}
- </Card.Title>
- <Card.Description>{m.volumes_containers_using_description()}</Card.Description>
+ <Card.Root>
+ <Card.Header icon={ContainerIcon}>
+ <div class="flex flex-col space-y-1.5">
+ <Card.Title>{m.volumes_containers_using_title()}</Card.Title>
+ <Card.Description>{m.volumes_containers_using_description()}</Card.Description>
+ </div>
</Card.Header>
<Card.Content class="p-4">
{#if containersDetailed.length > 0}
- <div class="bg-card divide-y rounded-lg border">
- {#each containersDetailed as c (c.id)}
- <div class="flex flex-col p-3 sm:flex-row sm:items-center">
- <div class="mb-2 w-full break-all font-medium sm:mb-0 sm:w-1/3">
- <a href="/containers/{c.id}" class="text-primary flex items-center hover:underline">
- <ContainerIcon class="text-muted-foreground mr-1.5 size-3.5" />
- {c.name}
- </a>
+ <Card.Root variant="outlined">
+ <Card.Content class="divide-y p-0">
+ {#each containersDetailed as c (c.id)}
+ <div class="flex flex-col p-3 sm:flex-row sm:items-center">
+ <div class="mb-2 w-full font-medium break-all sm:mb-0 sm:w-1/3">
+ <a href="/containers/{c.id}" class="text-primary flex items-center hover:underline">
+ <ContainerIcon class="text-muted-foreground mr-1.5 size-3.5" />
+ {c.name}
+ </a>
+ </div>
+ <div class="w-full pl-0 sm:w-2/3 sm:pl-4">
+ <code
+ class="bg-muted text-muted-foreground cursor-pointer rounded px-1.5 py-0.5 font-mono text-xs break-all select-all sm:text-sm"
+ title="Click to select"
+ >
+ {truncateString(c.id, 48)}
+ </code>
+ </div>
</div>
- <div class="w-full pl-0 sm:w-2/3 sm:pl-4">
- <code class="bg-muted text-muted-foreground break-all rounded px-1.5 py-0.5 font-mono text-xs sm:text-sm cursor-pointer select-all" title="Click to select">
- {truncateString(c.id, 48)}
- </code>
- </div>
- </div>
- {/each}
- </div>
+ {/each}
+ </Card.Content>
+ </Card.Root>
{:else if volume.containers && volume.containers.length > 0}
<!-- Fallback to IDs if names not resolved -->
- <div class="divide-y rounded-lg border">
- {#each volume.containers as id (id)}
- <div class="flex items-center justify-between gap-3 p-3">
- <code class="break-all font-mono text-sm">{truncateString(id, 48)}</code>
- <a href={`/containers/${id}`} class="text-primary text-sm hover:underline">{m.common_view()}</a>
- </div>
- {/each}
- </div>
+ <Card.Root variant="subtle">
+ <Card.Content class="divide-y p-0">
+ {#each volume.containers as id (id)}
+ <div class="flex items-center justify-between gap-3 p-3">
+ <code class="font-mono text-sm break-all">{truncateString(id, 48)}</code>
+ <a href={`/containers/${id}`} class="text-primary text-sm hover:underline">{m.common_view()}</a>
+ </div>
+ {/each}
+ </Card.Content>
+ </Card.Root>
{:else}
<div class="text-muted-foreground">{m.volumes_no_containers_using()}</div>
{/if}
@@ -235,25 +248,27 @@
</Card.Root>
{#if volume.labels && Object.keys(volume.labels).length > 0}
- <Card.Root class="pt-0">
- <Card.Header class="bg-muted rounded-t-xl p-4">
- <Card.Title class="flex items-center gap-2 text-lg">
- <TagIcon class="text-primary size-5" />
- {m.common_labels()}
- </Card.Title>
- <Card.Description>{m.volumes_labels_description()}</Card.Description>
+ <Card.Root>
+ <Card.Header icon={TagIcon}>
+ <div class="flex flex-col space-y-1.5">
+ <Card.Title>{m.common_labels()}</Card.Title>
+ <Card.Description>{m.volumes_labels_description()}</Card.Description>
+ </div>
</Card.Header>
<Card.Content class="p-4">
- <div class="bg-card divide-y rounded-lg border">
+ <div class="grid grid-cols-1 gap-3 lg:grid-cols-2 2xl:grid-cols-3">
{#each Object.entries(volume.labels) as [key, value] (key)}
- <div class="flex flex-col p-3 sm:flex-row">
- <div class="text-muted-foreground mb-2 w-full break-all font-medium sm:mb-0 sm:w-1/3">
- {key}
- </div>
- <div class="bg-muted/50 w-full break-all rounded p-2 font-mono text-xs sm:w-2/3 sm:text-sm cursor-pointer select-all" title="Click to select">
- {value}
- </div>
- </div>
+ <Card.Root variant="subtle">
+ <Card.Content class="flex flex-col gap-2 p-4">
+ <div class="text-muted-foreground text-xs font-semibold tracking-wide break-all uppercase">{key}</div>
+ <div
+ class="text-foreground cursor-pointer font-mono text-sm font-medium break-all select-all"
+ title="Click to select"
+ >
+ {value}
+ </div>
+ </Card.Content>
+ </Card.Root>
{/each}
</div>
</Card.Content>
@@ -261,25 +276,27 @@
{/if}
{#if volume.options && Object.keys(volume.options).length > 0}
- <Card.Root class="pt-0">
- <Card.Header class="bg-muted rounded-t-xl p-4">
- <Card.Title class="flex items-center gap-2 text-lg">
- <HardDriveIcon class="text-primary size-5" />
- {m.common_driver_options()}
- </Card.Title>
- <Card.Description>{m.volumes_driver_options_description()}</Card.Description>
+ <Card.Root>
+ <Card.Header icon={HardDriveIcon}>
+ <div class="flex flex-col space-y-1.5">
+ <Card.Title>{m.common_driver_options()}</Card.Title>
+ <Card.Description>{m.volumes_driver_options_description()}</Card.Description>
+ </div>
</Card.Header>
<Card.Content class="p-4">
- <div class="bg-card divide-y rounded-lg border">
+ <div class="grid grid-cols-1 gap-3 lg:grid-cols-2 2xl:grid-cols-3">
{#each Object.entries(volume.options) as [key, value] (key)}
- <div class="flex flex-col p-3 sm:flex-row">
- <div class="text-muted-foreground mb-2 w-full break-all font-medium sm:mb-0 sm:w-1/3">
- {key}
- </div>
- <div class="bg-muted/50 w-full break-all rounded p-2 font-mono text-xs sm:w-2/3 sm:text-sm cursor-pointer select-all" title="Click to select">
- {value}
- </div>
- </div>
+ <Card.Root variant="subtle">
+ <Card.Content class="flex flex-col gap-2 p-4">
+ <div class="text-muted-foreground text-xs font-semibold tracking-wide break-all uppercase">{key}</div>
+ <div
+ class="text-foreground cursor-pointer font-mono text-sm font-medium break-all select-all"
+ title="Click to select"
+ >
+ {value}
+ </div>
+ </Card.Content>
+ </Card.Root>
{/each}
</div>
</Card.Content>
@@ -288,7 +305,7 @@
{#if (!volume.labels || Object.keys(volume.labels).length === 0) && (!volume.options || Object.keys(volume.options).length === 0)}
<Card.Root class="bg-muted/10 border shadow-sm">
- <Card.Content class="pb-6 pt-6 text-center">
+ <Card.Content class="pt-6 pb-6 text-center">
<div class="flex flex-col items-center justify-center">
<div class="bg-muted/30 mb-4 rounded-full p-3">
<TagIcon class="text-muted-foreground size-5 opacity-50" />
diff --git a/frontend/src/routes/volumes/volume-table.svelte b/frontend/src/routes/volumes/volume-table.svelte
index 692b1ab93..d898bf8fa 100644
--- a/frontend/src/routes/volumes/volume-table.svelte
+++ b/frontend/src/routes/volumes/volume-table.svelte
@@ -17,6 +17,9 @@
import type { Paginated, SearchPaginationSortRequest } from '$lib/types/pagination.type';
import type { VolumeSummaryDto } from '$lib/types/volume.type';
import type { ColumnSpec } from '$lib/components/arcane-table';
+ import { UniversalMobileCard } from '$lib/components/arcane-table/index.js';
+ import DatabaseIcon from '@lucide/svelte/icons/database';
+ import CalendarIcon from '@lucide/svelte/icons/calendar';
import { m } from '$lib/paraglide/messages';
import { volumeService } from '$lib/services/volume-service';
@@ -97,17 +100,26 @@
}
const columns = [
- { accessorKey: 'id', title: m.common_id(), hidden: true },
{ accessorKey: 'name', title: m.common_name(), sortable: true, cell: NameCell },
+ { accessorKey: 'id', title: m.common_id(), hidden: true },
{
accessorKey: 'inUse',
title: m.common_status(),
sortable: true,
cell: StatusCell
},
- { accessorKey: 'driver', title: m.common_driver(), sortable: true },
- { accessorKey: 'createdAt', title: m.common_created(), sortable: true, cell: CreatedCell }
+ { accessorKey: 'createdAt', title: m.common_created(), sortable: true, cell: CreatedCell },
+ { accessorKey: 'driver', title: m.common_driver(), sortable: true }
] satisfies ColumnSpec<VolumeSummaryDto>[];
+
+ const mobileFields = [
+ { id: 'id', label: m.common_id(), defaultVisible: true },
+ { id: 'status', label: m.common_status(), defaultVisible: true },
+ { id: 'createdAt', label: m.common_created(), defaultVisible: true },
+ { id: 'driver', label: m.common_driver(), defaultVisible: true }
+ ];
+
+ let mobileFieldVisibility = $state<Record<string, boolean>>({});
</script>
{#snippet NameCell({ item }: { item: VolumeSummaryDto })}
@@ -128,6 +140,52 @@
{format(new Date(String(value)), 'PP p')}
{/snippet}
+{#snippet VolumeMobileCardSnippet({
+ row,
+ item,
+ mobileFieldVisibility
+}: {
+ row: any;
+ item: VolumeSummaryDto;
+ mobileFieldVisibility: Record<string, boolean>;
+})}
+ <UniversalMobileCard
+ {item}
+ icon={(item) => ({
+ component: DatabaseIcon,
+ variant: item.inUse ? 'emerald' : 'amber'
+ })}
+ title={(item) => item.name}
+ subtitle={(item) => ((mobileFieldVisibility.id ?? true) ? item.id : null)}
+ badges={[
+ (item) =>
+ (mobileFieldVisibility.status ?? true)
+ ? item.inUse
+ ? { variant: 'green' as const, text: m.common_in_use() }
+ : { variant: 'amber' as const, text: m.common_unused() }
+ : null
+ ]}
+ fields={[
+ {
+ label: m.common_driver(),
+ getValue: (item: VolumeSummaryDto) => item.driver,
+ icon: DatabaseIcon,
+ iconVariant: 'gray' as const,
+ show: mobileFieldVisibility.driver ?? true
+ }
+ ]}
+ footer={(mobileFieldVisibility.createdAt ?? true)
+ ? {
+ label: m.common_created(),
+ getValue: (item) => format(new Date(String(item.createdAt)), 'PP p'),
+ icon: CalendarIcon
+ }
+ : undefined}
+ rowActions={RowActions}
+ onclick={() => goto(`/volumes/${item.id}`)}
+ />
+{/snippet}
+
{#snippet RowActions({ item }: { item: VolumeSummaryDto })}
<DropdownMenu.Root>
<DropdownMenu.Trigger>
@@ -153,17 +211,20 @@
</DropdownMenu.Root>
{/snippet}
-<Card.Root>
- <Card.Content class="py-5">
+<Card.Root class="flex flex-col gap-6 py-3">
+ <Card.Content class="px-6 py-5">
<ArcaneTable
persistKey="arcane-volumes-table"
items={volumes}
bind:requestOptions
bind:selectedIds
+ bind:mobileFieldVisibility
onRemoveSelected={(ids) => handleDeleteSelected(ids)}
onRefresh={async (options) => (volumes = await volumeService.getVolumes(options))}
{columns}
+ {mobileFields}
rowActions={RowActions}
+ mobileCard={VolumeMobileCardSnippet}
/>
</Card.Content>
</Card.Root>