Modern Docker Management, Designed for Everyone
Go composecontainer-managementcontainersdockerdocker-composedocker-managementgoself-hostedsveltekittypescriptweb-ui
fix: add version label to environment cards (#2379)
Kyle Mendelle294d7050608
diff --git a/backend/internal/bootstrap/services_bootstrap.go b/backend/internal/bootstrap/services_bootstrap.goindex bf82cc58e..1153a79ea 100644--- a/backend/internal/bootstrap/services_bootstrap.go+++ b/backend/internal/bootstrap/services_bootstrap.go@@ -73,6 +73,7 @@ func initializeServices(ctx context.Context, db *database.DB, cfg *config.Configreturn dockerClient.GetClient(ctx)})svcs.Environment = services.NewEnvironmentService(db, httpClient, svcs.Docker, svcs.Event, svcs.Settings, svcs.ApiKey)+ svcs.Version = services.NewVersionService(httpClient, cfg.UpdateCheckDisabled, config.Version, config.Revision, svcs.ContainerRegistry, svcs.Docker)svcs.Notification = services.NewNotificationService(db, cfg, svcs.Environment)svcs.Apprise = services.NewAppriseService(db, cfg)svcs.Vulnerability = services.NewVulnerabilityService(db, svcs.Docker, svcs.Event, svcs.Settings, svcs.Notification)@@ -83,7 +84,7 @@ func initializeServices(ctx context.Context, db *database.DB, cfg *config.Configsvcs.BuildWorkspace = services.NewBuildWorkspaceService(svcs.Settings)svcs.Project = services.NewProjectService(db, svcs.Settings, svcs.Event, svcs.Image, svcs.Docker, svcs.Build, cfg)svcs.Container = services.NewContainerService(db, svcs.Event, svcs.Docker, svcs.Image, svcs.Settings, svcs.Project)- svcs.Dashboard = services.NewDashboardService(db, svcs.Docker, svcs.Container, svcs.Settings, svcs.Vulnerability, svcs.Environment)+ svcs.Dashboard = services.NewDashboardService(db, svcs.Docker, svcs.Container, svcs.Settings, svcs.Vulnerability, svcs.Environment, svcs.Version)svcs.Volume = services.NewVolumeService(db, svcs.Docker, svcs.Event, svcs.Settings, svcs.Container, svcs.Image, cfg.BackupVolumeName)svcs.Network = services.NewNetworkService(db, svcs.Docker, svcs.Event)svcs.Port = services.NewPortService(svcs.Docker)@@ -92,7 +93,6 @@ func initializeServices(ctx context.Context, db *database.DB, cfg *config.Configsvcs.Auth = services.NewAuthService(svcs.User, svcs.Settings, svcs.Event, cfg.JWTSecret, cfg)svcs.Oidc = services.NewOidcService(svcs.Auth, cfg, httpClient)svcs.System = services.NewSystemService(db, svcs.Docker, svcs.Container, svcs.Image, svcs.Volume, svcs.Network, svcs.Settings)- svcs.Version = services.NewVersionService(httpClient, cfg.UpdateCheckDisabled, config.Version, config.Revision, svcs.ContainerRegistry, svcs.Docker)svcs.SystemUpgrade = services.NewSystemUpgradeService(svcs.Docker, svcs.Version, svcs.Event, svcs.Settings)svcs.Updater = services.NewUpdaterService(db, svcs.Settings, svcs.Docker, svcs.Project, svcs.ImageUpdate, svcs.ContainerRegistry, svcs.Event, svcs.Image, svcs.Notification, svcs.SystemUpgrade)svcs.GitOpsSync = services.NewGitOpsSyncService(db, svcs.GitRepository, svcs.Project, svcs.Event, svcs.Settings)diff --git a/backend/internal/huma/handlers/dashboard_test.go b/backend/internal/huma/handlers/dashboard_test.goindex d8769e9a1..f1a96a125 100644--- a/backend/internal/huma/handlers/dashboard_test.go+++ b/backend/internal/huma/handlers/dashboard_test.go@@ -111,7 +111,7 @@ func TestDashboardHandlerGetDashboardReturnsSnapshot(t *testing.T) {dockerSvc := newDashboardHandlerTestDockerService(t, settingsSvc, containers, images)handler := &DashboardHandler{- dashboardService: services.NewDashboardService(db, dockerSvc, nil, settingsSvc, nil, nil),+ dashboardService: services.NewDashboardService(db, dockerSvc, nil, settingsSvc, nil, nil, nil),}output, err := handler.GetDashboard(context.Background(), &GetDashboardInput{EnvironmentID: "0"})@@ -144,7 +144,7 @@ func TestDashboardHandlerGetEnvironmentsOverviewReturnsAggregateSummary(t *testi}).Error)handler := &DashboardHandler{- dashboardService: services.NewDashboardService(db, nil, nil, settingsSvc, nil, services.NewEnvironmentService(db, http.DefaultClient, nil, nil, settingsSvc, nil)),+ dashboardService: services.NewDashboardService(db, nil, nil, settingsSvc, nil, services.NewEnvironmentService(db, http.DefaultClient, nil, nil, settingsSvc, nil), services.NewVersionService(nil, true, "1.2.3", "abcdef1234567890", nil, nil)),}output, err := handler.GetEnvironmentsOverview(context.Background(), &GetDashboardEnvironmentsOverviewInput{})@@ -155,4 +155,5 @@ func TestDashboardHandlerGetEnvironmentsOverviewReturnsAggregateSummary(t *testirequire.Len(t, output.Body.Data.Environments, 1)require.Equal(t, "0", output.Body.Data.Environments[0].Environment.ID)require.Equal(t, dashboardtypes.EnvironmentSnapshotStateSkipped, output.Body.Data.Environments[0].SnapshotState)+ require.Nil(t, output.Body.Data.Environments[0].VersionInfo)}diff --git a/backend/internal/services/dashboard_service.go b/backend/internal/services/dashboard_service.goindex bb7c35994..3b7561842 100644--- a/backend/internal/services/dashboard_service.go+++ b/backend/internal/services/dashboard_service.go@@ -4,6 +4,7 @@ import ("context""encoding/json""fmt"+ "log/slog""sort""time"@@ -16,6 +17,7 @@ import (dashboardtypes "github.com/getarcaneapp/arcane/types/dashboard"environmenttypes "github.com/getarcaneapp/arcane/types/environment"imagetypes "github.com/getarcaneapp/arcane/types/image"+ versiontypes "github.com/getarcaneapp/arcane/types/version"dockercontainer "github.com/moby/moby/api/types/container"dockerimage "github.com/moby/moby/api/types/image""github.com/moby/moby/client"@@ -35,6 +37,7 @@ type DashboardService struct {settingsService *SettingsServicevulnerabilityService *VulnerabilityServiceenvironmentService *EnvironmentService+ versionService *VersionService}type DashboardActionItemsOptions struct {@@ -48,6 +51,7 @@ func NewDashboardService(settingsService *SettingsService,vulnerabilityService *VulnerabilityService,environmentService *EnvironmentService,+ versionService *VersionService,) *DashboardService {return &DashboardService{db: db,@@ -56,6 +60,7 @@ func NewDashboardService(settingsService: settingsService,vulnerabilityService: vulnerabilityService,environmentService: environmentService,+ versionService: versionService,}}@@ -423,9 +428,32 @@ func (s *DashboardService) buildEnvironmentOverviewInternal(return overview}- snapshot, err := s.getSnapshotForEnvironmentInternal(ctx, env, options)- if err != nil {- message := err.Error()+ var (+ snapshot *dashboardtypes.Snapshot+ snapshotErr error+ versionInfo *versiontypes.Info+ )++ g, groupCtx := errgroup.WithContext(ctx)++ g.Go(func() error {+ snapshot, snapshotErr = s.getSnapshotForEnvironmentInternal(groupCtx, env, options)+ return nil+ })++ g.Go(func() error {+ versionInfo = s.getVersionInfoForEnvironmentInternal(groupCtx, env)+ return nil+ })++ _ = g.Wait()++ if versionInfo != nil {+ overview.VersionInfo = versionInfo+ }++ if snapshotErr != nil {+ message := snapshotErr.Error()overview.SnapshotState = dashboardtypes.EnvironmentSnapshotStateErroroverview.SnapshotError = &messagereturn overview@@ -494,6 +522,50 @@ func buildEnvironmentDashboardProxyPathInternal(options DashboardActionItemsOptireturn fmt.Sprintf("/api/environments/%s/dashboard", localEnvironmentID)}+func (s *DashboardService) getVersionInfoForEnvironmentInternal(+ ctx context.Context,+ env environmenttypes.Environment,+) *versiontypes.Info {+ if s.versionService == nil {+ return nil+ }++ reqCtx, cancel := context.WithTimeout(ctx, defaultAggregateDashboardTimeout)+ defer cancel()++ if env.ID == localEnvironmentID {+ return s.versionService.GetAppVersionInfo(reqCtx)+ }++ if s.environmentService == nil {+ return nil+ }++ respBody, statusCode, err := s.environmentService.ProxyRequest(+ reqCtx,+ env.ID,+ "GET",+ "/api/app-version",+ nil,+ )+ if err != nil {+ slog.DebugContext(reqCtx, "Failed to fetch environment version info for dashboard", "environment_id", env.ID, "error", err)+ return nil+ }+ if statusCode < 200 || statusCode >= 300 {+ slog.DebugContext(reqCtx, "Unexpected environment version status code for dashboard", "environment_id", env.ID, "status_code", statusCode)+ return nil+ }++ var versionInfo versiontypes.Info+ if err := json.Unmarshal(respBody, &versionInfo); err != nil {+ slog.DebugContext(reqCtx, "Failed to decode environment version info for dashboard", "environment_id", env.ID, "error", err)+ return nil+ }++ return &versionInfo+}+func (s *DashboardService) getStoppedContainersCountInternal(ctx context.Context) (int, error) {if s.dockerService == nil {return 0, nildiff --git a/backend/internal/services/dashboard_service_test.go b/backend/internal/services/dashboard_service_test.goindex 1943208b6..253f1042f 100644--- a/backend/internal/services/dashboard_service_test.go+++ b/backend/internal/services/dashboard_service_test.go@@ -15,6 +15,7 @@ import (containertypes "github.com/getarcaneapp/arcane/types/container"dashboardtypes "github.com/getarcaneapp/arcane/types/dashboard"imagetypes "github.com/getarcaneapp/arcane/types/image"+ versiontypes "github.com/getarcaneapp/arcane/types/version"glsqlite "github.com/glebarez/sqlite"dockercontainer "github.com/moby/moby/api/types/container"dockerimage "github.com/moby/moby/api/types/image"@@ -89,9 +90,13 @@ func newDashboardTestDockerService(}}+func newDashboardTestVersionServiceInternal() *VersionService {+ return NewVersionService(nil, true, "1.2.3", "abcdef1234567890", nil, nil)+}+func TestDashboardService_GetActionItems_IncludesExpiringAPIKeys(t *testing.T) {db, settingsSvc := setupDashboardServiceTestDB(t)- svc := NewDashboardService(db, nil, nil, settingsSvc, nil, nil)+ svc := NewDashboardService(db, nil, nil, settingsSvc, nil, nil, nil)now := time.Now()createDashboardTestAPIKey(t, db, models.ApiKey{@@ -135,7 +140,7 @@ func TestDashboardService_GetActionItems_IncludesExpiringAPIKeys(t *testing.T) {func TestDashboardService_GetActionItems_DebugAllGoodReturnsNoItems(t *testing.T) {db, settingsSvc := setupDashboardServiceTestDB(t)- svc := NewDashboardService(db, nil, nil, settingsSvc, nil, nil)+ svc := NewDashboardService(db, nil, nil, settingsSvc, nil, nil, nil)createDashboardTestAPIKey(t, db, models.ApiKey{Name: "expiring-soon",@@ -207,7 +212,7 @@ func TestDashboardService_GetSnapshot_ReturnsDashboardSnapshot(t *testing.T) {})dockerSvc := newDashboardTestDockerService(t, settingsSvc, containers, images)- svc := NewDashboardService(db, dockerSvc, nil, settingsSvc, nil, nil)+ svc := NewDashboardService(db, dockerSvc, nil, settingsSvc, nil, nil, nil)snapshot, err := svc.GetSnapshot(context.Background(), DashboardActionItemsOptions{})require.NoError(t, err)@@ -257,7 +262,7 @@ func TestDashboardService_GetSnapshot_DebugAllGoodOnlyClearsActionItems(t *testicreateDashboardTestImageUpdateRecord(t, db, models.ImageUpdateRecord{ID: "sha256:image-b", HasUpdate: true})dockerSvc := newDashboardTestDockerService(t, settingsSvc, containers, images)- svc := NewDashboardService(db, dockerSvc, nil, settingsSvc, nil, nil)+ svc := NewDashboardService(db, dockerSvc, nil, settingsSvc, nil, nil, nil)snapshot, err := svc.GetSnapshot(context.Background(), DashboardActionItemsOptions{DebugAllGood: true})require.NoError(t, err)@@ -313,10 +318,24 @@ func TestDashboardService_GetEnvironmentsOverview_ReturnsLocalAndRemoteSummaries},}+ remoteVersion := versiontypes.Info{+ CurrentVersion: "v2.4.0",+ DisplayVersion: "v2.4.0",+ Revision: "1234567890abcdef",+ ShortRevision: "12345678",+ GoVersion: "go1.24.0",+ IsSemverVersion: true,+ UpdateAvailable: true,+ NewestVersion: "v2.5.0",+ ReleaseURL: "https://github.com/getarcaneapp/arcane/releases/tag/v2.5.0",+ }+remoteServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {switch r.URL.Path {case "/api/environments/0/dashboard":require.NoError(t, json.NewEncoder(w).Encode(remoteSnapshot))+ case "/api/app-version":+ require.NoError(t, json.NewEncoder(w).Encode(remoteVersion))default:http.NotFound(w, r)}@@ -340,7 +359,7 @@ func TestDashboardService_GetEnvironmentsOverview_ReturnsLocalAndRemoteSummariesdockerSvc := newDashboardTestDockerService(t, settingsSvc, containers, images)envSvc := NewEnvironmentService(db, remoteServer.Client(), nil, nil, settingsSvc, nil)- svc := NewDashboardService(db, dockerSvc, nil, settingsSvc, nil, envSvc)+ svc := NewDashboardService(db, dockerSvc, nil, settingsSvc, nil, envSvc, newDashboardTestVersionServiceInternal())overview, err := svc.GetEnvironmentsOverview(context.Background(), DashboardActionItemsOptions{})require.NoError(t, err)@@ -356,11 +375,15 @@ func TestDashboardService_GetEnvironmentsOverview_ReturnsLocalAndRemoteSummariesrequire.Equal(t, "0", overview.Environments[0].Environment.ID)require.Equal(t, dashboardtypes.EnvironmentSnapshotStateReady, overview.Environments[0].SnapshotState)require.Equal(t, 1, overview.Environments[0].Containers.TotalContainers)+ require.NotNil(t, overview.Environments[0].VersionInfo)+ require.Equal(t, "v1.2.3", overview.Environments[0].VersionInfo.CurrentVersion)require.Equal(t, "env-remote", overview.Environments[1].Environment.ID)require.Equal(t, dashboardtypes.EnvironmentSnapshotStateReady, overview.Environments[1].SnapshotState)require.Equal(t, 3, overview.Environments[1].Containers.TotalContainers)require.Len(t, overview.Environments[1].ActionItems.Items, 1)+ require.NotNil(t, overview.Environments[1].VersionInfo)+ require.Equal(t, "v2.5.0", overview.Environments[1].VersionInfo.NewestVersion)}func TestDashboardService_GetEnvironmentsOverview_HandlesRemoteSnapshotFailure(t *testing.T) {@@ -382,7 +405,7 @@ func TestDashboardService_GetEnvironmentsOverview_HandlesRemoteSnapshotFailure(t})envSvc := NewEnvironmentService(db, http.DefaultClient, nil, nil, settingsSvc, nil)- svc := NewDashboardService(db, nil, nil, settingsSvc, nil, envSvc)+ svc := NewDashboardService(db, nil, nil, settingsSvc, nil, envSvc, newDashboardTestVersionServiceInternal())overview, err := svc.GetEnvironmentsOverview(context.Background(), DashboardActionItemsOptions{})require.NoError(t, err)@@ -396,8 +419,66 @@ func TestDashboardService_GetEnvironmentsOverview_HandlesRemoteSnapshotFailure(trequire.Equal(t, dashboardtypes.EnvironmentSnapshotStateSkipped, byID["env-offline"].SnapshotState)require.Nil(t, byID["env-offline"].SnapshotError)+ require.Nil(t, byID["env-offline"].VersionInfo)require.Equal(t, dashboardtypes.EnvironmentSnapshotStateError, byID["env-error"].SnapshotState)require.NotNil(t, byID["env-error"].SnapshotError)require.Contains(t, *byID["env-error"].SnapshotError, "failed to proxy dashboard snapshot")+ require.Nil(t, byID["env-error"].VersionInfo)+}++func TestDashboardService_GetEnvironmentsOverview_OmitsVersionInfoWhenFetchFails(t *testing.T) {+ db, settingsSvc := setupDashboardServiceTestDB(t)++ remoteSnapshot := base.ApiResponse[dashboardtypes.Snapshot]{+ Success: true,+ Data: dashboardtypes.Snapshot{+ Containers: dashboardtypes.SnapshotContainers{+ Counts: containertypes.StatusCounts{+ RunningContainers: 1,+ StoppedContainers: 0,+ TotalContainers: 1,+ },+ },+ ImageUsageCounts: imagetypes.UsageCounts{+ Inuse: 1,+ Unused: 0,+ Total: 1,+ TotalSize: 128,+ },+ ActionItems: dashboardtypes.ActionItems{Items: []dashboardtypes.ActionItem{}},+ },+ }++ remoteServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {+ switch r.URL.Path {+ case "/api/environments/0/dashboard":+ require.NoError(t, json.NewEncoder(w).Encode(remoteSnapshot))+ case "/api/app-version":+ http.Error(w, "version unavailable", http.StatusInternalServerError)+ default:+ http.NotFound(w, r)+ }+ }))+ t.Cleanup(remoteServer.Close)++ createDashboardTestEnvironment(t, db, models.Environment{+ BaseModel: models.BaseModel{ID: "env-remote", CreatedAt: time.Now()},+ Name: "Remote Alpha",+ ApiUrl: remoteServer.URL,+ Status: string(models.EnvironmentStatusOnline),+ Enabled: true,+ })++ envSvc := NewEnvironmentService(db, remoteServer.Client(), nil, nil, settingsSvc, nil)+ svc := NewDashboardService(db, nil, nil, settingsSvc, nil, envSvc, newDashboardTestVersionServiceInternal())++ overview, err := svc.GetEnvironmentsOverview(context.Background(), DashboardActionItemsOptions{})+ require.NoError(t, err)+ require.NotNil(t, overview)+ require.Len(t, overview.Environments, 1)++ require.Equal(t, dashboardtypes.EnvironmentSnapshotStateReady, overview.Environments[0].SnapshotState)+ require.Equal(t, 1, overview.Environments[0].Containers.TotalContainers)+ require.Nil(t, overview.Environments[0].VersionInfo)}diff --git a/frontend/src/lib/query/query-keys.ts b/frontend/src/lib/query/query-keys.tsindex 2370a890f..68279382b 100644--- a/frontend/src/lib/query/query-keys.ts+++ b/frontend/src/lib/query/query-keys.ts@@ -70,6 +70,8 @@ export const queryKeys = {},system: {upgradeAvailable: (scope: 'mobile-nav' | 'sidebar') => ['system', 'upgrade-available', scope] as const,+ environmentUpgradeAvailable: (environmentId: string) =>+ ['system', 'upgrade-available', 'environment', environmentId] as const,upgradeHealth: (environmentId: string) => ['system', 'upgrade-health', environmentId] as const,versionInfo: (environmentId: string) => ['system', 'version-info', environmentId] as const,dockerInfo: (environmentId: string) => ['system', 'docker-info', environmentId] as constdiff --git a/frontend/src/lib/types/dashboard.type.ts b/frontend/src/lib/types/dashboard.type.tsindex 9c2de921a..c212f14f5 100644--- a/frontend/src/lib/types/dashboard.type.ts+++ b/frontend/src/lib/types/dashboard.type.ts@@ -1,4 +1,5 @@import type { ContainerStatusCounts, ContainerSummaryDto } from './container.type';+import type { AppVersionInformation } from './application-configuration';import type { Environment } from './environment.type';import type { ImageSummaryDto, ImageUsageCounts } from './image.type';import type { Paginated } from './pagination.type';@@ -35,6 +36,7 @@ export interface DashboardEnvironmentOverview {imageUsageCounts: ImageUsageCounts;actionItems: DashboardActionItems;settings: DashboardSnapshotSettings;+ versionInfo?: AppVersionInformation;snapshotState: EnvironmentDashboardSnapshotState;snapshotError?: string;}@@ -73,5 +75,4 @@ export interface DashboardOverviewSummary {export interface DashboardEnvironmentCardState {environment: Environment;- loadPromise: Promise<DashboardEnvironmentOverview> | null;}diff --git a/frontend/src/routes/(app)/dashboard/+page.svelte b/frontend/src/routes/(app)/dashboard/+page.svelteindex d5598a23d..c6ef24769 100644--- a/frontend/src/routes/(app)/dashboard/+page.svelte+++ b/frontend/src/routes/(app)/dashboard/+page.svelte@@ -72,6 +72,7 @@let imageUsageCounts = $derived(currentDashboard.imageUsageCounts);let dashboardActionItems = $derived(currentDashboard.actionItems);let debugAllGood = $derived(data.debugAllGood ?? false);+ let debugUpgrade = $state(false);let currentUser = $state<User | null>(null);const viewTabs = $derived.by((): TabItem[] => [{ value: 'all', label: m.common_all(), icon: ContainersIcon },@@ -433,7 +434,7 @@{#if activeView === 'all'}<Tabs.Content value="all">- <DashboardAllEnvironmentsView heroGreeting={dashboardHeroGreeting} {debugAllGood} />+ <DashboardAllEnvironmentsView heroGreeting={dashboardHeroGreeting} {debugAllGood} {debugUpgrade} /></Tabs.Content>{:else}<Tabs.Content value="current">diff --git a/frontend/src/routes/(app)/dashboard/dashboard-all-environments-view.svelte b/frontend/src/routes/(app)/dashboard/dashboard-all-environments-view.svelteindex 0f47fc6a7..9b40f90be 100644--- a/frontend/src/routes/(app)/dashboard/dashboard-all-environments-view.svelte+++ b/frontend/src/routes/(app)/dashboard/dashboard-all-environments-view.svelte@@ -43,13 +43,17 @@VolumesIcon} from '$lib/icons';import DashboardMetricTile from './dash-metric-tile.svelte';+ import DashboardEnvironmentUpgradeAction from './dashboard-environment-upgrade-action.svelte';+ import * as ArcaneTooltip from '$lib/components/arcane-tooltip';let {heroGreeting,- debugAllGood = false+ debugAllGood = false,+ debugUpgrade = false}: {heroGreeting: string;debugAllGood?: boolean;+ debugUpgrade?: boolean;} = $props();const emptySnapshotSettings: DashboardSnapshot['settings'] = {};@@ -127,11 +131,7 @@}));}- async function buildOverviewSummaryFromCards(): Promise<DashboardOverviewSummary> {- const settledEnvironments = await Promise.all(- environmentCards.map((item) => item.loadPromise ?? Promise.resolve(createBaseEnvironmentOverview(item.environment)))- );-+ function buildOverviewSummaryFromItemsInternal(settledEnvironments: DashboardEnvironmentOverview[]): DashboardOverviewSummary {return {totalEnvironments: settledEnvironments.length,reachableEnvironments: settledEnvironments.filter(@@ -189,6 +189,10 @@}const liveStatsState = liveStatsByEnvironmentId[environment.id];+ if (!liveStatsState) {+ return;+ }+if (liveStatsState.client) {return;}@@ -246,21 +250,39 @@return a.index - b.index;})- .map(({ environment }) => ({- environment,- loadPromise: shouldLoadEnvironment(environment) ? buildEnvironmentLoadPromise(environment, debugAllGood) : null- }));+ .map(({ environment }) => ({ environment }));});- const overviewSummaryPromise = $derived.by(async (): Promise<DashboardOverviewSummary> => {- void reloadVersion;- const result = await tryCatch(dashboardService.getDashboardEnvironmentsOverview({ debugAllGood }));- if (!result.error) {- return mapOverviewSummary(result.data.summary);- }+ const environmentBoardStatePromise = $derived.by(+ async (): Promise<{+ overviewById: Map<string, DashboardEnvironmentOverview>;+ summary: DashboardOverviewSummary;+ }> => {+ void reloadVersion;++ const currentEnvironmentCards = environmentCards;+ const result = await tryCatch(dashboardService.getDashboardEnvironmentsOverview({ debugAllGood }));+ if (!result.error) {+ return {+ overviewById: new Map(result.data.environments.map((item) => [item.environment.id, item])),+ summary: mapOverviewSummary(result.data.summary)+ };+ }- return buildOverviewSummaryFromCards();- });+ const fallbackItems = await Promise.all(+ currentEnvironmentCards.map((item) =>+ shouldLoadEnvironment(item.environment)+ ? buildEnvironmentLoadPromise(item.environment, debugAllGood)+ : Promise.resolve(createBaseEnvironmentOverview(item.environment))+ )+ );++ return {+ overviewById: new Map(fallbackItems.map((item) => [item.environment.id, item])),+ summary: buildOverviewSummaryFromItemsInternal(fallbackItems)+ };+ }+ );$effect(() => {const reachableEnvironmentIds: string[] = [];@@ -627,7 +649,7 @@<section class="shrink-0 space-y-3"><h2 class="text-lg font-semibold tracking-tight">{m.common_overview()}</h2>- {#await overviewSummaryPromise}+ {#await environmentBoardStatePromise}<div class="grid grid-cols-1 gap-3 md:grid-cols-2 xl:grid-cols-4">{#each [1, 2, 3, 4] as tile (tile)}<div class="border-border/50 bg-background/50 rounded-xl border p-4">@@ -637,7 +659,8 @@</div>{/each}</div>- {:then summary}+ {:then boardState}+ {@const summary = boardState.summary}<div class="grid grid-cols-1 gap-3 md:grid-cols-2 xl:grid-cols-4"><div class="border-border/50 bg-background/50 rounded-xl border p-4"><div class="text-muted-foreground flex items-center gap-1.5 text-[11px] font-semibold tracking-wide uppercase">@@ -723,6 +746,43 @@minWidth="none"/><StatusBadge text={transportBadge.text} variant={transportBadge.variant} size="sm" minWidth="none" />+ {#await environmentBoardStatePromise then boardState}+ {@const loadedItem = boardState.overviewById.get(environment.id) ?? baseItem}+ {@const vInfo =+ loadedItem.versionInfo ||+ (debugUpgrade+ ? ({ displayVersion: 'debug', updateAvailable: true, newestVersion: 'debug-v2' } as any)+ : null)}+ {#if vInfo}+ <div class="flex items-center">+ {#if vInfo.updateAvailable || debugUpgrade}+ <ArcaneTooltip.Root>+ <ArcaneTooltip.Trigger+ class="bg-surface/50 text-muted-foreground border-border/50 hover:text-foreground inline-flex items-center rounded-md border px-2 py-[2px] font-mono text-[11px] font-medium transition-colors"+ >+ v{vInfo.displayVersion || vInfo.currentTag || vInfo.currentVersion || 'unknown'}+ <span class="relative ml-1.5 flex h-2 w-2">+ <span+ class="absolute inline-flex h-full w-full animate-ping rounded-full bg-amber-400 opacity-75"+ ></span>+ <span class="relative inline-flex h-2 w-2 rounded-full bg-amber-500"></span>+ </span>+ </ArcaneTooltip.Trigger>+ <ArcaneTooltip.Content>+ {m.sidebar_update_available()}{#if vInfo.newestVersion || vInfo.newestDigest}: {vInfo.newestVersion ||+ vInfo.newestDigest.slice(0, 12)}{/if}+ </ArcaneTooltip.Content>+ </ArcaneTooltip.Root>+ {:else}+ <div+ class="bg-surface/50 text-muted-foreground border-border/50 hover:text-foreground inline-flex items-center rounded-md border px-2 py-[2px] font-mono text-[11px] font-medium transition-colors"+ >+ v{vInfo.displayVersion || vInfo.currentTag || vInfo.currentVersion || 'unknown'}+ </div>+ {/if}+ </div>+ {/if}+ {/await}</div><div class="text-muted-foreground flex flex-wrap items-center gap-x-3 gap-y-1 text-xs">@@ -732,95 +792,87 @@</div></div>- <div class="flex min-w-0 flex-1 justify-end">- {#if item.loadPromise}- {#await item.loadPromise}- <ActionButtonGroup buttons={getEnvironmentActionButtons(baseItem, isCurrent)} size="sm" />- {:then loadedItem}- <ActionButtonGroup buttons={getEnvironmentActionButtons(loadedItem, isCurrent)} size="sm" />- {/await}- {:else}+ <div class="flex min-w-0 flex-1 items-start justify-end pt-1 sm:pt-0">+ {#await environmentBoardStatePromise}<ActionButtonGroup buttons={getEnvironmentActionButtons(baseItem, isCurrent)} size="sm" />- {/if}+ {:then boardState}+ {@const loadedItem = boardState.overviewById.get(environment.id) ?? baseItem}+ {@const vInfo =+ loadedItem.versionInfo ||+ (debugUpgrade+ ? ({ displayVersion: 'debug', updateAvailable: true, newestVersion: 'debug-v2' } as any)+ : null)}+ <div class="flex items-center gap-2">+ {#if vInfo}+ <DashboardEnvironmentUpgradeAction+ environment={loadedItem.environment}+ versionInfo={vInfo}+ isAdmin={currentUserIsAdmin}+ debug={debugUpgrade}+ onRefreshRequested={refreshOverview}+ />+ {/if}+ <ActionButtonGroup buttons={getEnvironmentActionButtons(loadedItem, isCurrent)} size="sm" />+ </div>+ {/await}</div></div>- {#if item.loadPromise || isEnvironmentOnline(environment)}+ {#if shouldLoadEnvironment(environment) || isEnvironmentOnline(environment)}<div class="grid grid-cols-1 gap-3 sm:grid-cols-3"><div class="border-border/50 bg-background/50 rounded-lg border p-3"><div class="text-muted-foreground text-[11px] font-semibold tracking-wide uppercase">{m.containers_title()}</div>- {#if item.loadPromise}- {#await item.loadPromise}- <div class="mt-2 space-y-2">- <Skeleton class="h-6 w-20" />- <Skeleton class="h-3 w-24" />- </div>- {:then loadedItem}- <div class="mt-1 text-lg font-semibold">- {loadedItem.containers.runningContainers}/{loadedItem.containers.totalContainers}- </div>- <div class="text-muted-foreground text-xs">- {loadedItem.containers.stoppedContainers}- {m.common_stopped()}- </div>- {/await}- {:else}+ {#await environmentBoardStatePromise}+ <div class="mt-2 space-y-2">+ <Skeleton class="h-6 w-20" />+ <Skeleton class="h-3 w-24" />+ </div>+ {:then boardState}+ {@const loadedItem = boardState.overviewById.get(environment.id) ?? baseItem}<div class="mt-1 text-lg font-semibold">- {baseItem.containers.runningContainers}/{baseItem.containers.totalContainers}+ {loadedItem.containers.runningContainers}/{loadedItem.containers.totalContainers}</div><div class="text-muted-foreground text-xs">- {baseItem.containers.stoppedContainers}+ {loadedItem.containers.stoppedContainers}{m.common_stopped()}</div>- {/if}+ {/await}</div><div class="border-border/50 bg-background/50 rounded-lg border p-3"><div class="text-muted-foreground text-[11px] font-semibold tracking-wide uppercase">{m.images_title()}</div>- {#if item.loadPromise}- {#await item.loadPromise}- <div class="mt-2 space-y-2">- <Skeleton class="h-6 w-14" />- <Skeleton class="h-3 w-28" />- </div>- {:then loadedItem}- <div class="mt-1 text-lg font-semibold">{loadedItem.imageUsageCounts.totalImages}</div>- <div class="text-muted-foreground text-xs">- {loadedItem.imageUsageCounts.imagesInuse}- {m.common_in_use()} · {loadedItem.imageUsageCounts.imagesUnused}- {m.common_unused()}- </div>- {/await}- {:else}- <div class="mt-1 text-lg font-semibold">{baseItem.imageUsageCounts.totalImages}</div>+ {#await environmentBoardStatePromise}+ <div class="mt-2 space-y-2">+ <Skeleton class="h-6 w-14" />+ <Skeleton class="h-3 w-28" />+ </div>+ {:then boardState}+ {@const loadedItem = boardState.overviewById.get(environment.id) ?? baseItem}+ <div class="mt-1 text-lg font-semibold">{loadedItem.imageUsageCounts.totalImages}</div><div class="text-muted-foreground text-xs">- {baseItem.imageUsageCounts.imagesInuse}- {m.common_in_use()} · {baseItem.imageUsageCounts.imagesUnused}+ {loadedItem.imageUsageCounts.imagesInuse}+ {m.common_in_use()} · {loadedItem.imageUsageCounts.imagesUnused}{m.common_unused()}</div>- {/if}+ {/await}</div><div class="border-border/50 bg-background/50 rounded-lg border p-3"><div class="text-muted-foreground text-[11px] font-semibold tracking-wide uppercase">{m.dashboard_action_items_title()}</div>- {#if item.loadPromise}- {#await item.loadPromise}- <div class="mt-2 space-y-2">- <Skeleton class="h-6 w-12" />- <Skeleton class="h-3 w-32" />- </div>- {:then loadedItem}- <div class="mt-1 text-lg font-semibold">{loadedItem.actionItems.items.length}</div>- <div class="text-muted-foreground text-xs">{getActionSummary(loadedItem)}</div>- {/await}- {:else}- <div class="mt-1 text-lg font-semibold">{baseItem.actionItems.items.length}</div>- <div class="text-muted-foreground text-xs">{getActionSummary(baseItem)}</div>- {/if}+ {#await environmentBoardStatePromise}+ <div class="mt-2 space-y-2">+ <Skeleton class="h-6 w-12" />+ <Skeleton class="h-3 w-32" />+ </div>+ {:then boardState}+ {@const loadedItem = boardState.overviewById.get(environment.id) ?? baseItem}+ <div class="mt-1 text-lg font-semibold">{loadedItem.actionItems.items.length}</div>+ <div class="text-muted-foreground text-xs">{getActionSummary(loadedItem)}</div>+ {/await}</div></div>{:else}@@ -875,17 +927,14 @@</div>{/if}- {#if item.loadPromise}- {#await item.loadPromise then loadedItem}- {#if loadedItem.snapshotState === 'error' && loadedItem.snapshotError}- <div- class="rounded-lg border border-red-500/20 bg-red-500/5 px-3 py-2 text-xs text-red-700 dark:text-red-300"- >- {m.dashboard_all_summary_unavailable({ error: loadedItem.snapshotError })}- </div>- {/if}- {/await}- {/if}+ {#await environmentBoardStatePromise then boardState}+ {@const loadedItem = boardState.overviewById.get(environment.id) ?? baseItem}+ {#if loadedItem.snapshotState === 'error' && loadedItem.snapshotError}+ <div class="rounded-lg border border-red-500/20 bg-red-500/5 px-3 py-2 text-xs text-red-700 dark:text-red-300">+ {m.dashboard_all_summary_unavailable({ error: loadedItem.snapshotError })}+ </div>+ {/if}+ {/await}</Card.Content></Card.Root>{/each}diff --git a/frontend/src/routes/(app)/dashboard/dashboard-environment-upgrade-action.svelte b/frontend/src/routes/(app)/dashboard/dashboard-environment-upgrade-action.sveltenew file mode 100644index 000000000..af29a14fd--- /dev/null+++ b/frontend/src/routes/(app)/dashboard/dashboard-environment-upgrade-action.svelte@@ -0,0 +1,156 @@+<script lang="ts">+ import { toast } from 'svelte-sonner';+ import { createQuery } from '@tanstack/svelte-query';+ import { ArcaneButton } from '$lib/components/arcane-button/index.js';+ import UpgradeConfirmationDialog from '$lib/components/dialogs/upgrade-confirmation-dialog.svelte';+ import { m } from '$lib/paraglide/messages';+ import { queryKeys } from '$lib/query/query-keys';+ import environmentUpgradeService from '$lib/services/api/environment-upgrade-service';+ import systemUpgradeService from '$lib/services/api/system-upgrade-service';+ import type { AppVersionInformation } from '$lib/types/application-configuration';+ import type { Environment } from '$lib/types/environment.type';+ import { extractApiErrorMessage } from '$lib/utils/api.util';+ import { DownloadIcon } from '$lib/icons';++ let {+ environment,+ versionInfo,+ isAdmin,+ debug = false,+ onRefreshRequested+ }: {+ environment: Environment;+ versionInfo: AppVersionInformation;+ isAdmin: boolean;+ debug?: boolean;+ onRefreshRequested?: () => void | Promise<void>;+ } = $props();++ let showConfirmDialog = $state(false);+ let upgrading = $state(false);++ const shouldCheckUpgrade = $derived(!!(versionInfo.updateAvailable && isAdmin && !debug));+ const isLocalEnvironment = $derived(environment.id === '0');++ const upgradeAvailabilityQuery = createQuery(() => ({+ queryKey: queryKeys.system.environmentUpgradeAvailable(environment.id),+ queryFn: () =>+ environment.id === '0'+ ? systemUpgradeService.checkUpgradeAvailable()+ : environmentUpgradeService.checkEnvironmentUpgradeAvailable(environment.id),+ enabled: shouldCheckUpgrade,+ staleTime: 0+ }));++ const canUpgrade = $derived.by(() => {+ if (debug) return true;+ const result = upgradeAvailabilityQuery.data;+ return !!result?.canUpgrade && !result?.error;+ });++ const checkingUpgrade = $derived(+ !!(shouldCheckUpgrade && (upgradeAvailabilityQuery.isPending || upgradeAvailabilityQuery.isFetching))+ );++ const updateType = $derived.by(() => {+ if (versionInfo.isSemverVersion) return 'semver';+ if (versionInfo.currentTag && versionInfo.newestDigest) return 'digest';+ return 'none';+ });++ const updateDisplayText = $derived.by(() => {+ if (updateType === 'semver') {+ return versionInfo.newestVersion ?? '';+ }++ if (updateType === 'digest' && versionInfo.newestDigest) {+ const digest = versionInfo.newestDigest;+ return digest.length > 12 ? digest.slice(0, 12) : digest;+ }++ return '';+ });++ const shouldShowUpgrade = $derived((versionInfo.updateAvailable && isAdmin && canUpgrade) || (debug && isAdmin));++ const confirmVersion = $derived.by(() => {+ const value = versionInfo.newestVersion || updateDisplayText || '';+ return value.startsWith('v') ? value.slice(1) : value;+ });++ const upgradeButtonText = $derived.by(() => {+ if (upgrading) return m.upgrade_in_progress();+ if (checkingUpgrade) return m.upgrade_checking();++ if (updateType === 'digest') {+ const tag = versionInfo.currentTag ?? m.common_image();+ return m.upgrade_update_tag({ tag });+ }++ const version = versionInfo.newestVersion || updateDisplayText;+ if (version) {+ return m.upgrade_to_version({ version });+ }++ return m.upgrade_now();+ });++ async function handleConfirmUpgradeInternal() {+ if (isLocalEnvironment) {+ try {+ await systemUpgradeService.triggerUpgrade();+ toast.success(m.upgrade_success());+ } catch (error) {+ upgrading = false;+ const errorMessage = extractApiErrorMessage(error);+ toast.error(m.upgrade_failed({ error: errorMessage }));+ }+ return;+ }++ showConfirmDialog = false;++ try {+ const result = await environmentUpgradeService.triggerEnvironmentUpgrade(environment.id);++ if (!result.success) {+ throw new Error(result.error || result.message || m.common_unknown());+ }++ toast.success(m.upgrade_success());+ await onRefreshRequested?.();+ } catch (error) {+ upgrading = false;+ const errorMessage = extractApiErrorMessage(error);+ const wrappedPrefix = m.upgrade_failed({ error: '' });+ toast.error(errorMessage.startsWith(wrappedPrefix) ? errorMessage : m.upgrade_failed({ error: errorMessage }));+ } finally {+ if (!isLocalEnvironment) {+ upgrading = false;+ }+ }+ }+</script>++{#if shouldShowUpgrade}+ <ArcaneButton+ action="update"+ size="sm"+ class="shrink-0"+ onclick={() => (showConfirmDialog = true)}+ disabled={upgrading || checkingUpgrade}+ customLabel={upgradeButtonText}+ icon={DownloadIcon}+ />+{/if}++<UpgradeConfirmationDialog+ bind:open={showConfirmDialog}+ bind:upgrading+ version={confirmVersion}+ expectedVersion={versionInfo.newestVersion}+ expectedDigest={versionInfo.newestDigest}+ environmentName={isLocalEnvironment ? undefined : environment.name}+ environmentId={environment.id}+ onConfirm={handleConfirmUpgradeInternal}+/>diff --git a/tests/spec/dashboard-system-stats.spec.ts b/tests/spec/dashboard-system-stats.spec.tsindex b02093049..c06bb70e6 100644--- a/tests/spec/dashboard-system-stats.spec.ts+++ b/tests/spec/dashboard-system-stats.spec.ts@@ -102,12 +102,12 @@ async function mockDashboardStatsWebSocket(page: Page) {}, mockedStats);}-function collectEnvironmentRequestPaths(page: Page): string[] {+function collectDashboardRequestPaths(page: Page): string[] {const requestPaths: string[] = [];page.on('request', (request) => {const pathname = new URL(request.url()).pathname;- if (pathname.startsWith('/api/environments/')) {+ if (pathname.startsWith('/api/environments/') || pathname.startsWith('/api/dashboard/')) {requestPaths.push(pathname);}});@@ -139,20 +139,19 @@ test.describe('Dashboard system stats websocket', () => {await expect(page.getByText('HTTP', { exact: true }).first()).toBeVisible();});- test('loads dashboard content from the snapshot endpoint without dashboard REST fan-out', async ({+ test('loads dashboard content from the aggregated overview endpoint without dashboard REST fan-out', async ({page}) => {await mockDashboardStatsWebSocket(page);- const requestPaths = collectEnvironmentRequestPaths(page);+ const requestPaths = collectDashboardRequestPaths(page);await page.goto(defaultDashboardPath);await page.waitForLoadState('networkidle');- expect(- requestPaths.some((path) => /\/api\/environments\/[^/]+\/dashboard$/.test(path))- ).toBeTruthy();+ expect(requestPaths).toContain('/api/dashboard/environments');for (const blockedPattern of [+ /\/api\/environments\/[^/]+\/dashboard$/,/\/api\/environments\/[^/]+\/containers$/,/\/api\/environments\/[^/]+\/containers\/counts$/,/\/api\/environments\/[^/]+\/images$/,@@ -171,7 +170,7 @@ test.describe('Dashboard system stats websocket', () => {page}) => {await mockDashboardStatsWebSocket(page);- const requestPaths = collectEnvironmentRequestPaths(page);+ const requestPaths = collectDashboardRequestPaths(page);await page.goto(defaultDashboardPath);await page.waitForLoadState('networkidle');diff --git a/types/dashboard/dashboard.go b/types/dashboard/dashboard.goindex 0e5b0c8d3..8113f1153 100644--- a/types/dashboard/dashboard.go+++ b/types/dashboard/dashboard.go@@ -5,6 +5,7 @@ import (containertypes "github.com/getarcaneapp/arcane/types/container"environmenttypes "github.com/getarcaneapp/arcane/types/environment"imagetypes "github.com/getarcaneapp/arcane/types/image"+ versiontypes "github.com/getarcaneapp/arcane/types/version")type ActionItemKind string@@ -139,6 +140,11 @@ type EnvironmentOverview struct {// Required: trueSettings SnapshotSettings `json:"settings"`+ // VersionInfo is the environment application version metadata when available.+ //+ // Required: false+ VersionInfo *versiontypes.Info `json:"versionInfo,omitempty"`+// SnapshotState indicates whether the environment snapshot was fetched.//// Required: true