Skip to content

Modern Docker Management, Designed for Everyone

feat: arcane specific labels for icons and custom urls (#1561)

Kyle Mendell777bae13c670
diff --git a/backend/internal/services/project_service.go b/backend/internal/services/project_service.go
index 8cf992628..921d30141 100644
--- a/backend/internal/services/project_service.go
+++ b/backend/internal/services/project_service.go
@@ -27,6 +27,7 @@ import (
"github.com/getarcaneapp/arcane/backend/internal/utils/pathmapper"
"github.com/getarcaneapp/arcane/backend/internal/utils/projects"
"github.com/getarcaneapp/arcane/backend/internal/utils/timeouts"
+ libproject "github.com/getarcaneapp/arcane/backend/pkg/projects"
"github.com/getarcaneapp/arcane/types/containerregistry"
"github.com/getarcaneapp/arcane/types/project"
"gorm.io/gorm"
@@ -110,6 +111,7 @@ type ProjectServiceInfo struct {
ContainerName string `json:"container_name"`
Ports []string `json:"ports"`
Health *string `json:"health,omitempty"`
+ IconURL string `json:"icon_url,omitempty"`
ServiceConfig *composetypes.ServiceConfig `json:"service_config,omitempty"`
}
@@ -214,6 +216,11 @@ func (s *ProjectService) GetProjectServices(ctx context.Context, projectID strin
return []ProjectServiceInfo{}, fmt.Errorf("failed to load compose project from %s: %w", projectFromDb.Path, loadErr)
}
+ meta, metaErr := libproject.ParseArcaneComposeMetadata(composeFileFullPath)
+ if metaErr != nil {
+ slog.WarnContext(ctx, "failed to parse Arcane compose metadata", "path", composeFileFullPath, "error", metaErr)
+ }
+
containers, err := projects.ComposePs(ctx, project, nil, true)
if err != nil {
slog.Error("compose ps error", "projectName", project.Name, "error", err)
@@ -248,6 +255,7 @@ func (s *ProjectService) GetProjectServices(ctx context.Context, projectID strin
ContainerName: c.Name,
Ports: formatPorts(c.Publishers),
Health: health,
+ IconURL: meta.ServiceIcons[c.Service],
ServiceConfig: svcConfig,
})
have[c.Service] = true
@@ -261,6 +269,7 @@ func (s *ProjectService) GetProjectServices(ctx context.Context, projectID strin
Image: svc.Image,
Status: "stopped",
Ports: []string{},
+ IconURL: meta.ServiceIcons[svc.Name],
ServiceConfig: &svcCopy,
})
}
@@ -296,6 +305,9 @@ func (s *ProjectService) GetProjectDetails(ctx context.Context, projectID string
resp.EnvContent = envContent
resp.DirName = utils.DerefString(proj.DirName)
resp.GitOpsManagedBy = proj.GitOpsManagedBy
+ meta := s.getProjectMetadataFromComposeContent(ctx, composeContent)
+ resp.IconURL = meta.ProjectIconURL
+ resp.URLs = meta.ProjectURLS
// Default counts/status from DB (will be overridden if runtime check succeeds)
resp.ServiceCount = proj.ServiceCount
@@ -330,6 +342,7 @@ func (s *ProjectService) GetProjectDetails(ctx context.Context, projectID string
ContainerName: svc.ContainerName,
Ports: svc.Ports,
Health: svc.Health,
+ IconURL: svc.IconURL,
ServiceConfig: svc.ServiceConfig,
}
}
@@ -1440,6 +1453,9 @@ func (s *ProjectService) mapProjectToDto(ctx context.Context, p models.Project,
resp.UpdatedAt = p.UpdatedAt.Format(time.RFC3339)
resp.DirName = utils.DerefString(p.DirName)
resp.GitOpsManagedBy = p.GitOpsManagedBy
+ meta := s.getProjectMetadataFromPath(ctx, p.Path)
+ resp.IconURL = meta.ProjectIconURL
+ resp.URLs = meta.ProjectURLS
// Find containers for this project
normName := normalizeComposeProjectName(p.Name)
@@ -1536,6 +1552,35 @@ func (s *ProjectService) mapProjectToDto(ctx context.Context, p models.Project,
return resp
}
+func (s *ProjectService) getProjectMetadataFromPath(ctx context.Context, projectPath string) libproject.ArcaneComposeMetadata {
+ composeFile, err := projects.DetectComposeFile(projectPath)
+ if err != nil {
+ return libproject.ArcaneComposeMetadata{ServiceIcons: map[string]string{}}
+ }
+
+ meta, err := libproject.ParseArcaneComposeMetadata(composeFile)
+ if err != nil {
+ slog.WarnContext(ctx, "failed to parse Arcane compose metadata", "path", composeFile, "error", err)
+ return libproject.ArcaneComposeMetadata{ServiceIcons: map[string]string{}}
+ }
+
+ return meta
+}
+
+func (s *ProjectService) getProjectMetadataFromComposeContent(ctx context.Context, composeContent string) libproject.ArcaneComposeMetadata {
+ if composeContent == "" {
+ return libproject.ArcaneComposeMetadata{ServiceIcons: map[string]string{}}
+ }
+
+ meta, err := libproject.ParseArcaneComposeMetadataFromContent([]byte(composeContent))
+ if err != nil {
+ slog.WarnContext(ctx, "failed to parse Arcane compose metadata", "error", err)
+ return libproject.ArcaneComposeMetadata{ServiceIcons: map[string]string{}}
+ }
+
+ return meta
+}
+
// End Table Functions
func (s *ProjectService) countServicesFromCompose(ctx context.Context, p models.Project) (int, error) {
diff --git a/backend/pkg/projects/custom_labels.go b/backend/pkg/projects/custom_labels.go
new file mode 100644
index 000000000..fcd2610ba
--- /dev/null
+++ b/backend/pkg/projects/custom_labels.go
@@ -0,0 +1,137 @@
+// Package projects provides utilities for managing Docker Compose projects and their metadata.
+package projects
+
+import (
+ "fmt"
+ "os"
+ "strings"
+
+ "github.com/getarcaneapp/arcane/backend/pkg/utils"
+ "github.com/goccy/go-yaml"
+)
+
+const (
+ // ArcaneIconLabel is the full reverse-DNS label key for service-level icons.
+ ArcaneIconLabel = "com.getarcaneapp.arcane.icon"
+
+ arcaneBlockKey = "x-arcane"
+ arcaneIconKey = "icon"
+ arcaneIconsKey = "icons"
+ arcaneURLsKey = "urls"
+ composeServicesKey = "services"
+ composeLabelsKey = "labels"
+ composeDeployKey = "deploy"
+)
+
+// ArcaneComposeMetadata represents Arcane-specific configuration extracted from a Compose file.
+type ArcaneComposeMetadata struct {
+ // ProjectIconURL is the URL to an icon representing the entire project.
+ ProjectIconURL string
+ // ProjectURLS are additional URLs related to the project (e.g., documentation, homepage).
+ ProjectURLS []string
+ // ServiceIcons maps service names to their respective icon identifiers or URLs.
+ ServiceIcons map[string]string
+}
+
+// ParseArcaneComposeMetadata reads a Docker Compose file and extracts Arcane-specific metadata.
+func ParseArcaneComposeMetadata(composeFilePath string) (ArcaneComposeMetadata, error) {
+ content, err := os.ReadFile(composeFilePath)
+ if err != nil {
+ return ArcaneComposeMetadata{}, fmt.Errorf("failed to read compose file: %w", err)
+ }
+
+ return ParseArcaneComposeMetadataFromContent(content)
+}
+
+// ParseArcaneComposeMetadataFromContent extracts Arcane-specific metadata from a Docker Compose file's content.
+func ParseArcaneComposeMetadataFromContent(content []byte) (ArcaneComposeMetadata, error) {
+ meta := ArcaneComposeMetadata{ServiceIcons: map[string]string{}}
+ if len(content) == 0 {
+ return meta, nil
+ }
+
+ composeData := map[string]interface{}{}
+ if err := yaml.Unmarshal(content, &composeData); err != nil {
+ return meta, fmt.Errorf("failed to parse compose content: %w", err)
+ }
+
+ if arcaneBlock, ok := utils.AsStringMap(composeData[arcaneBlockKey]); ok {
+ meta.ProjectIconURL = utils.FirstNonEmpty(getFirstString(arcaneBlock[arcaneIconKey]), getFirstString(arcaneBlock[arcaneIconsKey]))
+ meta.ProjectURLS = utils.UniqueNonEmptyStrings(utils.Collect(arcaneBlock[arcaneURLsKey], utils.ToString))
+ }
+
+ services, ok := utils.AsStringMap(composeData[composeServicesKey])
+ if !ok {
+ return meta, nil
+ }
+
+ for name, serviceRaw := range services {
+ svc, ok := utils.AsStringMap(serviceRaw)
+ if !ok {
+ continue
+ }
+
+ icon := findArcaneIconLabel(svc[composeLabelsKey])
+ if icon == "" {
+ if deployBlock, ok := utils.AsStringMap(svc[composeDeployKey]); ok {
+ icon = findArcaneIconLabel(deployBlock[composeLabelsKey])
+ }
+ }
+
+ if icon == "" {
+ if arcaneBlock, ok := utils.AsStringMap(svc[arcaneBlockKey]); ok {
+ icon = utils.FirstNonEmpty(getFirstString(arcaneBlock[arcaneIconKey]), getFirstString(arcaneBlock[arcaneIconsKey]))
+ }
+ }
+
+ if icon != "" {
+ meta.ServiceIcons[name] = icon
+ }
+ }
+
+ return meta, nil
+}
+
+// getFirstString retrieves the first non-empty string from a value (single or slice).
+func getFirstString(v any) string {
+ for _, s := range utils.Collect(v, utils.ToString) {
+ if s != "" {
+ return s
+ }
+ }
+ return ""
+}
+
+// findArcaneIconLabel attempts to locate an Arcane icon label within service labels.
+// It supports both map[string]string and []string label formats.
+func findArcaneIconLabel(labels any) string {
+ if labelMap, ok := utils.AsStringMap(labels); ok {
+ for key, value := range labelMap {
+ if isArcaneIconLabel(key) {
+ return utils.ToString(value)
+ }
+ }
+ }
+
+ for _, s := range utils.Collect(labels, utils.ToString) {
+ if key, value, ok := parseLabelPair(s); ok && isArcaneIconLabel(key) {
+ return value
+ }
+ }
+
+ return ""
+}
+
+// parseLabelPair parses a "KEY=VALUE" string into its components.
+func parseLabelPair(raw string) (string, string, bool) {
+ parts := strings.SplitN(raw, "=", 2)
+ if len(parts) != 2 {
+ return "", "", false
+ }
+ return strings.TrimSpace(parts[0]), strings.TrimSpace(parts[1]), true
+}
+
+// isArcaneIconLabel checks if a label key matches the Arcane icon label definition.
+func isArcaneIconLabel(key string) bool {
+ return strings.ToLower(strings.TrimSpace(key)) == ArcaneIconLabel
+}
diff --git a/backend/pkg/utils/strings.go b/backend/pkg/utils/strings.go
new file mode 100644
index 000000000..c5efa55de
--- /dev/null
+++ b/backend/pkg/utils/strings.go
@@ -0,0 +1,110 @@
+// New string utilties, will move the rest over time.
+package utils
+
+import (
+ "fmt"
+ "strings"
+)
+
+// ToString converts any value to a trimmed string.
+func ToString(v any) string {
+ if v == nil {
+ return ""
+ }
+ var s string
+ switch val := v.(type) {
+ case string:
+ s = val
+ case fmt.Stringer:
+ s = val.String()
+ default:
+ s = fmt.Sprint(v)
+ }
+ return strings.TrimSpace(s)
+}
+
+// Collect transforms a value (single item or slice) into a slice of T using a mapper.
+func Collect[T any](value any, mapper func(any) T) []T {
+ if value == nil {
+ return nil
+ }
+
+ switch v := value.(type) {
+ case []any:
+ res := make([]T, len(v))
+ for i, item := range v {
+ res[i] = mapper(item)
+ }
+ return res
+ case []string:
+ res := make([]T, len(v))
+ for i, s := range v {
+ res[i] = mapper(s)
+ }
+ return res
+ default:
+ return []T{mapper(value)}
+ }
+}
+
+// AsStringMap attempts to convert any map-like interface to map[string]any.
+func AsStringMap(value any) (map[string]any, bool) {
+ if value == nil {
+ return nil, false
+ }
+ switch v := value.(type) {
+ case map[string]any:
+ return v, true
+ case map[string]string:
+ res := make(map[string]any, len(v))
+ for k, val := range v {
+ res[k] = val
+ }
+ return res, true
+ case map[any]any:
+ res := make(map[string]any, len(v))
+ for k, val := range v {
+ if s, ok := k.(string); ok {
+ res[s] = val
+ }
+ }
+ return res, len(res) > 0
+ }
+ return nil, false
+}
+
+// UniqueNonEmptyStrings returns unique, non-empty, trimmed strings.
+func UniqueNonEmptyStrings(items []string) []string {
+ if len(items) == 0 {
+ return nil
+ }
+
+ seen := make(map[string]struct{}, len(items))
+ result := make([]string, 0, len(items))
+ for _, item := range items {
+ s := strings.TrimSpace(item)
+ if s == "" {
+ continue
+ }
+ if _, exists := seen[s]; !exists {
+ seen[s] = struct{}{}
+ result = append(result, s)
+ }
+ }
+
+ if len(result) == 0 {
+ return nil
+ }
+
+ return result
+}
+
+// FirstNonEmpty returns the first non-empty string in a list of values.
+func FirstNonEmpty(values ...string) string {
+ for _, v := range values {
+ if v != "" {
+ return v
+ }
+ }
+ return ""
+}
diff --git a/frontend/src/lib/components/arcane-table/cards/universal-mobile-card.svelte b/frontend/src/lib/components/arcane-table/cards/universal-mobile-card.svelte
index 5fca61014..70380ec95 100644
--- a/frontend/src/lib/components/arcane-table/cards/universal-mobile-card.svelte
+++ b/frontend/src/lib/components/arcane-table/cards/universal-mobile-card.svelte
@@ -10,6 +10,8 @@
interface IconConfig {
component: Component<any>;
variant: IconVariant;
+ imageUrl?: string;
+ alt?: string;
}
interface BadgeConfig {
@@ -69,6 +71,11 @@
badges.map((b) => (typeof b === 'function' ? b(item) : b)).filter((b): b is BadgeConfig => b !== null)
);
+ let errorImageUrl = $state<string | undefined>(undefined);
+ const validImageUrl = $derived(
+ resolvedIcon?.imageUrl && resolvedIcon.imageUrl !== errorImageUrl ? resolvedIcon.imageUrl : null
+ );
+
const visibleFields = $derived(fields.filter((f) => f.show !== false));
const subtitleValue = $derived(subtitle?.(item));
const hasSubtitle = $derived(!!subtitleValue);
@@ -124,7 +131,19 @@
'ring-white/5'
)}
>
- <IconComponent class={cn(getIconTextClass(resolvedIcon.variant), compact ? 'size-3.5' : 'size-4')} />
+ {#if validImageUrl}
+ <img
+ src={validImageUrl}
+ alt={resolvedIcon.alt ?? ''}
+ loading="lazy"
+ decoding="async"
+ referrerpolicy="no-referrer"
+ class={cn('object-contain', compact ? 'size-5' : 'size-6')}
+ onerror={() => (errorImageUrl = resolvedIcon?.imageUrl)}
+ />
+ {:else}
+ <IconComponent class={cn(getIconTextClass(resolvedIcon.variant), compact ? 'size-3.5' : 'size-4')} />
+ {/if}
</div>
{/if}
<div class="min-w-0 flex-1">
diff --git a/frontend/src/lib/components/badges/port-badge.svelte b/frontend/src/lib/components/badges/port-badge.svelte
index 7adcccdc3..55fc527d6 100644
--- a/frontend/src/lib/components/badges/port-badge.svelte
+++ b/frontend/src/lib/components/badges/port-badge.svelte
@@ -3,6 +3,7 @@
import { m } from '$lib/paraglide/messages';
import * as ArcaneTooltip from '$lib/components/arcane-tooltip';
import settingsStore from '$lib/stores/config-store';
+ import { toPortHref } from '$lib/utils/url';
let { ports = [] as ContainerPorts[] } = $props<{
ports?: ContainerPorts[];
@@ -61,17 +62,6 @@
});
}
- function toHref(hostPort: string): string {
- try {
- const base = baseServerUrl || (typeof window !== 'undefined' ? window.location.origin : 'http://localhost');
- const url = new URL(base.startsWith('http') ? base : `http://${base}`);
- url.port = hostPort;
- return url.toString();
- } catch {
- return '#';
- }
- }
-
const allPorts = $derived(uniquePorts(ports));
const published = $derived(allPorts.filter((p) => p.isPublished));
const exposedOnly = $derived(allPorts.filter((p) => !p.isPublished));
@@ -85,8 +75,8 @@
<ArcaneTooltip.Root interactive>
<ArcaneTooltip.Trigger>
<a
- class="ring-offset-background focus-visible:ring-ring bg-background/70 dark:bg-sky-500/20 inline-flex items-center gap-1 rounded-lg border border-sky-700/20 dark:border-sky-400/40 px-2 py-1 text-[11px] dark:text-sky-100 shadow-sm transition-colors hover:border-sky-700/40 hover:bg-sky-500/10 dark:hover:border-sky-300/60 dark:hover:bg-sky-500/30 hover:shadow-md focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none"
- href={toHref(p.hostPort!)}
+ class="ring-offset-background focus-visible:ring-ring bg-background/70 inline-flex items-center gap-1 rounded-lg border border-sky-700/20 px-2 py-1 text-[11px] shadow-sm transition-colors hover:border-sky-700/40 hover:bg-sky-500/10 hover:shadow-md focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none dark:border-sky-400/40 dark:bg-sky-500/20 dark:text-sky-100 dark:hover:border-sky-300/60 dark:hover:bg-sky-500/30"
+ href={toPortHref(p.hostPort!, baseServerUrl)}
target="_blank"
rel="noopener noreferrer"
>
@@ -107,7 +97,7 @@
<ArcaneTooltip.Root>
<ArcaneTooltip.Trigger>
<span
- class="bg-background/50 dark:bg-slate-500/20 inline-flex items-center gap-1 rounded-lg border border-gray-600/30 dark:border-slate-400/40 px-2 py-1 text-[11px] text-gray-400 dark:text-slate-200 shadow-sm"
+ class="bg-background/50 inline-flex items-center gap-1 rounded-lg border border-gray-600/30 px-2 py-1 text-[11px] text-gray-400 shadow-sm dark:border-slate-400/40 dark:bg-slate-500/20 dark:text-slate-200"
>
<span class="tabular-nums">{p.containerPort}</span>
{#if p.proto}
diff --git a/frontend/src/lib/components/icon-image.svelte b/frontend/src/lib/components/icon-image.svelte
new file mode 100644
index 000000000..cccdbf557
--- /dev/null
+++ b/frontend/src/lib/components/icon-image.svelte
@@ -0,0 +1,44 @@
+<script lang="ts">
+ import type { Component } from 'svelte';
+ import { cn } from '$lib/utils';
+ import { ImagesIcon } from '$lib/icons';
+
+ let {
+ src,
+ alt = '',
+ fallback = ImagesIcon,
+ class: className = '',
+ containerClass = ''
+ }: {
+ src?: string | null;
+ alt?: string;
+ fallback?: Component<any>;
+ class?: string;
+ containerClass?: string;
+ } = $props();
+
+ let errorSrc = $state<string | null>(null);
+ let validSrc = $derived(src && src !== errorSrc ? src : null);
+</script>
+
+<div
+ class={cn(
+ 'bg-muted/40 flex items-center justify-center overflow-hidden rounded-lg ring-1 ring-white/5 ring-inset',
+ containerClass
+ )}
+>
+ {#if validSrc}
+ <img
+ src={validSrc}
+ {alt}
+ loading="lazy"
+ decoding="async"
+ referrerpolicy="no-referrer"
+ class={cn('object-contain', className)}
+ onerror={() => (errorSrc = src ?? null)}
+ />
+ {:else}
+ {@const FallbackIcon = fallback}
+ <FallbackIcon class={cn('text-muted-foreground', className)} />
+ {/if}
+</div>
diff --git a/frontend/src/lib/types/project.type.ts b/frontend/src/lib/types/project.type.ts
index 47374d2fa..4973ad076 100644
--- a/frontend/src/lib/types/project.type.ts
+++ b/frontend/src/lib/types/project.type.ts
@@ -59,6 +59,7 @@ export interface RuntimeService {
containerName?: string;
ports?: string[];
health?: string;
+ iconUrl?: string;
serviceConfig?: ProjectService;
}
@@ -66,6 +67,8 @@ export interface Project {
id: string;
name: string;
path: string;
+ iconUrl?: string;
+ urls?: string[];
runningCount: string;
serviceCount: string;
status: string;
diff --git a/frontend/src/lib/utils/arcane-labels.ts b/frontend/src/lib/utils/arcane-labels.ts
new file mode 100644
index 000000000..b58cb6464
--- /dev/null
+++ b/frontend/src/lib/utils/arcane-labels.ts
@@ -0,0 +1,15 @@
+const ARCANE_ICON_LABELS = ['arcane.icon', 'com.getarcaneapp.arcane.icon'];
+
+export function getArcaneIconUrlFromLabels(labels?: Record<string, string> | null): string | null {
+ if (!labels) return null;
+
+ for (const [key, value] of Object.entries(labels)) {
+ const normalizedKey = key.trim().toLowerCase();
+ if (ARCANE_ICON_LABELS.includes(normalizedKey)) {
+ const trimmed = value?.trim();
+ if (trimmed) return trimmed;
+ }
+ }
+
+ return null;
+}
diff --git a/frontend/src/lib/utils/url.ts b/frontend/src/lib/utils/url.ts
new file mode 100644
index 000000000..f86c05fe9
--- /dev/null
+++ b/frontend/src/lib/utils/url.ts
@@ -0,0 +1,18 @@
+export function toPortHref(hostPort: string, baseServerUrl?: string): string {
+ try {
+ const base = baseServerUrl || (typeof window !== 'undefined' ? window.location.origin : 'http://localhost');
+ const url = new URL(base.startsWith('http') ? base : `http://${base}`);
+ url.port = hostPort;
+ return url.toString();
+ } catch {
+ return '#';
+ }
+}
+
+export function toSafeHref(raw: string, scheme: string = 'https'): string {
+ const trimmed = raw.trim();
+ if (!trimmed) return '#';
+ if (/^(javascript|data|vbscript):/i.test(trimmed)) return '#';
+ if (/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(trimmed)) return trimmed;
+ return `${scheme}://${trimmed}`;
+}
diff --git a/frontend/src/routes/(app)/containers/[containerId]/+page.svelte b/frontend/src/routes/(app)/containers/[containerId]/+page.svelte
index 3b084a9c1..4344b30f6 100644
--- a/frontend/src/routes/(app)/containers/[containerId]/+page.svelte
+++ b/frontend/src/routes/(app)/containers/[containerId]/+page.svelte
@@ -25,6 +25,8 @@
import ContainerShell from '../components/ContainerShell.svelte';
import { createContainerStatsWebSocket, type ReconnectingWebSocket } from '$lib/utils/ws';
import { environmentStore } from '$lib/stores/environment.store.svelte';
+ import IconImage from '$lib/components/icon-image.svelte';
+ import { getArcaneIconUrlFromLabels } from '$lib/utils/arcane-labels';
import {
ArrowLeftIcon,
AlertIcon,
@@ -62,6 +64,7 @@
};
const containerDisplayName = $derived(cleanContainerName(container?.name));
+ const containerIconUrl = $derived(getArcaneIconUrlFromLabels(container?.labels));
async function startStatsStream() {
if (isConnecting || statsWebSocket || !container?.id || !container.state?.running) {
@@ -275,6 +278,13 @@
<TabbedPageLayout {backUrl} backLabel={m.common_back()} {tabItems} {selectedTab} {onTabChange}>
{#snippet headerInfo()}
<div class="flex items-center gap-2">
+ <IconImage
+ src={containerIconUrl}
+ alt={containerDisplayName}
+ fallback={ContainersIcon}
+ class="size-5"
+ containerClass="size-9"
+ />
<h1 class="max-w-[300px] truncate text-lg font-semibold" title={containerDisplayName}>
{containerDisplayName}
</h1>
diff --git a/frontend/src/routes/(app)/containers/container-table.svelte b/frontend/src/routes/(app)/containers/container-table.svelte
index 16f4f6624..99d1d3f7c 100644
--- a/frontend/src/routes/(app)/containers/container-table.svelte
+++ b/frontend/src/routes/(app)/containers/container-table.svelte
@@ -30,6 +30,8 @@
import { ContainerStatsManager } from './components/container-stats-manager.svelte';
import ContainerStatsCell from './components/container-stats-cell.svelte';
import { environmentStore } from '$lib/stores/environment.store.svelte';
+ import IconImage from '$lib/components/icon-image.svelte';
+ import { getArcaneIconUrlFromLabels } from '$lib/utils/arcane-labels';
import {
StartIcon,
StopIcon,
@@ -616,13 +618,12 @@
{/snippet}
{#snippet NameCell({ item }: { item: ContainerSummaryDto })}
- <a class="font-medium hover:underline" href="/containers/{item.id}">
- {#if item.names && item.names.length > 0}
- {item.names[0].startsWith('/') ? item.names[0].substring(1) : item.names[0]}
- {:else}
- {item.id.substring(0, 12)}
- {/if}
- </a>
+ {@const displayName = getContainerDisplayName(item)}
+ {@const iconUrl = getArcaneIconUrlFromLabels(item.labels)}
+ <div class="flex items-center gap-2">
+ <IconImage src={iconUrl} alt={displayName} fallback={BoxIcon} class="size-4" containerClass="size-7" />
+ <a class="font-medium hover:underline" href="/containers/{item.id}">{displayName}</a>
+ </div>
{/snippet}
{#snippet IdCell({ item }: { item: ContainerSummaryDto })}
@@ -723,10 +724,13 @@
<UniversalMobileCard
{item}
icon={(item) => {
+ const iconUrl = getArcaneIconUrlFromLabels(item.labels);
const state = item.state;
return {
component: BoxIcon,
- variant: state === 'running' ? 'emerald' : state === 'exited' ? 'red' : 'amber'
+ variant: state === 'running' ? 'emerald' : state === 'exited' ? 'red' : 'amber',
+ imageUrl: iconUrl ?? undefined,
+ alt: getContainerDisplayName(item)
};
}}
title={(item) => {
diff --git a/frontend/src/routes/(app)/dashboard/dash-container-table.svelte b/frontend/src/routes/(app)/dashboard/dash-container-table.svelte
index 70d600179..43be660e2 100644
--- a/frontend/src/routes/(app)/dashboard/dash-container-table.svelte
+++ b/frontend/src/routes/(app)/dashboard/dash-container-table.svelte
@@ -15,6 +15,8 @@
import { untrack } from 'svelte';
import { IsMobile } from '$lib/hooks';
import { ContainersIcon, ArrowRightIcon } from '$lib/icons';
+ import IconImage from '$lib/components/icon-image.svelte';
+ import { getArcaneIconUrlFromLabels } from '$lib/utils/arcane-labels';
let {
containers = $bindable(),
@@ -93,13 +95,17 @@
</script>
{#snippet NameCell({ item }: { item: ContainerSummaryDto })}
- <a class="font-medium hover:underline" href="/containers/{item.id}">
- {#if item.names && item.names.length > 0}
- {item.names[0].startsWith('/') ? item.names[0].substring(1) : item.names[0]}
- {:else}
- {item.id.substring(0, 12)}
- {/if}
- </a>
+ {@const displayName =
+ item.names && item.names.length > 0
+ ? item.names[0].startsWith('/')
+ ? item.names[0].substring(1)
+ : item.names[0]
+ : item.id.substring(0, 12)}
+ {@const iconUrl = getArcaneIconUrlFromLabels(item.labels)}
+ <div class="flex items-center gap-2">
+ <IconImage src={iconUrl} alt={displayName} fallback={ContainersIcon} class="size-4" containerClass="size-7" />
+ <a class="font-medium hover:underline" href="/containers/{item.id}">{displayName}</a>
+ </div>
{/snippet}
{#snippet StateCell({ item }: { item: ContainerSummaryDto })}
@@ -110,10 +116,13 @@
<UniversalMobileCard
{item}
icon={(item) => {
+ const iconUrl = getArcaneIconUrlFromLabels(item.labels);
const state = item.state;
return {
component: ContainersIcon,
- variant: state === 'running' ? 'emerald' : state === 'exited' ? 'red' : 'amber'
+ variant: state === 'running' ? 'emerald' : state === 'exited' ? 'red' : 'amber',
+ imageUrl: iconUrl ?? undefined,
+ alt: item.names?.[0] ? item.names[0].replace(/^\//, '') : item.id.substring(0, 12)
};
}}
title={(item) => {
diff --git a/frontend/src/routes/(app)/projects/[projectId]/+page.svelte b/frontend/src/routes/(app)/projects/[projectId]/+page.svelte
index 2c93651ff..381835adc 100644
--- a/frontend/src/routes/(app)/projects/[projectId]/+page.svelte
+++ b/frontend/src/routes/(app)/projects/[projectId]/+page.svelte
@@ -5,7 +5,7 @@
import * as Card from '$lib/components/ui/card';
import * as Alert from '$lib/components/ui/alert/index.js';
import { ArcaneButton } from '$lib/components/arcane-button/index.js';
- import { ArrowLeftIcon, ProjectsIcon, LayersIcon, SettingsIcon, FileTextIcon, AlertIcon } from '$lib/icons';
+ import { ArrowLeftIcon, ProjectsIcon, LayersIcon, SettingsIcon, FileTextIcon, AlertIcon, GlobeIcon } from '$lib/icons';
import { type TabItem } from '$lib/components/tab-bar/index.js';
import TabbedPageLayout from '$lib/layouts/tabbed-page-layout.svelte';
import ActionButtons from '$lib/components/action-buttons.svelte';
@@ -19,6 +19,7 @@
import { z } from 'zod/v4';
import { createForm } from '$lib/utils/form.utils';
import { m } from '$lib/paraglide/messages';
+ import { toSafeHref } from '$lib/utils/url';
import { PersistedState } from 'runed';
import EditableName from '../components/EditableName.svelte';
import ServicesGrid from '../components/ServicesGrid.svelte';
@@ -31,6 +32,7 @@
import { gitOpsSyncService } from '$lib/services/gitops-sync-service';
import { environmentStore } from '$lib/stores/environment.store.svelte';
import { RefreshIcon } from '$lib/icons';
+ import IconImage from '$lib/components/icon-image.svelte';
let { data } = $props();
let projectId = $derived(data.projectId);
@@ -262,6 +264,17 @@
}
});
}
+
+ function formatUrlLabel(raw: string): string {
+ const trimmed = raw.trim();
+ if (!trimmed) return raw;
+ try {
+ const parsed = new URL(trimmed);
+ return parsed.host || parsed.hostname || trimmed;
+ } catch {
+ return trimmed;
+ }
+ }
</script>
{#if project}
@@ -276,60 +289,80 @@
}}
>
{#snippet headerInfo()}
- <div class="flex items-center gap-2">
- <EditableName
- bind:value={$inputs.name.value}
- bind:ref={nameInputRef}
- variant="inline"
- error={$inputs.name.error ?? undefined}
- originalValue={originalName}
- canEdit={canEditName}
- onCommit={saveNameIfChanged}
- class="hidden sm:block"
- />
- <EditableName
- bind:value={$inputs.name.value}
- bind:ref={nameInputRef}
- variant="block"
- error={$inputs.name.error ?? undefined}
- originalValue={originalName}
- canEdit={canEditName}
- onCommit={saveNameIfChanged}
- class="block sm:hidden"
+ <div class="grid items-start gap-x-3 gap-y-1.5 sm:grid-cols-[auto,1fr]">
+ <IconImage
+ src={project.iconUrl}
+ alt={project.name}
+ fallback={ProjectsIcon}
+ class="size-9"
+ containerClass="size-12 bg-transparent ring-0"
/>
- {#if project.status}
- {@const showTooltip = project.status.toLowerCase() === 'unknown' && project.statusReason}
- <StatusBadge
- variant={getStatusVariant(project.status)}
- text={capitalizeFirstLetter(project.status)}
- tooltip={showTooltip ? project.statusReason : undefined}
+ <div class="flex flex-wrap items-center gap-2">
+ <EditableName
+ bind:value={$inputs.name.value}
+ bind:ref={nameInputRef}
+ variant="inline"
+ error={$inputs.name.error ?? undefined}
+ originalValue={originalName}
+ canEdit={canEditName}
+ onCommit={saveNameIfChanged}
+ class="hidden sm:block"
/>
- {/if}
- </div>
- <div class="mt-0.5 flex items-center gap-4">
- {#if project.createdAt}
- <p class="text-muted-foreground hidden text-xs sm:block">
- {m.common_created()}: {new Date(project.createdAt ?? '').toLocaleDateString()}
- </p>
- {/if}
- {#if project.lastSyncCommit}
- <div class="text-muted-foreground flex items-center gap-1.5 text-xs">
- <span class="hidden sm:inline">{m.git_sync_commit()}:</span>
- {#if project.gitRepositoryURL}
- <a
- href="{project.gitRepositoryURL.replace(/\.git$/, '')}/commit/{project.lastSyncCommit}"
- target="_blank"
- class="hover:text-primary sm:bg-muted font-mono transition-colors sm:rounded sm:px-1.5 sm:py-0.5"
- >
- {project.lastSyncCommit}
- </a>
- {:else}
- <span class="sm:bg-muted font-mono sm:rounded sm:px-1.5 sm:py-0.5">
- {project.lastSyncCommit}
- </span>
- {/if}
- </div>
- {/if}
+ <EditableName
+ bind:value={$inputs.name.value}
+ bind:ref={nameInputRef}
+ variant="block"
+ error={$inputs.name.error ?? undefined}
+ originalValue={originalName}
+ canEdit={canEditName}
+ onCommit={saveNameIfChanged}
+ class="block sm:hidden"
+ />
+ {#if project.status}
+ {@const showTooltip = project.status.toLowerCase() === 'unknown' && project.statusReason}
+ <StatusBadge
+ variant={getStatusVariant(project.status)}
+ text={capitalizeFirstLetter(project.status)}
+ tooltip={showTooltip ? project.statusReason : undefined}
+ />
+ {/if}
+ {#if project.urls && project.urls.length > 0}
+ <div class="flex flex-wrap items-center gap-2">
+ {#each project.urls as url, i (i)}
+ <a
+ class="ring-offset-background focus-visible:ring-ring bg-background/70 inline-flex min-h-6 max-w-full items-center gap-1 rounded-lg border border-sky-700/20 px-2 py-0.5 text-[12px] font-semibold shadow-sm transition-colors hover:border-sky-700/40 hover:bg-sky-500/10 hover:shadow-md focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none dark:border-sky-400/40 dark:bg-sky-500/20 dark:text-sky-100 dark:hover:border-sky-300/60 dark:hover:bg-sky-500/30"
+ href={toSafeHref(url)}
+ target="_blank"
+ rel="noopener noreferrer"
+ title={url}
+ >
+ <GlobeIcon class="size-3 text-sky-500" />
+ <span class="truncate leading-normal">{formatUrlLabel(url)}</span>
+ </a>
+ {/each}
+ </div>
+ {/if}
+ </div>
+ <div class="text-muted-foreground flex flex-wrap items-center gap-4 text-xs sm:col-start-2">
+ {#if project.lastSyncCommit}
+ <div class="flex items-center gap-1.5">
+ <span class="hidden sm:inline">{m.git_sync_commit()}:</span>
+ {#if project.gitRepositoryURL}
+ <a
+ href="{project.gitRepositoryURL.replace(/\.git$/, '')}/commit/{project.lastSyncCommit}"
+ target="_blank"
+ class="hover:text-primary sm:bg-muted font-mono transition-colors sm:rounded sm:px-1.5 sm:py-0.5"
+ >
+ {project.lastSyncCommit}
+ </a>
+ {:else}
+ <span class="sm:bg-muted font-mono sm:rounded sm:px-1.5 sm:py-0.5">
+ {project.lastSyncCommit}
+ </span>
+ {/if}
+ </div>
+ {/if}
+ </div>
</div>
{/snippet}
diff --git a/frontend/src/routes/(app)/projects/components/ServicesGrid.svelte b/frontend/src/routes/(app)/projects/components/ServicesGrid.svelte
index e8f7d118e..94c21934a 100644
--- a/frontend/src/routes/(app)/projects/components/ServicesGrid.svelte
+++ b/frontend/src/routes/(app)/projects/components/ServicesGrid.svelte
@@ -8,6 +8,8 @@
import { Badge } from '$lib/components/ui/badge';
import type { RuntimeService } from '$lib/types/project.type';
import { HealthIcon, ContainersIcon } from '$lib/icons';
+ import IconImage from '$lib/components/icon-image.svelte';
+ import { getArcaneIconUrlFromLabels } from '$lib/utils/arcane-labels';
interface Props {
services?: RuntimeService[];
@@ -60,6 +62,7 @@
{@const containerUrl = projectId
? `/containers/${service.containerId}?from=project&projectId=${projectId}`
: `/containers/${service.containerId}`}
+ {@const iconUrl = service.iconUrl || getArcaneIconUrlFromLabels(service.serviceConfig?.labels)}
{#if service.containerId}
<a href={containerUrl} class="group">
@@ -69,9 +72,13 @@
>
<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">
- <ContainersIcon class="size-5 text-blue-500" />
- </div>
+ <IconImage
+ src={iconUrl}
+ alt={service.containerName || service.name}
+ fallback={ContainersIcon}
+ class="size-6 text-blue-500"
+ containerClass="size-10 bg-blue-500/10 p-2 group-hover:bg-blue-500/15"
+ />
<div class="min-w-0 flex-1">
<div class="mb-2 flex items-center gap-2">
<h3 class="text-foreground text-base font-semibold transition-colors">
@@ -101,9 +108,13 @@
<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">
- <ContainersIcon class="size-5 text-amber-500" />
- </div>
+ <IconImage
+ src={iconUrl}
+ alt={service.name}
+ fallback={ContainersIcon}
+ class="size-6 text-amber-500"
+ containerClass="size-10 bg-amber-500/10 p-2"
+ />
<div class="min-w-0 flex-1">
<h3 class="text-foreground mb-2 text-base font-semibold">
{service.name}
diff --git a/frontend/src/routes/(app)/projects/projects-table.svelte b/frontend/src/routes/(app)/projects/projects-table.svelte
index ead20074e..1ed38e8aa 100644
--- a/frontend/src/routes/(app)/projects/projects-table.svelte
+++ b/frontend/src/routes/(app)/projects/projects-table.svelte
@@ -22,6 +22,7 @@
import { gitOpsSyncService } from '$lib/services/gitops-sync-service';
import { FolderOpenIcon, LayersIcon, CalendarIcon, ProjectsIcon, GitBranchIcon, RefreshIcon } from '$lib/icons';
import { environmentStore } from '$lib/stores/environment.store.svelte';
+ import IconImage from '$lib/components/icon-image.svelte';
let {
projects = $bindable(),
@@ -313,9 +314,8 @@
{#snippet NameCell({ item }: { item: Project })}
<div class="flex items-center gap-2">
- <a class="font-medium hover:underline" href="/projects/{item.id}">
- {item.name}
- </a>
+ <IconImage src={item.iconUrl} alt={item.name} fallback={FolderOpenIcon} class="size-8" containerClass="size-10" />
+ <a class="font-medium hover:underline" href="/projects/{item.id}">{item.name}</a>
</div>
{/snippet}
@@ -366,7 +366,9 @@
{item}
icon={(item: Project) => ({
component: FolderOpenIcon,
- variant: item.status === 'running' ? 'emerald' : item.status === 'exited' ? 'red' : 'amber'
+ variant: item.status === 'running' ? 'emerald' : item.status === 'exited' ? 'red' : 'amber',
+ imageUrl: item.iconUrl,
+ alt: item.name
})}
title={(item: Project) => item.name}
subtitle={(item: Project) => ((mobileFieldVisibility.id ?? true) ? item.id : null)}
diff --git a/go.work.sum b/go.work.sum
index f3b72d6e5..08a5f4ee7 100644
--- a/go.work.sum
+++ b/go.work.sum
@@ -165,12 +165,14 @@ github.com/containerd/imgcrypt/v2 v2.0.1 h1:gQcmeCKA97fAl0wlpq0itSY/PagFBsn4/mlK
github.com/containerd/imgcrypt/v2 v2.0.1/go.mod h1:/qIJL8nxzdzMA2n5iYyyuIY36KfoVQWmgTWdfVtyebM=
github.com/containerd/nri v0.10.0 h1:bt2NzfvlY6OJE0i+fB5WVeGQEycxY7iFVQpEbh7J3Go=
github.com/containerd/nri v0.10.0/go.mod h1:5VyvLa/4uL8FjyO8nis1UjbCutXDpngil17KvBSL6BU=
+github.com/containerd/nri v0.11.0 h1:26mcQwNG58AZn0YkOrlJQ0yxQVmyZooflnVWJTqQrqQ=
github.com/containerd/nri v0.11.0/go.mod h1:bjGTLdUA58WgghKHg8azFMGXr05n1wDHrt3NSVBHiGI=
github.com/containerd/otelttrpc v0.1.0 h1:UOX68eVTE8H/T45JveIg+I22Ev2aFj4qPITCmXsskjw=
github.com/containerd/otelttrpc v0.1.0/go.mod h1:XhoA2VvaGPW1clB2ULwrBZfXVuEWuyOd2NUD1IM0yTg=
github.com/containerd/stargz-snapshotter v0.17.0/go.mod h1:ySEul1ck7jCE4jqsuFCo8FFLrHU20UWQeI9g7mdsanI=
github.com/containerd/zfs/v2 v2.0.0-rc.0 h1:0dRlgpoaepW7HuovtcvYQMF7NlpceQVdn7+3Udeth4M=
github.com/containerd/zfs/v2 v2.0.0-rc.0/go.mod h1:g36g/XCEGDRxUXIFdM3oWAEvmTvhfz/eKWElqg4Secw=
+github.com/containerd/zfs/v2 v2.0.0 h1:sI0wKwWNQXR9G4jnPPrXmMSetm6PGAwgqBRTQtFUY/o=
github.com/containerd/zfs/v2 v2.0.0/go.mod h1:fnUDKF98iYuQqLvNdoXs9MXjtfhRWp1nxSgRf7VZH8s=
github.com/containernetworking/cni v1.3.0 h1:v6EpN8RznAZj9765HhXQrtXgX+ECGebEYEmnuFjskwo=
github.com/containernetworking/cni v1.3.0/go.mod h1:Bs8glZjjFfGPHMw6hQu82RUgEPNGEaBb9KS5KtNMnJ4=
@@ -257,6 +259,7 @@ github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk=
github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/gofiber/fiber/v2 v2.52.7 h1:6xJpE4sSqErvMiEZo9ZpJLRSVcpkNBvioeqAHKwhTZY=
github.com/gofiber/fiber/v2 v2.52.7/go.mod h1:YEcBbO/FB+5M1IZNBP9FO3J9281zgPAreiI1oqg8nDw=
+github.com/gofiber/fiber/v2 v2.52.9 h1:YjKl5DOiyP3j0mO61u3NTmK7or8GzzWzCFzkboyP5cw=
github.com/gofiber/fiber/v2 v2.52.9/go.mod h1:YEcBbO/FB+5M1IZNBP9FO3J9281zgPAreiI1oqg8nDw=
github.com/golang-jwt/jwt/v4 v4.5.2 h1:YtQM7lnr8iZ+j5q71MGKkNw9Mn7AjHM68uc9g5fXeUI=
github.com/golang-jwt/jwt/v4 v4.5.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
@@ -507,6 +510,7 @@ github.com/tchap/go-patricia/v2 v2.3.3 h1:xfNEsODumaEcCcY3gI0hYPZ/PcpVv5ju6RMAhg
github.com/tchap/go-patricia/v2 v2.3.3/go.mod h1:VZRHKAb53DLaG+nA9EaYYiaEx6YztwDlLElMsnSHD4k=
github.com/tetratelabs/wazero v1.9.0 h1:IcZ56OuxrtaEz8UYNRHBrUa9bYeX9oVY93KspZZBf/I=
github.com/tetratelabs/wazero v1.9.0/go.mod h1:TSbcXCfFP0L2FGkRPxHphadXPjo1T6W+CseNNY7EkjM=
+github.com/tetratelabs/wazero v1.10.1 h1:2DugeJf6VVk58KTPszlNfeeN8AhhpwcZqkJj2wwFuH8=
github.com/tetratelabs/wazero v1.10.1/go.mod h1:DRm5twOQ5Gr1AoEdSi0CLjDQF1J9ZAuyqFIjl1KKfQU=
github.com/titanous/rocacheck v0.0.0-20171023193734-afe73141d399 h1:e/5i7d4oYZ+C1wj2THlRK+oAhjeS/TRQwMfkIuet3w0=
github.com/titanous/rocacheck v0.0.0-20171023193734-afe73141d399/go.mod h1:LdwHTNJT99C5fTAzDz0ud328OgXz+gierycbcIx2fRs=
diff --git a/types/project/project.go b/types/project/project.go
index df74e60ca..75135d3eb 100644
--- a/types/project/project.go
+++ b/types/project/project.go
@@ -109,6 +109,11 @@ type RuntimeService struct {
// Required: false
Health *string `json:"health,omitempty"`
+ // IconURL is an optional icon URL derived from Arcane labels.
+ //
+ // Required: false
+ IconURL string `json:"iconUrl,omitempty"`
+
// ServiceConfig is the configuration of the service from the compose file.
//
// Required: false
@@ -195,6 +200,16 @@ type Details struct {
// Required: true
Path string `json:"path"`
+ // IconURL is the optional stack icon URL from compose metadata.
+ //
+ // Required: false
+ IconURL string `json:"iconUrl,omitempty"`
+
+ // URLs are optional custom stack URLs from compose metadata.
+ //
+ // Required: false
+ URLs []string `json:"urls,omitempty"`
+
// ComposeContent is the Docker Compose file content.
//
// Required: false