Skip to content

Modern Docker Management, Designed for Everyone

feat: environment settings now are edited on the agent details page (#1206)

Kyle Mendell2913ec776770
diff --git a/backend/internal/api/ws_handler.go b/backend/internal/api/ws_handler.go
index 912a88020..188851d40 100644
--- a/backend/internal/api/ws_handler.go
+++ b/backend/internal/api/ws_handler.go
@@ -787,7 +787,7 @@ func (h *WebSocketHandler) detectGPUs(ctx context.Context) error {
h.gpuDetectionCache.timestamp = time.Now()
h.gpuDetectionCache.Unlock()
h.detectionDone = true
- slog.InfoContext(ctx, "Using configured GPU type", slog.String("type", "nvidia"))
+ slog.InfoContext(ctx, "Using configured GPU type", "type", "nvidia")
return nil
}
return fmt.Errorf("nvidia-smi not found but GPU_TYPE set to nvidia")
@@ -801,7 +801,7 @@ func (h *WebSocketHandler) detectGPUs(ctx context.Context) error {
h.gpuDetectionCache.timestamp = time.Now()
h.gpuDetectionCache.Unlock()
h.detectionDone = true
- slog.InfoContext(ctx, "Using configured GPU type", slog.String("type", "amd"))
+ slog.InfoContext(ctx, "Using configured GPU type", "type", "amd")
return nil
}
return fmt.Errorf("rocm-smi not found but GPU_TYPE set to amd")
@@ -815,13 +815,13 @@ func (h *WebSocketHandler) detectGPUs(ctx context.Context) error {
h.gpuDetectionCache.timestamp = time.Now()
h.gpuDetectionCache.Unlock()
h.detectionDone = true
- slog.InfoContext(ctx, "Using configured GPU type", slog.String("type", "intel"))
+ slog.InfoContext(ctx, "Using configured GPU type", "type", "intel")
return nil
}
return fmt.Errorf("intel_gpu_top not found but GPU_TYPE set to intel")
default:
- slog.WarnContext(ctx, "Invalid GPU_TYPE specified, falling back to auto-detection", slog.String("gpu_type", h.gpuType))
+ slog.WarnContext(ctx, "Invalid GPU_TYPE specified, falling back to auto-detection", "gpu_type", h.gpuType)
}
}
diff --git a/backend/internal/bootstrap/bootstrap.go b/backend/internal/bootstrap/bootstrap.go
index 48b5df459..859fc876b 100644
--- a/backend/internal/bootstrap/bootstrap.go
+++ b/backend/internal/bootstrap/bootstrap.go
@@ -40,7 +40,7 @@ func Bootstrap(ctx context.Context) error {
shutdownCtx, shutdownCancel := context.WithTimeout(context.Background(), 10*time.Second) //nolint:contextcheck
defer shutdownCancel()
if err := db.Close(); err != nil {
- slog.ErrorContext(shutdownCtx, "Error closing database", slog.Any("error", err)) //nolint:contextcheck
+ slog.ErrorContext(shutdownCtx, "Error closing database", "error", err) //nolint:contextcheck
}
}(appCtx)
@@ -133,7 +133,7 @@ func runServices(appCtx context.Context, cfg *config.Config, router http.Handler
slog.InfoContext(appCtx, "Starting scheduler")
if err := scheduler.Run(appCtx); err != nil {
if !errors.Is(err, context.Canceled) {
- slog.ErrorContext(appCtx, "Job scheduler exited with error", slog.Any("error", err))
+ slog.ErrorContext(appCtx, "Job scheduler exited with error", "error", err)
}
}
slog.InfoContext(appCtx, "Scheduler stopped")
@@ -146,9 +146,9 @@ func runServices(appCtx context.Context, cfg *config.Config, router http.Handler
}
go func() {
- slog.InfoContext(appCtx, "Starting HTTP server", slog.String("port", cfg.Port))
+ slog.InfoContext(appCtx, "Starting HTTP server", "port", cfg.Port)
if err := srv.ListenAndServe(); err != nil && !errors.Is(err, http.ErrServerClosed) {
- slog.ErrorContext(appCtx, "Failed to start server", slog.Any("error", err))
+ slog.ErrorContext(appCtx, "Failed to start server", "error", err)
}
}()
@@ -167,7 +167,7 @@ func runServices(appCtx context.Context, cfg *config.Config, router http.Handler
defer shutdownCancel()
if err := srv.Shutdown(shutdownCtx); err != nil { //nolint:contextcheck
- slog.ErrorContext(shutdownCtx, "Server forced to shutdown", slog.Any("error", err)) //nolint:contextcheck
+ slog.ErrorContext(shutdownCtx, "Server forced to shutdown", "error", err) //nolint:contextcheck
return err
}
diff --git a/backend/internal/bootstrap/jobs_bootstrap.go b/backend/internal/bootstrap/jobs_bootstrap.go
index f378df1a1..17a66773c 100644
--- a/backend/internal/bootstrap/jobs_bootstrap.go
+++ b/backend/internal/bootstrap/jobs_bootstrap.go
@@ -20,50 +20,50 @@ func initializeScheduler() (*job.Scheduler, error) {
func registerJobs(appCtx context.Context, scheduler *job.Scheduler, appServices *Services, appConfig *config.Config) {
autoUpdateJob := job.NewAutoUpdateJob(scheduler, appServices.Updater, appServices.Settings)
if err := autoUpdateJob.Register(appCtx); err != nil {
- slog.ErrorContext(appCtx, "Failed to register auto-update job", slog.Any("error", err))
+ slog.ErrorContext(appCtx, "Failed to register auto-update job", "error", err)
}
imagePollingJob := job.NewImagePollingJob(scheduler, appServices.ImageUpdate, appServices.Settings, appServices.Environment)
if err := imagePollingJob.Register(appCtx); err != nil {
- slog.ErrorContext(appCtx, "Failed to register image polling job", slog.Any("error", err))
+ slog.ErrorContext(appCtx, "Failed to register image polling job", "error", err)
}
environmentHealthJob := job.NewEnvironmentHealthJob(scheduler, appServices.Environment, appServices.Settings)
if !appConfig.AgentMode {
if err := environmentHealthJob.Register(appCtx); err != nil {
- slog.ErrorContext(appCtx, "Failed to register environment health check job", slog.Any("error", err))
+ slog.ErrorContext(appCtx, "Failed to register environment health check job", "error", err)
}
}
analyticsJob := job.NewAnalyticsJob(scheduler, appServices.Settings, nil, appConfig)
if err := analyticsJob.Register(appCtx); err != nil {
- slog.ErrorContext(appCtx, "Failed to register analytics heartbeat job", slog.Any("error", err))
+ slog.ErrorContext(appCtx, "Failed to register analytics heartbeat job", "error", err)
}
if err := job.RegisterEventCleanupJob(appCtx, scheduler, appServices.Event); err != nil {
- slog.ErrorContext(appCtx, "Failed to register event cleanup job", slog.Any("error", err))
+ slog.ErrorContext(appCtx, "Failed to register event cleanup job", "error", err)
}
if err := job.RegisterFilesystemWatcherJob(appCtx, scheduler, appServices.Project, appServices.Template, appServices.Settings); err != nil {
- slog.ErrorContext(appCtx, "Failed to register filesystem watcher job", slog.Any("error", err))
+ slog.ErrorContext(appCtx, "Failed to register filesystem watcher job", "error", err)
}
appServices.Settings.OnImagePollingSettingsChanged = func(ctx context.Context) {
if err := imagePollingJob.Reschedule(ctx); err != nil {
- slog.WarnContext(ctx, "Failed to reschedule image-polling job", slog.Any("error", err))
+ slog.WarnContext(ctx, "Failed to reschedule image-polling job", "error", err)
}
if err := autoUpdateJob.Reschedule(ctx); err != nil {
- slog.WarnContext(ctx, "Failed to reschedule auto-update job", slog.Any("error", err))
+ slog.WarnContext(ctx, "Failed to reschedule auto-update job", "error", err)
}
if !appConfig.AgentMode {
if err := environmentHealthJob.Reschedule(ctx); err != nil {
- slog.WarnContext(ctx, "Failed to reschedule environment-health job", slog.Any("error", err))
+ slog.WarnContext(ctx, "Failed to reschedule environment-health job", "error", err)
}
}
}
appServices.Settings.OnAutoUpdateSettingsChanged = func(ctx context.Context) {
if err := autoUpdateJob.Reschedule(ctx); err != nil {
- slog.WarnContext(ctx, "Failed to reschedule auto-update job", slog.Any("error", err))
+ slog.WarnContext(ctx, "Failed to reschedule auto-update job", "error", err)
}
}
}
diff --git a/backend/internal/database/database.go b/backend/internal/database/database.go
index 867fb7fab..ffeab8917 100644
--- a/backend/internal/database/database.go
+++ b/backend/internal/database/database.go
@@ -121,7 +121,7 @@ func connectDatabase(databaseURL string) (*DB, error) {
return &DB{db}, nil
}
- slog.Info("Failed to initialize database", slog.Int("attempt", i))
+ slog.Info("Failed to initialize database", "attempt", i)
if i < 3 {
time.Sleep(3 * time.Second)
}
diff --git a/backend/internal/huma/handlers/settings.go b/backend/internal/huma/handlers/settings.go
index 098bf6151..b4c4ccaee 100644
--- a/backend/internal/huma/handlers/settings.go
+++ b/backend/internal/huma/handlers/settings.go
@@ -2,6 +2,7 @@ package handlers
import (
"context"
+ "encoding/json"
"net/http"
"strconv"
"strings"
@@ -21,6 +22,7 @@ import (
type SettingsHandler struct {
settingsService *services.SettingsService
settingsSearchService *services.SettingsSearchService
+ environmentService *services.EnvironmentService
cfg *config.Config
}
@@ -64,10 +66,11 @@ type GetCategoriesOutput struct {
}
// RegisterSettings registers settings management routes using Huma.
-func RegisterSettings(api huma.API, settingsService *services.SettingsService, settingsSearchService *services.SettingsSearchService, cfg *config.Config) {
+func RegisterSettings(api huma.API, settingsService *services.SettingsService, settingsSearchService *services.SettingsSearchService, environmentService *services.EnvironmentService, cfg *config.Config) {
h := &SettingsHandler{
settingsService: settingsService,
settingsSearchService: settingsSearchService,
+ environmentService: environmentService,
cfg: cfg,
}
@@ -141,6 +144,24 @@ func (h *SettingsHandler) GetPublicSettings(ctx context.Context, input *GetPubli
return nil, huma.Error500InternalServerError("service not available")
}
+ if input.EnvironmentID != "0" {
+ if h.environmentService == nil {
+ return nil, huma.Error500InternalServerError("environment service not available")
+ }
+ respBody, statusCode, err := h.environmentService.ProxyRequest(ctx, input.EnvironmentID, http.MethodGet, "/api/environments/0/settings/public", nil)
+ if err != nil {
+ return nil, huma.Error502BadGateway("failed to proxy request to environment: " + err.Error())
+ }
+ if statusCode != http.StatusOK {
+ return nil, huma.NewError(statusCode, "environment returned error: "+string(respBody), nil)
+ }
+ var settingsDto []settings.PublicSetting
+ if err := json.Unmarshal(respBody, &settingsDto); err != nil {
+ return nil, huma.Error500InternalServerError("failed to decode environment response: " + err.Error())
+ }
+ return &GetPublicSettingsOutput{Body: settingsDto}, nil
+ }
+
settingsList := h.settingsService.ListSettings(false)
var settingsDto []settings.PublicSetting
@@ -168,6 +189,24 @@ func (h *SettingsHandler) GetSettings(ctx context.Context, input *GetSettingsInp
return nil, huma.Error500InternalServerError("service not available")
}
+ if input.EnvironmentID != "0" {
+ if h.environmentService == nil {
+ return nil, huma.Error500InternalServerError("environment service not available")
+ }
+ respBody, statusCode, err := h.environmentService.ProxyRequest(ctx, input.EnvironmentID, http.MethodGet, "/api/environments/0/settings", nil)
+ if err != nil {
+ return nil, huma.Error502BadGateway("failed to proxy request to environment: " + err.Error())
+ }
+ if statusCode != http.StatusOK {
+ return nil, huma.NewError(statusCode, "environment returned error: "+string(respBody), nil)
+ }
+ var settingsDto []settings.PublicSetting
+ if err := json.Unmarshal(respBody, &settingsDto); err != nil {
+ return nil, huma.Error500InternalServerError("failed to decode environment response: " + err.Error())
+ }
+ return &GetSettingsOutput{Body: settingsDto}, nil
+ }
+
showAll := input.EnvironmentID == "0"
settingsList := h.settingsService.ListSettings(showAll)
@@ -196,8 +235,12 @@ func (h *SettingsHandler) UpdateSettings(ctx context.Context, input *UpdateSetti
return nil, huma.Error500InternalServerError("service not available")
}
- // Check if trying to update auth settings on non-local environment
if input.EnvironmentID != "0" {
+ if h.environmentService == nil {
+ return nil, huma.Error500InternalServerError("environment service not available")
+ }
+
+ // Check if trying to update auth settings on non-local environment
req := input.Body
if req.AuthLocalEnabled != nil || req.OidcEnabled != nil ||
req.AuthSessionTimeout != nil || req.AuthPasswordPolicy != nil ||
@@ -207,6 +250,26 @@ func (h *SettingsHandler) UpdateSettings(ctx context.Context, input *UpdateSetti
req.OidcAdminValue != nil || req.OidcMergeAccounts != nil {
return nil, huma.Error403Forbidden((&common.AuthSettingsUpdateError{}).Error())
}
+
+ body, err := json.Marshal(input.Body)
+ if err != nil {
+ return nil, huma.Error500InternalServerError("failed to marshal request body: " + err.Error())
+ }
+
+ respBody, statusCode, err := h.environmentService.ProxyRequest(ctx, input.EnvironmentID, http.MethodPut, "/api/environments/0/settings", body)
+ if err != nil {
+ return nil, huma.Error502BadGateway("failed to proxy request to environment: " + err.Error())
+ }
+ if statusCode != http.StatusOK {
+ return nil, huma.NewError(statusCode, "environment returned error: "+string(respBody), nil)
+ }
+
+ var apiResp base.ApiResponse[[]settings.SettingDto]
+ if err := json.Unmarshal(respBody, &apiResp); err != nil {
+ return nil, huma.Error500InternalServerError("failed to decode environment response: " + err.Error())
+ }
+
+ return &UpdateSettingsOutput{Body: apiResp}, nil
}
updatedSettings, err := h.settingsService.UpdateSettings(ctx, input.Body)
diff --git a/backend/internal/huma/huma.go b/backend/internal/huma/huma.go
index 86934c4da..b7f3c7ae2 100644
--- a/backend/internal/huma/huma.go
+++ b/backend/internal/huma/huma.go
@@ -341,7 +341,7 @@ func registerHandlers(api huma.API, svc *Services) {
handlers.RegisterTemplates(api, templateSvc)
handlers.RegisterImages(api, dockerSvc, imageSvc, imageUpdateSvc, settingsSvc)
handlers.RegisterImageUpdates(api, imageUpdateSvc)
- handlers.RegisterSettings(api, settingsSvc, settingsSearchSvc, cfg)
+ handlers.RegisterSettings(api, settingsSvc, settingsSearchSvc, environmentSvc, cfg)
handlers.RegisterVolumes(api, dockerSvc, volumeSvc)
handlers.RegisterContainers(api, containerSvc, dockerSvc)
handlers.RegisterNetworks(api, networkSvc, dockerSvc)
diff --git a/backend/internal/job/event_cleanup_job.go b/backend/internal/job/event_cleanup_job.go
index dd9df4b16..cfcb6f70a 100644
--- a/backend/internal/job/event_cleanup_job.go
+++ b/backend/internal/job/event_cleanup_job.go
@@ -25,10 +25,7 @@ func RegisterEventCleanupJob(
// Delete events older than 36 hours
olderThan := 36 * time.Hour
if err := eventService.DeleteOldEvents(jobCtx, olderThan); err != nil {
- slog.ErrorContext(jobCtx, "Failed to delete old events",
- "jobName", EventCleanupJobName,
- "olderThan", olderThan.String(),
- slog.Any("error", err))
+ slog.ErrorContext(jobCtx, "Failed to delete old events", "jobName", EventCleanupJobName, "olderThan", olderThan.String(), "error", err)
return err
}
diff --git a/backend/internal/job/image_polling_job.go b/backend/internal/job/image_polling_job.go
index 45e884cd7..9b0b6e9e7 100644
--- a/backend/internal/job/image_polling_job.go
+++ b/backend/internal/job/image_polling_job.go
@@ -37,13 +37,11 @@ func (j *ImagePollingJob) Register(ctx context.Context) error {
interval := time.Duration(pollingInterval) * time.Minute
if interval < 5*time.Minute {
- slog.WarnContext(ctx, "polling interval too low; using default",
- slog.Int("requested_minutes", pollingInterval),
- slog.String("effective_interval", "60m"))
+ slog.WarnContext(ctx, "polling interval too low; using default", "requested_minutes", pollingInterval, "effective_interval", "60m")
interval = 60 * time.Minute
}
- slog.InfoContext(ctx, "registering image polling job", slog.String("interval", interval.String()))
+ slog.InfoContext(ctx, "registering image polling job", "interval", interval.String())
j.scheduler.RemoveJobByName("image-polling")
@@ -62,14 +60,13 @@ func (j *ImagePollingJob) Execute(ctx context.Context) error {
creds, err := j.loadRegistryCredentials(ctx)
if err != nil {
- slog.WarnContext(ctx, "failed to load registry credentials for polling",
- slog.String("error", err.Error()))
+ slog.WarnContext(ctx, "failed to load registry credentials for polling", "error", err.Error())
creds = nil
}
results, err := j.imageUpdateService.CheckAllImages(ctx, 0, creds)
if err != nil {
- slog.ErrorContext(ctx, "image scan failed", slog.Any("err", err))
+ slog.ErrorContext(ctx, "image scan failed", "err", err)
return err
}
@@ -89,10 +86,7 @@ func (j *ImagePollingJob) Execute(ctx context.Context) error {
}
}
- slog.InfoContext(ctx, "image scan run completed",
- slog.Int("checked", total),
- slog.Int("updates", updates),
- slog.Int("errors", errors))
+ slog.InfoContext(ctx, "image scan run completed", "checked", total, "updates", updates, "errors", errors)
return nil
}
@@ -115,7 +109,7 @@ func (j *ImagePollingJob) Reschedule(ctx context.Context) error {
if interval < 5*time.Minute {
interval = 60 * time.Minute
}
- slog.InfoContext(ctx, "polling settings changed; rescheduling", slog.String("interval", interval.String()))
+ slog.InfoContext(ctx, "polling settings changed; rescheduling", "interval", interval.String())
return j.scheduler.RescheduleDurationJobByName(ctx, "image-polling", interval, j.Execute, false)
}
diff --git a/backend/internal/job/job.go b/backend/internal/job/job.go
index 78e8be91c..e532e0442 100644
--- a/backend/internal/job/job.go
+++ b/backend/internal/job/job.go
@@ -32,7 +32,7 @@ func (s *Scheduler) Run(ctx context.Context) error {
slog.InfoContext(ctx, "Shutting down job scheduler...")
err := s.scheduler.Shutdown()
if err != nil {
- slog.ErrorContext(ctx, "Error shutting down job scheduler", slog.Any("error", err))
+ slog.ErrorContext(ctx, "Error shutting down job scheduler", "error", err)
return fmt.Errorf("error during scheduler shutdown: %w", err)
}
@@ -52,20 +52,20 @@ func (s *Scheduler) RegisterJob(
gocron.WithName(name),
gocron.WithEventListeners(
gocron.BeforeJobRuns(func(jobID uuid.UUID, jobName string) {
- slog.InfoContext(ctx, "Job starting", slog.String("name", name), slog.String("id", jobID.String()))
+ slog.InfoContext(ctx, "Job starting", "name", name, "id", jobID.String())
}),
gocron.AfterJobRuns(func(jobID uuid.UUID, jobName string) {
- slog.InfoContext(ctx, "Job finished successfully", slog.String("name", name), slog.String("id", jobID.String()))
+ slog.InfoContext(ctx, "Job finished successfully", "name", name, "id", jobID.String())
}),
gocron.AfterJobRunsWithError(func(jobID uuid.UUID, jobName string, err error) {
- slog.ErrorContext(ctx, "Job failed", slog.String("name", name), slog.String("id", jobID.String()), slog.Any("error", err))
+ slog.ErrorContext(ctx, "Job failed", "name", name, "id", jobID.String(), "error", err)
}),
),
}
task := gocron.NewTask(func() {
if err := taskFunc(ctx); err != nil {
- slog.ErrorContext(ctx, "Error executing task function", slog.String("name", name), slog.Any("error", err))
+ slog.ErrorContext(ctx, "Error executing task function", "name", name, "error", err)
}
})
@@ -79,7 +79,7 @@ func (s *Scheduler) RegisterJob(
return fmt.Errorf("failed to register job %q: %w", name, err)
}
- slog.InfoContext(ctx, "Job registered successfully", slog.String("name", name))
+ slog.InfoContext(ctx, "Job registered successfully", "name", name)
return nil
}
diff --git a/backend/internal/middleware/environment_middleware.go b/backend/internal/middleware/environment_middleware.go
index 347401667..33c0a848b 100644
--- a/backend/internal/middleware/environment_middleware.go
+++ b/backend/internal/middleware/environment_middleware.go
@@ -26,6 +26,8 @@ const (
managementEndpointSyncRegistries = "/sync-registries"
managementEndpointDeployment = "/deployment"
managementEndpointAgentPair = "/agent/pair"
+ managementEndpointVersion = "/version"
+ managementEndpointSettings = "/settings"
errEnvironmentNotFound = "Environment not found"
errEnvironmentDisabled = "Environment is disabled"
@@ -137,6 +139,8 @@ func (m *EnvironmentMiddleware) hasResourcePath(c *gin.Context, envID string) bo
managementEndpointSyncRegistries,
managementEndpointDeployment,
managementEndpointAgentPair,
+ managementEndpointVersion,
+ managementEndpointSettings,
}
for _, endpoint := range managementEndpoints {
diff --git a/backend/internal/models/settings.go b/backend/internal/models/settings.go
index c393c54a9..0e8c63038 100644
--- a/backend/internal/models/settings.go
+++ b/backend/internal/models/settings.go
@@ -53,13 +53,13 @@ type Settings struct {
AccentColor SettingVariable `key:"accentColor,public,local" meta:"label=Accent Color;type=text;keywords=color,accent,theme,css,appearance,ui;category=general;description=Primary accent color for UI"`
// Docker category
- AutoUpdate SettingVariable `key:"autoUpdate" meta:"label=Auto Update;type=boolean;keywords=auto,update,automatic,upgrade,refresh,restart,deploy;category=docker;description=Automatically update containers when new images are available" catmeta:"id=docker;title=Docker;icon=database;url=/settings/docker;description=Configure Docker settings, polling, and auto-updates"`
- AutoUpdateInterval SettingVariable `key:"autoUpdateInterval" meta:"label=Auto Update Interval;type=number;keywords=auto,update,interval,frequency,schedule,automatic,timing;category=docker;description=Interval between automatic updates"`
- PollingEnabled SettingVariable `key:"pollingEnabled" meta:"label=Enable Polling;type=boolean;keywords=polling,check,monitor,watch,scan,detection,automatic;category=docker;description=Enable automatic checking for image updates"`
- PollingInterval SettingVariable `key:"pollingInterval" meta:"label=Polling Interval;type=number;keywords=interval,frequency,schedule,time,minutes,period,delay;category=docker;description=How often to check for image updates"`
- PruneMode SettingVariable `key:"dockerPruneMode" meta:"label=Docker Prune Action;type=select;keywords=prune,cleanup,clean,remove,delete,unused,dangling,space,disk;category=docker;description=Configure how unused Docker images are cleaned up"`
- MaxImageUploadSize SettingVariable `key:"maxImageUploadSize" meta:"label=Max Image Upload Size;type=number;keywords=upload,size,limit,maximum,image,tar,file,megabytes,mb,storage;category=docker;description=Maximum size in MB for image archive uploads (default: 500)"`
- DockerHost SettingVariable `key:"dockerHost,public,envOverride" meta:"label=Docker Host;type=text;keywords=docker,host,daemon,socket,unix,remote;category=docker;description=URI for Docker daemon"`
+ AutoUpdate SettingVariable `key:"autoUpdate" meta:"label=Auto Update;type=boolean;keywords=auto,update,automatic,upgrade,refresh,restart,deploy;category=internal;description=Automatically update containers when new images are available"`
+ AutoUpdateInterval SettingVariable `key:"autoUpdateInterval" meta:"label=Auto Update Interval;type=number;keywords=auto,update,interval,frequency,schedule,automatic,timing;category=internal;description=Interval between automatic updates"`
+ PollingEnabled SettingVariable `key:"pollingEnabled" meta:"label=Enable Polling;type=boolean;keywords=polling,check,monitor,watch,scan,detection,automatic;category=internal;description=Enable automatic checking for image updates"`
+ PollingInterval SettingVariable `key:"pollingInterval" meta:"label=Polling Interval;type=number;keywords=interval,frequency,schedule,time,minutes,period,delay;category=internal;description=How often to check for image updates"`
+ PruneMode SettingVariable `key:"dockerPruneMode" meta:"label=Docker Prune Action;type=select;keywords=prune,cleanup,clean,remove,delete,unused,dangling,space,disk;category=internal;description=Configure how unused Docker images are cleaned up"`
+ MaxImageUploadSize SettingVariable `key:"maxImageUploadSize" meta:"label=Max Image Upload Size;type=number;keywords=upload,size,limit,maximum,image,tar,file,megabytes,mb,storage;category=internal;description=Maximum size in MB for image archive uploads (default: 500)"`
+ DockerHost SettingVariable `key:"dockerHost,public,envOverride" meta:"label=Docker Host;type=text;keywords=docker,host,daemon,socket,unix,remote;category=internal;description=URI for Docker daemon"`
// Security category
AuthLocalEnabled SettingVariable `key:"authLocalEnabled,public" meta:"label=Local Authentication;type=boolean;keywords=local,auth,authentication,username,password,login,credentials;category=security;description=Enable local username/password authentication" catmeta:"id=security;title=Security;icon=shield;url=/settings/security;description=Manage authentication and security settings"`
diff --git a/backend/internal/services/apprise_service.go b/backend/internal/services/apprise_service.go
index 1a10e8f6b..593fa10e7 100644
--- a/backend/internal/services/apprise_service.go
+++ b/backend/internal/services/apprise_service.go
@@ -110,11 +110,7 @@ func (s *AppriseService) SendNotification(ctx context.Context, title, body, form
return fmt.Errorf("failed to marshal notification payload: %w", err)
}
- slog.InfoContext(ctx, "Sending Apprise notification",
- slog.String("url", settings.APIURL),
- slog.String("title", title),
- slog.Any("tags", tags),
- slog.String("type", string(notificationType)))
+ slog.InfoContext(ctx, "Sending Apprise notification", "url", settings.APIURL, "title", title, "tags", tags, "type", string(notificationType))
req, err := http.NewRequestWithContext(ctx, http.MethodPost, settings.APIURL, bytes.NewBuffer(jsonData))
if err != nil {
@@ -134,16 +130,11 @@ func (s *AppriseService) SendNotification(ctx context.Context, title, body, form
bodyString := string(bodyBytes)
if resp.StatusCode != http.StatusOK {
- slog.ErrorContext(ctx, "Apprise API returned error",
- slog.Int("status", resp.StatusCode),
- slog.String("response", bodyString),
- slog.String("url", settings.APIURL))
+ slog.ErrorContext(ctx, "Apprise API returned error", "status", resp.StatusCode, "response", bodyString, "url", settings.APIURL)
return fmt.Errorf("apprise API returned status %d: %s", resp.StatusCode, bodyString)
}
- slog.InfoContext(ctx, "Apprise notification sent successfully",
- slog.Int("status", resp.StatusCode),
- slog.String("response", bodyString))
+ slog.InfoContext(ctx, "Apprise notification sent successfully", "status", resp.StatusCode, "response", bodyString)
return nil
}
diff --git a/backend/internal/services/auth_service.go b/backend/internal/services/auth_service.go
index a74d99804..cf814967a 100644
--- a/backend/internal/services/auth_service.go
+++ b/backend/internal/services/auth_service.go
@@ -571,10 +571,7 @@ func (s *AuthService) VerifyToken(ctx context.Context, accessToken string) (*mod
}
if claims.AppVersion != "" && claims.AppVersion != config.Version {
- slog.InfoContext(ctx, "Token version mismatch detected",
- "tokenVersion", claims.AppVersion,
- "currentVersion", config.Version,
- "user", claims.Username)
+ slog.InfoContext(ctx, "Token version mismatch detected", "tokenVersion", claims.AppVersion, "currentVersion", config.Version, "user", claims.Username)
return nil, ErrTokenVersionMismatch
}
diff --git a/backend/internal/services/environment_service.go b/backend/internal/services/environment_service.go
index ce1832346..94d8f8eff 100644
--- a/backend/internal/services/environment_service.go
+++ b/backend/internal/services/environment_service.go
@@ -1,6 +1,7 @@
package services
import (
+ "bytes"
"context"
"encoding/json"
"errors"
@@ -405,9 +406,7 @@ func (s *EnvironmentService) GetEnabledRegistryCredentials(ctx context.Context)
decryptedToken, err := utils.Decrypt(reg.Token)
if err != nil {
- slog.WarnContext(ctx, "Failed to decrypt registry token",
- slog.String("registryURL", reg.URL),
- slog.String("error", err.Error()))
+ slog.WarnContext(ctx, "Failed to decrypt registry token", "registryURL", reg.URL, "error", err.Error())
continue
}
@@ -480,10 +479,7 @@ func (s *EnvironmentService) SyncRegistriesToEnvironment(ctx context.Context, en
return fmt.Errorf("cannot sync registries to local environment")
}
- slog.InfoContext(ctx, "Starting registry sync to environment",
- slog.String("environmentID", environmentID),
- slog.String("environmentName", environment.Name),
- slog.String("apiUrl", environment.ApiUrl))
+ slog.InfoContext(ctx, "Starting registry sync to environment", "environmentID", environmentID, "environmentName", environment.Name, "apiUrl", environment.ApiUrl)
// Get all registries from this manager
var registries []models.ContainerRegistry
@@ -491,18 +487,14 @@ func (s *EnvironmentService) SyncRegistriesToEnvironment(ctx context.Context, en
return fmt.Errorf("failed to get registries: %w", err)
}
- slog.InfoContext(ctx, "Found registries to sync",
- slog.Int("count", len(registries)))
+ slog.InfoContext(ctx, "Found registries to sync", "count", len(registries))
// Prepare sync items with decrypted tokens
syncItems := make([]containerregistry.Sync, 0, len(registries))
for _, reg := range registries {
decryptedToken, err := utils.Decrypt(reg.Token)
if err != nil {
- slog.WarnContext(ctx, "Failed to decrypt registry token for sync",
- slog.String("registryID", reg.ID),
- slog.String("registryURL", reg.URL),
- slog.String("error", err.Error()))
+ slog.WarnContext(ctx, "Failed to decrypt registry token for sync", "registryID", reg.ID, "registryURL", reg.URL, "error", err.Error())
continue
}
@@ -535,7 +527,7 @@ func (s *EnvironmentService) SyncRegistriesToEnvironment(ctx context.Context, en
defer cancel()
targetURL := strings.TrimRight(environment.ApiUrl, "/") + "/api/container-registries/sync"
- req, err := http.NewRequestWithContext(reqCtx, http.MethodPost, targetURL, strings.NewReader(string(reqBody)))
+ req, err := http.NewRequestWithContext(reqCtx, http.MethodPost, targetURL, bytes.NewReader(reqBody))
if err != nil {
return fmt.Errorf("failed to create sync request: %w", err)
}
@@ -554,13 +546,10 @@ func (s *EnvironmentService) SyncRegistriesToEnvironment(ctx context.Context, en
slog.DebugContext(ctx, "Set agent token header for sync request")
}
} else {
- slog.WarnContext(ctx, "No access token available for environment sync",
- slog.String("environmentID", environmentID))
+ slog.WarnContext(ctx, "No access token available for environment sync", "environmentID", environmentID)
}
- slog.InfoContext(ctx, "Sending sync request to agent",
- slog.String("url", targetURL),
- slog.Int("registryCount", len(syncItems)))
+ slog.InfoContext(ctx, "Sending sync request to agent", "url", targetURL, "registryCount", len(syncItems))
resp, err := s.httpClient.Do(req)
if err != nil {
@@ -570,9 +559,7 @@ func (s *EnvironmentService) SyncRegistriesToEnvironment(ctx context.Context, en
if resp.StatusCode != http.StatusOK {
body, _ := io.ReadAll(resp.Body)
- slog.ErrorContext(ctx, "Sync request failed",
- slog.Int("statusCode", resp.StatusCode),
- slog.String("response", string(body)))
+ slog.ErrorContext(ctx, "Sync request failed", "statusCode", resp.StatusCode, "response", string(body))
return fmt.Errorf("sync request failed with status %d: %s", resp.StatusCode, string(body))
}
@@ -590,9 +577,55 @@ func (s *EnvironmentService) SyncRegistriesToEnvironment(ctx context.Context, en
return fmt.Errorf("sync failed: %s", result.Data.Message)
}
- slog.InfoContext(ctx, "Successfully synced registries to environment",
- slog.String("environmentID", environmentID),
- slog.String("environmentName", environment.Name))
+ slog.InfoContext(ctx, "Successfully synced registries to environment", "environmentID", environmentID, "environmentName", environment.Name)
return nil
}
+
+// ProxyRequest sends a request to a remote environment's API.
+func (s *EnvironmentService) ProxyRequest(ctx context.Context, envID string, method string, path string, body []byte) ([]byte, int, error) {
+ environment, err := s.GetEnvironmentByID(ctx, envID)
+ if err != nil {
+ return nil, 0, fmt.Errorf("failed to get environment: %w", err)
+ }
+
+ if envID == "0" {
+ return nil, 0, fmt.Errorf("cannot proxy request to local environment")
+ }
+
+ targetURL := strings.TrimRight(environment.ApiUrl, "/") + path
+ var bodyReader io.Reader
+ if len(body) > 0 {
+ bodyReader = bytes.NewReader(body)
+ }
+ req, err := http.NewRequestWithContext(ctx, method, targetURL, bodyReader)
+ if err != nil {
+ return nil, 0, fmt.Errorf("failed to create request: %w", err)
+ }
+
+ if method != http.MethodGet && len(body) > 0 {
+ req.Header.Set("Content-Type", "application/json")
+ }
+
+ // Use appropriate auth header
+ if environment.AccessToken != nil && *environment.AccessToken != "" {
+ if environment.ApiKeyID != nil && *environment.ApiKeyID != "" {
+ req.Header.Set("X-API-KEY", *environment.AccessToken)
+ } else {
+ req.Header.Set("X-Arcane-Agent-Token", *environment.AccessToken)
+ }
+ }
+
+ resp, err := s.httpClient.Do(req)
+ if err != nil {
+ return nil, 0, fmt.Errorf("failed to send request: %w", err)
+ }
+ defer resp.Body.Close()
+
+ respBody, err := io.ReadAll(resp.Body)
+ if err != nil {
+ return nil, resp.StatusCode, fmt.Errorf("failed to read response body: %w", err)
+ }
+
+ return respBody, resp.StatusCode, nil
+}
diff --git a/backend/internal/services/notification_service.go b/backend/internal/services/notification_service.go
index 1960a6f7c..9639b5e7e 100644
--- a/backend/internal/services/notification_service.go
+++ b/backend/internal/services/notification_service.go
@@ -806,9 +806,7 @@ func (s *NotificationService) logNotification(ctx context.Context, provider mode
}
if err := s.db.WithContext(ctx).Create(log).Error; err != nil {
- slog.WarnContext(ctx, "Failed to log notification",
- slog.String("provider", string(provider)),
- slog.String("error", err.Error()))
+ slog.WarnContext(ctx, "Failed to log notification", "provider", string(provider), "error", err.Error())
}
}
diff --git a/backend/internal/services/settings_service.go b/backend/internal/services/settings_service.go
index db6bd4be8..17908ae0a 100644
--- a/backend/internal/services/settings_service.go
+++ b/backend/internal/services/settings_service.go
@@ -191,8 +191,13 @@ func (s *SettingsService) loadDatabaseConfigFromEnv(ctx context.Context, db *dat
slog.DebugContext(ctx, "loadDatabaseConfigFromEnv: env override found", "key", key, "env", envVarName, "valueMasked", mask)
rv.Field(i).FieldByName("Value").SetString(val)
continue
+ } else if val, ok := settingsMap[key]; ok {
+ // Fallback to database if environment variable is not set
+ slog.DebugContext(ctx, "loadDatabaseConfigFromEnv: using database fallback", "key", key)
+ rv.Field(i).FieldByName("Value").SetString(val)
+ continue
} else {
- slog.DebugContext(ctx, "loadDatabaseConfigFromEnv: env not set", "key", key, "env", envVarName)
+ slog.DebugContext(ctx, "loadDatabaseConfigFromEnv: env not set and no database value", "key", key, "env", envVarName)
}
}
diff --git a/backend/internal/services/system_service.go b/backend/internal/services/system_service.go
index 588951c08..756fb4832 100644
--- a/backend/internal/services/system_service.go
+++ b/backend/internal/services/system_service.go
@@ -55,13 +55,7 @@ var systemUser = models.User{
}
func (s *SystemService) PruneAll(ctx context.Context, req system.PruneAllRequest) (*system.PruneAllResult, error) {
- slog.InfoContext(ctx, "Starting selective prune operation",
- slog.Bool("containers", req.Containers),
- slog.Bool("images", req.Images),
- slog.Bool("volumes", req.Volumes),
- slog.Bool("networks", req.Networks),
- slog.Bool("build_cache", req.BuildCache),
- slog.Bool("dangling", req.Dangling))
+ slog.InfoContext(ctx, "Starting selective prune operation", "containers", req.Containers, "images", req.Images, "volumes", req.Volumes, "networks", req.Networks, "build_cache", req.BuildCache, "dangling", req.Dangling)
result := &system.PruneAllResult{Success: true}
var mu sync.Mutex
@@ -82,12 +76,10 @@ func (s *SystemService) PruneAll(ctx context.Context, req system.PruneAllRequest
g.Go(func() error {
danglingOnly := req.Dangling
if settingsDangling, _ := s.getDanglingModeFromSettings(ctx); settingsDangling != danglingOnly {
- slog.DebugContext(ctx, "Prune request overriding stored image prune mode",
- slog.Bool("settings_dangling_only", settingsDangling),
- slog.Bool("request_dangling_only", danglingOnly))
+ slog.DebugContext(ctx, "Prune request overriding stored image prune mode", "settings_dangling_only", settingsDangling, "request_dangling_only", danglingOnly)
}
- slog.InfoContext(ctx, "Pruning images...", slog.Bool("dangling_only", danglingOnly))
+ slog.InfoContext(ctx, "Pruning images...", "dangling_only", danglingOnly)
localResult := &system.PruneAllResult{}
if err := s.pruneImages(ctx, danglingOnly, localResult); err != nil {
mu.Lock()
@@ -109,7 +101,7 @@ func (s *SystemService) PruneAll(ctx context.Context, req system.PruneAllRequest
slog.InfoContext(ctx, "Pruning build cache...")
localResult := &system.PruneAllResult{}
if err := s.pruneBuildCache(ctx, localResult, !req.Dangling); err != nil {
- slog.WarnContext(ctx, "Build cache pruning encountered an error", slog.String("error", err.Error()))
+ slog.WarnContext(ctx, "Build cache pruning encountered an error", "error", err.Error())
// Build cache errors are often non-critical, but we log them
} else {
mu.Lock()
@@ -161,14 +153,7 @@ func (s *SystemService) PruneAll(ctx context.Context, req system.PruneAllRequest
slog.ErrorContext(ctx, "Prune operations failed", "error", err)
}
- slog.InfoContext(ctx, "Selective prune operation completed",
- slog.Bool("success", result.Success),
- slog.Int("containers_pruned", len(result.ContainersPruned)),
- slog.Int("images_deleted", len(result.ImagesDeleted)),
- slog.Int("volumes_deleted", len(result.VolumesDeleted)),
- slog.Int("networks_deleted", len(result.NetworksDeleted)),
- slog.Uint64("space_reclaimed", result.SpaceReclaimed),
- slog.Int("error_count", len(result.Errors)))
+ slog.InfoContext(ctx, "Selective prune operation completed", "success", result.Success, "containers_pruned", len(result.ContainersPruned), "images_deleted", len(result.ImagesDeleted), "volumes_deleted", len(result.VolumesDeleted), "networks_deleted", len(result.NetworksDeleted), "space_reclaimed", result.SpaceReclaimed, "error_count", len(result.Errors))
return result, nil
}
@@ -295,7 +280,7 @@ func (s *SystemService) pruneContainers(ctx context.Context, result *system.Prun
}
func (s *SystemService) pruneImages(ctx context.Context, danglingOnly bool, result *system.PruneAllResult) error {
- slog.DebugContext(ctx, "Starting image pruning", slog.Bool("dangling_only", danglingOnly))
+ slog.DebugContext(ctx, "Starting image pruning", "dangling_only", danglingOnly)
dockerClient, err := s.dockerService.GetClient()
if err != nil {
@@ -317,9 +302,7 @@ func (s *SystemService) pruneImages(ctx context.Context, danglingOnly bool, resu
return fmt.Errorf("failed to prune images: %w", err)
}
- slog.InfoContext(ctx, "Image pruning completed",
- slog.Int("images_deleted", len(report.ImagesDeleted)),
- slog.Uint64("bytes_reclaimed", report.SpaceReclaimed))
+ slog.InfoContext(ctx, "Image pruning completed", "images_deleted", len(report.ImagesDeleted), "bytes_reclaimed", report.SpaceReclaimed)
// Collect IDs to delete from DB
var idsToDelete []string
@@ -334,9 +317,7 @@ func (s *SystemService) pruneImages(ctx context.Context, danglingOnly bool, resu
// Batch delete update records
if len(idsToDelete) > 0 && s.db != nil {
if err := s.db.WithContext(ctx).Where("id IN ?", idsToDelete).Delete(&models.ImageUpdateRecord{}).Error; err != nil {
- slog.WarnContext(ctx, "Failed to delete image update records",
- slog.Int("count", len(idsToDelete)),
- slog.String("error", err.Error()))
+ slog.WarnContext(ctx, "Failed to delete image update records", "count", len(idsToDelete), "error", err.Error())
}
}
@@ -349,7 +330,7 @@ func (s *SystemService) pruneBuildCache(ctx context.Context, result *system.Prun
dockerClient, err := s.dockerService.GetClient()
if err != nil {
result.Errors = append(result.Errors, fmt.Errorf("build cache pruning failed (connection): %w", err).Error())
- slog.ErrorContext(ctx, "Error connecting to Docker for build cache prune", slog.String("error", err.Error()))
+ slog.ErrorContext(ctx, "Error connecting to Docker for build cache prune", "error", err.Error())
return fmt.Errorf("failed to connect to Docker for build cache prune: %w", err)
}
@@ -357,18 +338,15 @@ func (s *SystemService) pruneBuildCache(ctx context.Context, result *system.Prun
All: pruneAllCache,
}
- slog.DebugContext(ctx, "starting build cache pruning", slog.Bool("prune_all", pruneAllCache))
+ slog.DebugContext(ctx, "starting build cache pruning", "prune_all", pruneAllCache)
report, err := dockerClient.BuildCachePrune(ctx, options)
if err != nil {
result.Errors = append(result.Errors, fmt.Errorf("build cache pruning failed: %w", err).Error())
- slog.ErrorContext(ctx, "Error pruning build cache", slog.String("error", err.Error()))
+ slog.ErrorContext(ctx, "Error pruning build cache", "error", err.Error())
return fmt.Errorf("failed to prune build cache: %w", err)
}
- slog.InfoContext(ctx, "build cache pruning completed",
- slog.Int("cache_entries_deleted", len(report.CachesDeleted)),
- slog.Uint64("bytes_reclaimed", report.SpaceReclaimed),
- )
+ slog.InfoContext(ctx, "build cache pruning completed", "cache_entries_deleted", len(report.CachesDeleted), "bytes_reclaimed", report.SpaceReclaimed)
result.SpaceReclaimed += report.SpaceReclaimed
return nil
@@ -385,9 +363,7 @@ func (s *SystemService) pruneVolumes(ctx context.Context, result *system.PruneAl
return err
}
- slog.InfoContext(ctx, "Volume prune completed",
- slog.Int("volumes_deleted", len(report.VolumesDeleted)),
- slog.Uint64("space_reclaimed", report.SpaceReclaimed))
+ slog.InfoContext(ctx, "Volume prune completed", "volumes_deleted", len(report.VolumesDeleted), "space_reclaimed", report.SpaceReclaimed)
result.VolumesDeleted = report.VolumesDeleted
result.SpaceReclaimed += report.SpaceReclaimed
@@ -401,8 +377,7 @@ func (s *SystemService) pruneNetworks(ctx context.Context, result *system.PruneA
return err
}
- slog.InfoContext(ctx, "Network prune completed",
- slog.Int("networks_deleted", len(report.NetworksDeleted)))
+ slog.InfoContext(ctx, "Network prune completed", "networks_deleted", len(report.NetworksDeleted))
result.NetworksDeleted = report.NetworksDeleted
return nil
diff --git a/backend/internal/services/system_upgrade_service.go b/backend/internal/services/system_upgrade_service.go
index 0a856cea9..01028a4b5 100644
--- a/backend/internal/services/system_upgrade_service.go
+++ b/backend/internal/services/system_upgrade_service.go
@@ -101,10 +101,7 @@ func (s *SystemUpgradeService) TriggerUpgradeViaCLI(ctx context.Context, user mo
// Use latest tag for the upgrader CLI container
upgraderImage := "ghcr.io/getarcaneapp/arcane:latest"
- slog.Info("Spawning upgrade CLI command",
- "containerName", containerName,
- "upgraderImage", upgraderImage,
- )
+ slog.Info("Spawning upgrade CLI command", "containerName", containerName, "upgraderImage", upgraderImage)
// Spawn the upgrade command in a detached container
// This will run independently of the current container
@@ -150,10 +147,7 @@ func (s *SystemUpgradeService) TriggerUpgradeViaCLI(ctx context.Context, user mo
return fmt.Errorf("start upgrader container: %w", err)
}
- slog.Info("Upgrade container started",
- "upgraderId", resp.ID[:12],
- "upgraderName", containerName,
- )
+ slog.Info("Upgrade container started", "upgraderId", resp.ID[:12], "upgraderName", containerName)
return nil
}
diff --git a/backend/internal/services/updater_service.go b/backend/internal/services/updater_service.go
index c70a76cce..c160f2eee 100644
--- a/backend/internal/services/updater_service.go
+++ b/backend/internal/services/updater_service.go
@@ -899,11 +899,7 @@ func (s *UpdaterService) restartContainersUsingOldIDs(ctx context.Context, oldID
// Send notification after successful container update
if s.notificationService != nil {
if notifErr := s.notificationService.SendContainerUpdateNotification(ctx, name, newRef, match, s.normalizeRef(newRef)); notifErr != nil {
- slog.WarnContext(ctx, "Failed to send container update notification",
- slog.String("containerId", c.ID),
- slog.String("containerName", name),
- slog.String("imageRef", newRef),
- slog.String("error", notifErr.Error()))
+ slog.WarnContext(ctx, "Failed to send container update notification", "containerId", c.ID, "containerName", name, "imageRef", newRef, "error", notifErr.Error())
}
}
}
diff --git a/backend/internal/services/version_service.go b/backend/internal/services/version_service.go
index 747cd32ac..9a60b29ea 100644
--- a/backend/internal/services/version_service.go
+++ b/backend/internal/services/version_service.go
@@ -407,10 +407,7 @@ func (s *VersionService) checkDigestBasedUpdate(ctx context.Context, currentTag,
// Fetch latest digest from registry
latestDigest, err := s.containerRegistryService.GetImageDigest(ctx, imageRef)
if err != nil {
- slog.WarnContext(ctx, "Failed to fetch latest digest for tag",
- "tag", currentTag,
- "error", err,
- )
+ slog.WarnContext(ctx, "Failed to fetch latest digest for tag", "tag", currentTag, "error", err)
return false, ""
}
@@ -418,11 +415,7 @@ func (s *VersionService) checkDigestBasedUpdate(ctx context.Context, currentTag,
updateAvailable = currentDigest != latestDigest && latestDigest != ""
if updateAvailable {
- slog.InfoContext(ctx, "Digest-based update available",
- "tag", currentTag,
- "currentDigest", currentDigest,
- "latestDigest", latestDigest,
- )
+ slog.InfoContext(ctx, "Digest-based update available", "tag", currentTag, "currentDigest", currentDigest, "latestDigest", latestDigest)
}
return updateAvailable, latestDigest
diff --git a/backend/internal/services/volume_service.go b/backend/internal/services/volume_service.go
index b597ee04f..240ac9ac2 100644
--- a/backend/internal/services/volume_service.go
+++ b/backend/internal/services/volume_service.go
@@ -47,26 +47,19 @@ func (s *VolumeService) GetVolumeByName(ctx context.Context, name string) (*volu
for _, uv := range usageVolumes {
if uv.Name == vol.Name && uv.UsageData != nil {
vol.UsageData = uv.UsageData
- slog.DebugContext(ctx, "attached volume usage data",
- slog.String("volume", vol.Name),
- slog.Int64("size_bytes", uv.UsageData.Size),
- slog.Int64("ref_count", uv.UsageData.RefCount))
+ slog.DebugContext(ctx, "attached volume usage data", "volume", vol.Name, "size_bytes", uv.UsageData.Size, "ref_count", uv.UsageData.RefCount)
break
}
}
} else {
- slog.WarnContext(ctx, "failed to load volume usage data",
- slog.String("volume", vol.Name),
- slog.String("error", duErr.Error()))
+ slog.WarnContext(ctx, "failed to load volume usage data", "volume", vol.Name, "error", duErr.Error())
}
v := volumetypes.NewSummary(vol)
containerIDs, err := docker.GetContainersUsingVolume(ctx, dockerClient, name)
if err != nil {
- slog.WarnContext(ctx, "failed to get containers using volume",
- slog.String("volume", name),
- slog.String("error", err.Error()))
+ slog.WarnContext(ctx, "failed to get containers using volume", "volume", name, "error", err.Error())
} else {
v.Containers = containerIDs
if len(containerIDs) > 0 {
@@ -102,9 +95,7 @@ func (s *VolumeService) CreateVolume(ctx context.Context, options volume.CreateO
"name": vol.Name,
}
if logErr := s.eventService.LogVolumeEvent(ctx, models.EventTypeVolumeCreate, vol.Name, vol.Name, user.ID, user.Username, "0", metadata); logErr != nil {
- slog.WarnContext(ctx, "could not log volume creation action",
- slog.String("volume", vol.Name),
- slog.String("error", logErr.Error()))
+ slog.WarnContext(ctx, "could not log volume creation action", "volume", vol.Name, "error", logErr.Error())
}
docker.InvalidateVolumeUsageCache()
@@ -130,9 +121,7 @@ func (s *VolumeService) DeleteVolume(ctx context.Context, name string, force boo
"name": name,
}
if logErr := s.eventService.LogVolumeEvent(ctx, models.EventTypeVolumeDelete, name, name, user.ID, user.Username, "0", metadata); logErr != nil {
- slog.WarnContext(ctx, "could not log volume deletion action",
- slog.String("volume", name),
- slog.String("error", logErr.Error()))
+ slog.WarnContext(ctx, "could not log volume deletion action", "volume", name, "error", logErr.Error())
}
return nil
@@ -174,8 +163,7 @@ func (s *VolumeService) PruneVolumesWithOptions(ctx context.Context, all bool) (
"spaceReclaimed": report.SpaceReclaimed,
}
if logErr := s.eventService.LogVolumeEvent(ctx, models.EventTypeVolumeDelete, "", "bulk_prune", systemUser.ID, systemUser.Username, "0", metadata); logErr != nil {
- slog.WarnContext(ctx, "could not log volume prune action",
- slog.String("error", logErr.Error()))
+ slog.WarnContext(ctx, "could not log volume prune action", "error", logErr.Error())
}
docker.InvalidateVolumeUsageCache()
@@ -434,8 +422,7 @@ func (s *VolumeService) ListVolumesPaginated(ctx context.Context, params paginat
containerResult := <-containerChan
volumeContainerMap := containerResult.containerMap
if containerResult.err != nil {
- slog.WarnContext(ctx, "failed to build volume-container map",
- slog.String("error", containerResult.err.Error()))
+ slog.WarnContext(ctx, "failed to build volume-container map", "error", containerResult.err.Error())
volumeContainerMap = make(map[string][]string)
}
diff --git a/backend/internal/utils/docker/volume_utils.go b/backend/internal/utils/docker/volume_utils.go
index 20d126c7d..b537cf025 100644
--- a/backend/internal/utils/docker/volume_utils.go
+++ b/backend/internal/utils/docker/volume_utils.go
@@ -26,7 +26,7 @@ func GetVolumeUsageData(ctx context.Context, dockerClient *client.Client) ([]vol
if time.Since(volumeUsageCacheTime) < volumeUsageCacheTTL && volumeUsageCache != nil {
cached := volumeUsageCache
volumeUsageCacheMutex.RUnlock()
- slog.DebugContext(ctx, "returning cached volume usage data", slog.Int("volume_count", len(cached)))
+ slog.DebugContext(ctx, "returning cached volume usage data", "volume_count", len(cached))
return cached, nil
}
volumeUsageCacheMutex.RUnlock()
@@ -35,7 +35,7 @@ func GetVolumeUsageData(ctx context.Context, dockerClient *client.Client) ([]vol
defer volumeUsageCacheMutex.Unlock()
if time.Since(volumeUsageCacheTime) < volumeUsageCacheTTL && volumeUsageCache != nil {
- slog.DebugContext(ctx, "returning cached volume usage data after lock", slog.Int("volume_count", len(volumeUsageCache)))
+ slog.DebugContext(ctx, "returning cached volume usage data after lock", "volume_count", len(volumeUsageCache))
return volumeUsageCache, nil
}
diskUsage, err := dockerClient.DiskUsage(ctx, types.DiskUsageOptions{
@@ -45,7 +45,7 @@ func GetVolumeUsageData(ctx context.Context, dockerClient *client.Client) ([]vol
return nil, fmt.Errorf("failed to get disk usage: %w", err)
}
- slog.DebugContext(ctx, "disk usage returned volumes", slog.Int("volume_count", len(diskUsage.Volumes)))
+ slog.DebugContext(ctx, "disk usage returned volumes", "volume_count", len(diskUsage.Volumes))
if diskUsage.Volumes == nil {
return []volume.Volume{}, nil
@@ -60,7 +60,7 @@ func GetVolumeUsageData(ctx context.Context, dockerClient *client.Client) ([]vol
volumeUsageCache = volumes
volumeUsageCacheTime = time.Now()
- slog.DebugContext(ctx, "refreshed volume usage cache", slog.Int("volume_count", len(volumes)))
+ slog.DebugContext(ctx, "refreshed volume usage cache", "volume_count", len(volumes))
return volumes, nil
}
@@ -88,9 +88,7 @@ func GetContainersUsingVolume(ctx context.Context, dockerClient *client.Client,
}
}
- slog.DebugContext(ctx, "found containers using volume",
- slog.String("volume", volumeName),
- slog.Int("container_count", len(containerIDs)))
+ slog.DebugContext(ctx, "found containers using volume", "volume", volumeName, "container_count", len(containerIDs))
return containerIDs, nil
}
diff --git a/backend/internal/utils/registry/digest.go b/backend/internal/utils/registry/digest.go
index 22bddc22f..b6d89dcd2 100644
--- a/backend/internal/utils/registry/digest.go
+++ b/backend/internal/utils/registry/digest.go
@@ -78,9 +78,7 @@ func (c *Client) GetLatestDigest(ctx context.Context, registry, repository, tag,
// If HEAD isn't supported by the registry, fall back to GET and try again.
if resp.StatusCode == http.StatusMethodNotAllowed || resp.StatusCode == http.StatusNotFound || resp.StatusCode == http.StatusForbidden {
- slog.DebugContext(ctx, "HEAD not supported or returned unexpected status, retrying with GET",
- slog.String("url", url),
- slog.Int("status", resp.StatusCode))
+ slog.DebugContext(ctx, "HEAD not supported or returned unexpected status, retrying with GET", "url", url, "status", resp.StatusCode)
// create GET request
getReq, rerr := http.NewRequestWithContext(ctx, http.MethodGet, url, nil)
if rerr != nil {
@@ -96,16 +94,12 @@ func (c *Client) GetLatestDigest(ctx context.Context, registry, repository, tag,
}
elapsed := time.Since(start)
- slog.DebugContext(ctx, "manifest request completed",
- slog.String("url", url),
- slog.Int("status", resp.StatusCode),
- slog.Duration("elapsed", elapsed))
+ slog.DebugContext(ctx, "manifest request completed", "url", url, "status", resp.StatusCode, "elapsed", elapsed)
if resp.StatusCode == http.StatusUnauthorized {
h := getHeaderCI(resp.Header, "WWW-Authenticate")
if h != "" {
- slog.DebugContext(ctx, "manifest request unauthorized",
- slog.String("www-authenticate", h))
+ slog.DebugContext(ctx, "manifest request unauthorized", "www-authenticate", h)
return "", fmt.Errorf("unauthorized: %s", h)
}
return "", fmt.Errorf("manifest request failed with status: 401")
@@ -115,8 +109,7 @@ func (c *Client) GetLatestDigest(ctx context.Context, registry, repository, tag,
if www == "" {
www = "not present"
}
- slog.DebugContext(ctx, "manifest request unexpected status",
- slog.String("www-authenticate", www))
+ slog.DebugContext(ctx, "manifest request unexpected status", "www-authenticate", www)
return "", fmt.Errorf("manifest request failed with status: %d, auth: %q", resp.StatusCode, www)
}
@@ -125,12 +118,7 @@ func (c *Client) GetLatestDigest(ctx context.Context, registry, repository, tag,
return "", fmt.Errorf("no digest header found in response")
}
- slog.DebugContext(ctx, "resolved remote digest",
- slog.String("registry", registry),
- slog.String("repository", repository),
- slog.String("tag", tag),
- slog.String("digest", d),
- slog.Duration("elapsed", elapsed))
+ slog.DebugContext(ctx, "resolved remote digest", "registry", registry, "repository", repository, "tag", tag, "digest", d, "elapsed", elapsed)
return d, nil
}
diff --git a/frontend/src/lib/components/arcane-button/variants.ts b/frontend/src/lib/components/arcane-button/variants.ts
index 0cdc418ed..623acf3c0 100644
--- a/frontend/src/lib/components/arcane-button/variants.ts
+++ b/frontend/src/lib/components/arcane-button/variants.ts
@@ -27,7 +27,7 @@ export const arcaneButtonVariants = tv({
'inline-flex items-center justify-center gap-2 rounded-lg text-sm font-medium whitespace-nowrap select-none ' +
'transition-all duration-200 will-change-transform ' +
'active:scale-[0.98] ' +
- 'border disabled:pointer-events-none disabled:opacity-50 ' +
+ 'border disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 ' +
'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:ring-offset-0 ' +
"[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
variants: {
diff --git a/frontend/src/lib/components/arcane-tooltip/arcane-tooltip-trigger.svelte b/frontend/src/lib/components/arcane-tooltip/arcane-tooltip-trigger.svelte
index 7352947c3..e1ae9cf8f 100644
--- a/frontend/src/lib/components/arcane-tooltip/arcane-tooltip-trigger.svelte
+++ b/frontend/src/lib/components/arcane-tooltip/arcane-tooltip-trigger.svelte
@@ -69,38 +69,81 @@
event.stopPropagation();
}
}
+
+ function handleWrapperClick(event: MouseEvent, props: any) {
+ if (ctx.interactive) {
+ handleClick(event);
+ if (!event.defaultPrevented) {
+ props.onclick?.(event);
+ }
+ } else {
+ // Check if the click originated from an interactive element
+ let target = event.target as HTMLElement | null;
+ let isInteractive = false;
+
+ while (target && target !== event.currentTarget) {
+ const tag = target.tagName.toLowerCase();
+ if (
+ ['button', 'input', 'select', 'textarea', 'a'].includes(tag) ||
+ target.getAttribute('role') === 'button' ||
+ target.getAttribute('tabindex') === '0'
+ ) {
+ // Check if it's disabled
+ if (
+ (target as HTMLButtonElement).disabled ||
+ target.getAttribute('aria-disabled') === 'true' ||
+ target.classList.contains('disabled')
+ ) {
+ // If disabled, we treat it as non-interactive for the purpose of tooltip
+ // (i.e., we WANT the tooltip to show)
+ isInteractive = false;
+ } else {
+ isInteractive = true;
+ }
+ break;
+ }
+ target = target.parentElement;
+ }
+
+ if (!isInteractive) {
+ props.onclick?.(event);
+ }
+ }
+ }
</script>
{#if ctx.isTouch}
<Popover.Trigger>
{#snippet child({ props }: ChildProps)}
- <span
+ <div
{...props}
- class={cn('inline-flex max-w-full min-w-0', className)}
+ class={cn('pointer-events-auto inline-flex max-w-full min-w-0 cursor-pointer', className)}
ontouchstart={ctx.interactive ? handleTouchStart : undefined}
ontouchend={ctx.interactive ? handleTouchEnd : undefined}
ontouchcancel={ctx.interactive ? handleTouchCancel : undefined}
ontouchmove={ctx.interactive ? handleTouchMove : undefined}
- onclick={ctx.interactive ? handleClick : undefined}
+ onclick={(e) => handleWrapperClick(e, props)}
role="button"
tabindex="0"
>
{#if child}
- {@render child({ props: {} })}
+ {@render child({ props })}
{:else}
{@render children?.()}
{/if}
- </span>
+ </div>
{/snippet}
</Popover.Trigger>
{:else}
- <Tooltip.Trigger class={className}>
- {#if child}
- {#snippet child({ props }: ChildProps)}
- {@render child({ props })}
- {/snippet}
- {:else}
- {@render children?.()}
- {/if}
+ <Tooltip.Trigger>
+ {#snippet child({ props }: ChildProps)}
+ <div {...props} role="button" tabindex="0" class={cn('inline-flex max-w-full min-w-0', className)}>
+ {#if child}
+ {@render child({ props })}
+ {:else}
+ {@render children?.()}
+ {/if}
+ </div>
+ {/snippet}
</Tooltip.Trigger>
{/if}
diff --git a/frontend/src/lib/components/ui/checkbox/checkbox.svelte b/frontend/src/lib/components/ui/checkbox/checkbox.svelte
index bebacc70f..0a9d07b37 100644
--- a/frontend/src/lib/components/ui/checkbox/checkbox.svelte
+++ b/frontend/src/lib/components/ui/checkbox/checkbox.svelte
@@ -16,7 +16,7 @@
bind:ref
data-slot="checkbox"
class={cn(
- 'border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive peer flex size-4 shrink-0 items-center justify-center rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50',
+ 'border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive peer flex size-4 shrink-0 items-center justify-center rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50',
className
)}
bind:checked
diff --git a/frontend/src/lib/components/ui/input/input.svelte b/frontend/src/lib/components/ui/input/input.svelte
index d2ae89ba1..8694c19fa 100644
--- a/frontend/src/lib/components/ui/input/input.svelte
+++ b/frontend/src/lib/components/ui/input/input.svelte
@@ -16,7 +16,7 @@
bind:this={ref}
data-slot="input"
class={cn(
- 'bg-input/80 ring-offset-background placeholder:text-muted-foreground focus-visible:ring-ring focus-visible:bg-input/90 flex h-10 w-full rounded-lg border px-3 py-2 text-base backdrop-blur-sm transition-all file:border-0 file:bg-transparent file:text-sm file:font-medium focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:backdrop-blur-md focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm',
+ 'bg-input/80 ring-offset-background placeholder:text-muted-foreground focus-visible:ring-ring focus-visible:bg-input/90 flex h-10 w-full rounded-lg border px-3 py-2 text-base backdrop-blur-sm transition-all file:border-0 file:bg-transparent file:text-sm file:font-medium focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:backdrop-blur-md focus-visible:outline-none disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm',
className
)}
type="file"
@@ -29,7 +29,7 @@
bind:this={ref}
data-slot="input"
class={cn(
- 'bg-input/80 selection:bg-primary selection:text-primary-foreground ring-offset-background placeholder:text-muted-foreground flex h-9 w-full min-w-0 rounded-lg px-3 py-1 text-base backdrop-blur-sm transition-all outline-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm',
+ 'bg-input/80 selection:bg-primary selection:text-primary-foreground ring-offset-background placeholder:text-muted-foreground flex h-9 w-full min-w-0 rounded-lg px-3 py-1 text-base backdrop-blur-sm transition-all outline-none disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm',
'focus-visible:bg-input/90 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] focus-visible:backdrop-blur-md',
'aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive',
className
diff --git a/frontend/src/lib/components/ui/select/select-trigger.svelte b/frontend/src/lib/components/ui/select/select-trigger.svelte
index 063bfbf91..83fc38ba4 100644
--- a/frontend/src/lib/components/ui/select/select-trigger.svelte
+++ b/frontend/src/lib/components/ui/select/select-trigger.svelte
@@ -19,7 +19,7 @@
data-slot="select-trigger"
data-size={size}
class={cn(
- "border-input data-placeholder:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none select-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
+ "border-input data-placeholder:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none select-none focus-visible:ring-[3px] disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
className
)}
{...restProps}
diff --git a/frontend/src/lib/components/ui/switch/switch.svelte b/frontend/src/lib/components/ui/switch/switch.svelte
index 5681d5fb7..d8c5cf8b3 100644
--- a/frontend/src/lib/components/ui/switch/switch.svelte
+++ b/frontend/src/lib/components/ui/switch/switch.svelte
@@ -14,7 +14,7 @@
bind:ref
bind:checked
class={cn(
- 'focus-visible:ring-ring focus-visible:ring-offset-background data-[state=checked]:bg-primary data-[state=unchecked]:bg-input peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50',
+ 'focus-visible:ring-ring focus-visible:ring-offset-background data-[state=checked]:bg-primary data-[state=unchecked]:bg-input peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50',
className
)}
{...restProps}
diff --git a/frontend/src/lib/components/ui/textarea/textarea.svelte b/frontend/src/lib/components/ui/textarea/textarea.svelte
index 0a2e1177b..10d6efa3d 100644
--- a/frontend/src/lib/components/ui/textarea/textarea.svelte
+++ b/frontend/src/lib/components/ui/textarea/textarea.svelte
@@ -15,7 +15,7 @@
bind:this={ref}
data-slot="textarea"
class={cn(
- 'bg-input/80 ring-offset-background placeholder:text-muted-foreground focus-visible:ring-ring focus-visible:bg-input/90 flex min-h-[80px] w-full rounded-lg px-3 py-2 text-base backdrop-blur-sm transition-all focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:backdrop-blur-md focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm',
+ 'bg-input/80 ring-offset-background placeholder:text-muted-foreground focus-visible:ring-ring focus-visible:bg-input/90 flex min-h-[80px] w-full rounded-lg px-3 py-2 text-base backdrop-blur-sm transition-all focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:backdrop-blur-md focus-visible:outline-none disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm',
className
)}
bind:value
diff --git a/frontend/src/lib/config/navigation-config.ts b/frontend/src/lib/config/navigation-config.ts
index de1863ed8..e537e4d13 100644
--- a/frontend/src/lib/config/navigation-config.ts
+++ b/frontend/src/lib/config/navigation-config.ts
@@ -52,7 +52,6 @@ export const navigationItems: Record<string, NavigationItem[]> = {
items: [
{ title: m.general_title(), url: '/settings/general', icon: SettingsIcon },
{ title: m.appearance_title(), url: '/settings/appearance', icon: ApperanceIcon },
- { title: m.docker_title(), url: '/settings/docker', icon: DockerBrandIcon },
{ title: m.security_title(), url: '/settings/security', icon: SecurityIcon },
{ title: m.users_title(), url: '/settings/users', icon: UsersIcon },
{ title: m.notifications_title(), url: '/settings/notifications', icon: NotificationsIcon },
diff --git a/frontend/src/lib/services/settings-service.ts b/frontend/src/lib/services/settings-service.ts
index e423a853e..7c4422865 100644
--- a/frontend/src/lib/services/settings-service.ts
+++ b/frontend/src/lib/services/settings-service.ts
@@ -52,6 +52,10 @@ export default class SettingsService extends BaseAPIService {
await environmentStore.ready;
const envId = await environmentStore.getCurrentEnvironmentId();
+ return this.updateSettingsForEnvironment(envId, settings);
+ }
+
+ async updateSettingsForEnvironment(envId: string, settings: Partial<Settings>) {
const uiSettings: Record<string, any> = {};
const envSettings: Record<string, any> = {};
@@ -74,7 +78,7 @@ export default class SettingsService extends BaseAPIService {
await this.api.put('/environments/0/settings', payload);
}
- // Update environment settings on current environment
+ // Update environment settings on target environment
if (Object.keys(envSettings).length > 0) {
const payload: Record<string, string> = {};
for (const key in envSettings) {
diff --git a/frontend/src/routes/(app)/environments/[id]/+page.svelte b/frontend/src/routes/(app)/environments/[id]/+page.svelte
index 263f89d3b..d37294243 100644
--- a/frontend/src/routes/(app)/environments/[id]/+page.svelte
+++ b/frontend/src/routes/(app)/environments/[id]/+page.svelte
@@ -1,5 +1,7 @@
<script lang="ts">
import * as Card from '$lib/components/ui/card/index.js';
+ import * as Tabs from '$lib/components/ui/tabs/index.js';
+ import { TabBar, type TabItem } from '$lib/components/tab-bar';
import { ArcaneButton } from '$lib/components/arcane-button/index.js';
import * as AlertDialog from '$lib/components/ui/alert-dialog';
import * as ArcaneTooltip from '$lib/components/arcane-tooltip';
@@ -12,15 +14,15 @@
import { Badge } from '$lib/components/ui/badge/index.js';
import { m } from '$lib/paraglide/messages';
import { environmentManagementService } from '$lib/services/env-mgmt-service.js';
+ import { settingsService } from '$lib/services/settings-service';
import { environmentStore } from '$lib/stores/environment.store.svelte';
import { Spinner } from '$lib/components/ui/spinner/index.js';
import { CopyButton } from '$lib/components/ui/copy-button';
import type { AppVersionInformation } from '$lib/types/application-configuration';
+ import SelectWithLabel from '$lib/components/form/select-with-label.svelte';
+ import TextInputWithLabel from '$lib/components/form/text-input-with-label.svelte';
import {
ArrowLeftIcon,
- RefreshIcon,
- ConnectionIcon,
- SaveIcon,
EnvironmentsIcon,
AlertIcon,
TestIcon,
@@ -28,16 +30,29 @@
ResetIcon,
ApiKeyIcon,
DockerBrandIcon,
- InfoIcon
+ SettingsIcon
} from '$lib/icons';
let { data } = $props();
let { environment, settings, versionInformation } = $derived(data);
- let showSwitchDialog = $state(false);
-
let currentEnvironment = $derived(environmentStore.selected);
+ let activeTab = $state('general');
+
+ const tabItems: TabItem[] = [
+ {
+ value: 'general',
+ label: m.general_title(),
+ icon: SettingsIcon
+ },
+ {
+ value: 'docker',
+ label: m.environments_docker_settings_title(),
+ icon: DockerBrandIcon
+ }
+ ];
+
let isRefreshing = $state(false);
let isTestingConnection = $state(false);
let isSaving = $state(false);
@@ -55,6 +70,56 @@
let formEnabled = $state(false);
let formApiUrl = $state('');
+ // Settings form state
+ let formPollingEnabled = $state(false);
+ let formPollingInterval = $state(60);
+ let formAutoUpdate = $state(false);
+ let formAutoUpdateInterval = $state(1440);
+ let formPruneMode = $state<'all' | 'dangling'>('dangling');
+ let formDefaultShell = $state('/bin/sh');
+ let formProjectsDirectory = $state('data/projects');
+ let formDiskUsagePath = $state('data/projects');
+ let formMaxImageUploadSize = $state(500);
+ let formBaseServerUrl = $state('http://localhost');
+
+ type PollingIntervalMode = 'hourly' | 'daily' | 'weekly' | 'custom';
+
+ const imagePollingOptions: Array<{
+ value: PollingIntervalMode;
+ label: string;
+ description: string;
+ minutes?: number;
+ }> = [
+ { value: 'hourly', minutes: 60, label: m.hourly(), description: m.polling_hourly_description() },
+ { value: 'daily', minutes: 1440, label: m.daily(), description: m.polling_daily_description() },
+ { value: 'weekly', minutes: 10080, label: m.weekly(), description: m.polling_weekly_description() },
+ { value: 'custom', label: m.custom(), description: m.use_custom_polling_value() }
+ ];
+
+ const presetToMinutes = Object.fromEntries(
+ imagePollingOptions.filter((o) => o.value !== 'custom').map((o) => [o.value, o.minutes!])
+ ) as Record<Exclude<PollingIntervalMode, 'custom'>, number>;
+
+ let pollingIntervalMode = $state<PollingIntervalMode>('custom');
+
+ const pruneModeOptions = [
+ { value: 'all', label: m.docker_prune_all(), description: m.docker_prune_all_description() },
+ { value: 'dangling', label: m.docker_prune_dangling(), description: m.docker_prune_dangling_description() }
+ ];
+
+ let pruneModeDescription = $derived(
+ pruneModeOptions.find((o) => o.value === formPruneMode)?.description ?? m.docker_prune_mode_description()
+ );
+
+ const shellOptions = [
+ { value: '/bin/sh', label: '/bin/sh', description: m.docker_shell_sh_description() },
+ { value: '/bin/bash', label: '/bin/bash', description: m.docker_shell_bash_description() },
+ { value: '/bin/ash', label: '/bin/ash', description: m.docker_shell_ash_description() },
+ { value: '/bin/zsh', label: '/bin/zsh', description: m.docker_shell_zsh_description() }
+ ];
+
+ let shellSelectValue = $state<string>('custom');
+
// Track current status separately from environment data
let currentStatus = $state<'online' | 'offline' | 'error' | 'pending'>('offline');
@@ -64,6 +129,37 @@
formEnabled = environment.enabled;
formApiUrl = environment.apiUrl;
currentStatus = environment.status;
+
+ if (settings) {
+ formPollingEnabled = settings.pollingEnabled;
+ formPollingInterval = settings.pollingInterval;
+ formAutoUpdate = settings.autoUpdate;
+ formAutoUpdateInterval = settings.autoUpdateInterval;
+ formPruneMode = settings.dockerPruneMode || 'dangling';
+ formDefaultShell = settings.defaultShell || '/bin/sh';
+ formProjectsDirectory = settings.projectsDirectory || 'data/projects';
+ formDiskUsagePath = settings.diskUsagePath || 'data/projects';
+ formMaxImageUploadSize = settings.maxImageUploadSize || 500;
+ formBaseServerUrl = settings.baseServerUrl || 'http://localhost';
+
+ // Initialize derived states
+ pollingIntervalMode = imagePollingOptions.find((o) => o.minutes === settings.pollingInterval)?.value ?? 'custom';
+ shellSelectValue = shellOptions.find((o) => o.value === settings.defaultShell)?.value ?? 'custom';
+ }
+ });
+
+ // Sync polling mode select with form value
+ $effect(() => {
+ if (pollingIntervalMode !== 'custom') {
+ formPollingInterval = presetToMinutes[pollingIntervalMode];
+ }
+ });
+
+ // Sync shell select with form value
+ $effect(() => {
+ if (shellSelectValue !== 'custom') {
+ formDefaultShell = shellSelectValue;
+ }
});
// Fetch version when environment is online
@@ -88,7 +184,18 @@
let hasChanges = $derived(
formName !== environment.name ||
formEnabled !== environment.enabled ||
- (environment.id !== '0' && formApiUrl !== environment.apiUrl)
+ (environment.id !== '0' && formApiUrl !== environment.apiUrl) ||
+ (settings &&
+ (formPollingEnabled !== settings.pollingEnabled ||
+ formPollingInterval !== settings.pollingInterval ||
+ formAutoUpdate !== settings.autoUpdate ||
+ formAutoUpdateInterval !== settings.autoUpdateInterval ||
+ formPruneMode !== (settings.dockerPruneMode || 'dangling') ||
+ formDefaultShell !== (settings.defaultShell || '/bin/sh') ||
+ formProjectsDirectory !== (settings.projectsDirectory || 'data/projects') ||
+ formDiskUsagePath !== (settings.diskUsagePath || 'data/projects') ||
+ formMaxImageUploadSize !== (settings.maxImageUploadSize || 500) ||
+ formBaseServerUrl !== (settings.baseServerUrl || 'http://localhost')))
);
async function refreshEnvironment() {
@@ -101,6 +208,20 @@
formEnabled = environment.enabled;
formApiUrl = environment.apiUrl;
currentStatus = environment.status;
+
+ if (settings) {
+ formPollingEnabled = settings.pollingEnabled;
+ formPollingInterval = settings.pollingInterval;
+ formAutoUpdate = settings.autoUpdate;
+ formAutoUpdateInterval = settings.autoUpdateInterval;
+ formPruneMode = settings.dockerPruneMode || 'dangling';
+ formDefaultShell = settings.defaultShell || '/bin/sh';
+
+ // Initialize derived states
+ pollingIntervalMode = imagePollingOptions.find((o) => o.minutes === settings.pollingInterval)?.value ?? 'custom';
+ shellSelectValue = shellOptions.find((o) => o.value === settings.defaultShell)?.value ?? 'custom';
+ }
+
// Reset version to trigger re-fetch if online
remoteVersion = null;
} catch (err) {
@@ -161,12 +282,29 @@
try {
isSaving = true;
+ // Update environment basic info
await environmentManagementService.update(environment.id, {
name: formName,
enabled: formEnabled,
apiUrl: formApiUrl
});
+ // Update environment settings if they exist
+ if (settings) {
+ await settingsService.updateSettingsForEnvironment(environment.id, {
+ pollingEnabled: formPollingEnabled,
+ pollingInterval: formPollingInterval,
+ autoUpdate: formAutoUpdate,
+ autoUpdateInterval: formAutoUpdateInterval,
+ dockerPruneMode: formPruneMode,
+ defaultShell: formDefaultShell,
+ projectsDirectory: formProjectsDirectory,
+ diskUsagePath: formDiskUsagePath,
+ maxImageUploadSize: formMaxImageUploadSize,
+ baseServerUrl: formBaseServerUrl
+ });
+ }
+
toast.success(m.common_update_success({ resource: m.resource_environment_cap() }));
await refreshEnvironment();
@@ -192,6 +330,24 @@
formName = environment.name;
formEnabled = environment.enabled;
formApiUrl = environment.apiUrl;
+
+ if (settings) {
+ formPollingEnabled = settings.pollingEnabled;
+ formPollingInterval = settings.pollingInterval;
+ formAutoUpdate = settings.autoUpdate;
+ formAutoUpdateInterval = settings.autoUpdateInterval;
+ formPruneMode = settings.dockerPruneMode || 'dangling';
+ formDefaultShell = settings.defaultShell || '/bin/sh';
+ formProjectsDirectory = settings.projectsDirectory || 'data/projects';
+ formDiskUsagePath = settings.diskUsagePath || 'data/projects';
+ formMaxImageUploadSize = settings.maxImageUploadSize || 500;
+ formBaseServerUrl = settings.baseServerUrl || 'http://localhost';
+
+ // Initialize derived states
+ pollingIntervalMode = imagePollingOptions.find((o) => o.minutes === settings.pollingInterval)?.value ?? 'custom';
+ shellSelectValue = shellOptions.find((o) => o.value === settings.defaultShell)?.value ?? 'custom';
+ }
+
toast.info(m.environments_changes_reset());
}
@@ -219,17 +375,6 @@
showRegenerateDialog = false;
}
}
-
- async function confirmSwitchAndEdit() {
- try {
- await environmentStore.setEnvironment(environment);
- showSwitchDialog = false;
- goto('/settings');
- } catch (error) {
- console.error('Failed to switch environment:', error);
- toast.error(m.common_action_failed());
- }
- }
</script>
<div class="container mx-auto max-w-full space-y-6 overflow-hidden p-2 sm:p-6">
@@ -352,6 +497,50 @@
/>
</div>
+ <div>
+ <Label for="api-url" class="text-sm font-medium">{m.environments_api_url()}</Label>
+ <div class="mt-1.5 flex items-center gap-2">
+ {#if environment.id === '0'}
+ <ArcaneTooltip.Root>
+ <ArcaneTooltip.Trigger class="w-full">
+ <Input
+ id="api-url"
+ type="url"
+ bind:value={formApiUrl}
+ class="w-full font-mono"
+ placeholder={m.environments_api_url_placeholder()}
+ disabled={true}
+ required
+ />
+ </ArcaneTooltip.Trigger>
+ <ArcaneTooltip.Content>
+ <p>{m.environments_local_setting_disabled()}</p>
+ </ArcaneTooltip.Content>
+ </ArcaneTooltip.Root>
+ {:else}
+ <Input
+ id="api-url"
+ type="url"
+ bind:value={formApiUrl}
+ class="w-full font-mono"
+ placeholder={m.environments_api_url_placeholder()}
+ required
+ />
+ {/if}
+ <ArcaneButton
+ action="base"
+ onclick={testConnection}
+ disabled={isTestingConnection}
+ loading={isTestingConnection}
+ icon={TestIcon}
+ customLabel={m.environments_test_connection()}
+ loadingLabel={m.environments_testing_connection()}
+ class="shrink-0"
+ />
+ </div>
+ <p class="text-muted-foreground mt-1.5 text-xs">{m.environments_api_url_help()}</p>
+ </div>
+
<div class="flex items-center justify-between rounded-lg border p-4">
<div class="space-y-0.5">
<Label for="env-enabled" class="text-sm font-medium">{m.common_enabled()}</Label>
@@ -428,114 +617,181 @@
{#if settings}
<Card.Root class="flex flex-col">
- <Card.Header icon={DockerBrandIcon}>
+ <Card.Header icon={SettingsIcon}>
<div class="flex flex-col space-y-1.5">
<Card.Title>
- <h2>{m.environments_docker_settings_title()}</h2>
+ <h2>{m.settings_title()}</h2>
</Card.Title>
<Card.Description>{m.environments_config_description()}</Card.Description>
</div>
</Card.Header>
- <Card.Content class="space-y-4 p-4">
- <div class="grid grid-cols-2 gap-4">
- <div>
- <Label class="text-muted-foreground text-xs font-medium">{m.docker_enable_polling_label()}</Label>
- <div class="mt-1">
- <StatusBadge
- text={settings.pollingEnabled ? m.common_enabled() : m.common_disabled()}
- variant={settings.pollingEnabled ? 'green' : 'gray'}
- />
+ <Card.Content class="p-0">
+ <Tabs.Root bind:value={activeTab} class="w-full">
+ <div class="border-b px-4 py-2">
+ <div class="w-fit">
+ <TabBar items={tabItems} value={activeTab} onValueChange={(value) => (activeTab = value)} />
</div>
</div>
- {#if settings.pollingEnabled}
- <div>
- <Label class="text-muted-foreground text-xs font-medium">{m.docker_polling_interval_label()}</Label>
- <div class="mt-1 text-sm">{settings.pollingInterval} min</div>
- </div>
- {/if}
- <div>
- <Label class="text-muted-foreground text-xs font-medium">{m.docker_auto_update_label()}</Label>
- <div class="mt-1">
- <StatusBadge
- text={settings.autoUpdate ? m.common_enabled() : m.common_disabled()}
- variant={settings.autoUpdate ? 'green' : 'gray'}
- />
+ <Tabs.Content value="general" class="space-y-6 p-4">
+ <div class="grid gap-6 sm:grid-cols-2">
+ <div class="space-y-2">
+ <TextInputWithLabel
+ id="projects-directory"
+ label={m.general_projects_directory_label()}
+ bind:value={formProjectsDirectory}
+ helpText={m.general_projects_directory_help()}
+ />
+ </div>
+ <div class="space-y-2">
+ <TextInputWithLabel
+ id="disk-usage-path"
+ label={m.disk_usage_settings()}
+ bind:value={formDiskUsagePath}
+ helpText={m.disk_usage_settings_description()}
+ />
+ </div>
+ <div class="space-y-2">
+ <TextInputWithLabel
+ id="base-server-url"
+ label={m.general_base_url_label()}
+ bind:value={formBaseServerUrl}
+ helpText={m.general_base_url_help()}
+ />
+ </div>
+ <div class="space-y-2">
+ <TextInputWithLabel
+ id="max-upload-size"
+ type="number"
+ label={m.docker_max_upload_size_label()}
+ bind:value={formMaxImageUploadSize}
+ helpText={m.docker_max_upload_size_description()}
+ />
+ </div>
</div>
- </div>
- {#if settings.autoUpdate}
- <div>
- <Label class="text-muted-foreground text-xs font-medium">{m.docker_auto_update_interval_label()}</Label>
- <div class="mt-1 text-sm">{settings.autoUpdateInterval} min</div>
+ </Tabs.Content>
+ <Tabs.Content value="docker" class="space-y-6 p-4">
+ <div class="grid gap-6 sm:grid-cols-2">
+ <!-- Polling Settings -->
+ <div class="space-y-4 rounded-lg border p-4">
+ <div class="flex items-center justify-between">
+ <div class="space-y-0.5">
+ <Label for="polling-enabled" class="text-sm font-medium">{m.docker_enable_polling_label()}</Label>
+ <div class="text-muted-foreground text-xs">{m.docker_enable_polling_description()}</div>
+ </div>
+ <Switch id="polling-enabled" bind:checked={formPollingEnabled} />
+ </div>
+
+ {#if formPollingEnabled}
+ <div class="space-y-3 pt-2">
+ <SelectWithLabel
+ id="pollingIntervalMode"
+ name="pollingIntervalMode"
+ bind:value={pollingIntervalMode}
+ label={m.docker_polling_interval_label()}
+ placeholder={m.docker_polling_interval_placeholder_select()}
+ options={imagePollingOptions.map(({ value, label, description }) => ({
+ value,
+ label,
+ description
+ }))}
+ />
+
+ {#if pollingIntervalMode === 'custom'}
+ <TextInputWithLabel
+ bind:value={formPollingInterval}
+ label={m.custom_polling_interval()}
+ placeholder={m.docker_polling_interval_placeholder()}
+ helpText={m.docker_polling_interval_description()}
+ type="number"
+ />
+ {/if}
+
+ {#if formPollingInterval < 30}
+ <div
+ class="flex items-start gap-3 rounded-lg border border-amber-500/30 bg-amber-500/10 p-3 text-amber-900 dark:text-amber-200"
+ >
+ <AlertIcon class="mt-0.5 size-4 shrink-0 text-amber-600 dark:text-amber-400" />
+ <div class="flex-1 space-y-1">
+ <p class="text-sm font-medium">{m.docker_rate_limit_warning_title()}</p>
+ <p class="text-xs">{m.docker_rate_limit_warning_description()}</p>
+ </div>
+ </div>
+ {/if}
+ </div>
+ {/if}
+ </div>
+
+ <!-- Auto Update Settings -->
+ <div class="space-y-4 rounded-lg border p-4">
+ <div class="flex items-center justify-between">
+ <div class="space-y-0.5">
+ <Label for="auto-update" class="text-sm font-medium">{m.docker_auto_update_label()}</Label>
+ <div class="text-muted-foreground text-xs">{m.docker_auto_update_description()}</div>
+ </div>
+ <Switch id="auto-update" bind:checked={formAutoUpdate} disabled={!formPollingEnabled} />
+ </div>
+
+ {#if formAutoUpdate && formPollingEnabled}
+ <div class="pt-2">
+ <TextInputWithLabel
+ bind:value={formAutoUpdateInterval}
+ label={m.docker_auto_update_interval_label()}
+ placeholder={m.docker_auto_update_interval_placeholder()}
+ helpText={m.docker_auto_update_interval_description()}
+ type="number"
+ />
+ </div>
+ {/if}
+ </div>
+
+ <!-- Prune Mode -->
+ <div class="space-y-2">
+ <SelectWithLabel
+ id="dockerPruneMode"
+ name="pruneMode"
+ bind:value={formPruneMode}
+ label={m.docker_prune_action_label()}
+ description={pruneModeDescription}
+ placeholder={m.docker_prune_placeholder()}
+ options={pruneModeOptions}
+ onValueChange={(v) => (formPruneMode = v as 'all' | 'dangling')}
+ />
+ </div>
+
+ <!-- Default Shell -->
+ <div class="space-y-2">
+ <SelectWithLabel
+ id="shellSelectValue"
+ name="shellSelectValue"
+ bind:value={shellSelectValue}
+ label={m.docker_default_shell_label()}
+ description={m.docker_default_shell_description()}
+ placeholder={m.docker_default_shell_placeholder()}
+ options={[
+ ...shellOptions,
+ { value: 'custom', label: m.custom(), description: m.docker_shell_custom_description() }
+ ]}
+ />
+
+ {#if shellSelectValue === 'custom'}
+ <div class="pt-2">
+ <TextInputWithLabel
+ bind:value={formDefaultShell}
+ label={m.custom()}
+ placeholder={m.docker_shell_custom_path_placeholder()}
+ helpText={m.docker_shell_custom_path_help()}
+ type="text"
+ />
+ </div>
+ {/if}
+ </div>
</div>
- {/if}
- <div>
- <Label class="text-muted-foreground text-xs font-medium">{m.docker_prune_action_label()}</Label>
- <div class="mt-1 text-sm capitalize">{settings.dockerPruneMode || 'dangling'}</div>
- </div>
- <div>
- <Label class="text-muted-foreground text-xs font-medium">{m.docker_default_shell_label()}</Label>
- <div class="mt-1 font-mono text-sm">{settings.defaultShell || '/bin/sh'}</div>
- </div>
- </div>
+ </Tabs.Content>
+ </Tabs.Root>
</Card.Content>
</Card.Root>
{/if}
- <Card.Root class="flex flex-col">
- <Card.Header icon={ConnectionIcon}>
- <div class="flex flex-col space-y-1.5">
- <Card.Title>
- <h2>{m.environments_connection_title()}</h2>
- </Card.Title>
- <Card.Description>{m.environments_connection_description()}</Card.Description>
- </div>
- </Card.Header>
- <Card.Content class="space-y-4 p-4">
- <div>
- <Label for="api-url" class="text-sm font-medium">{m.environments_api_url()}</Label>
- {#if environment.id === '0'}
- <ArcaneTooltip.Root>
- <ArcaneTooltip.Trigger class="w-full">
- <Input
- id="api-url"
- type="url"
- bind:value={formApiUrl}
- class="mt-1.5 w-full font-mono"
- placeholder={m.environments_api_url_placeholder()}
- disabled={true}
- required
- />
- </ArcaneTooltip.Trigger>
- <ArcaneTooltip.Content>
- <p>{m.environments_local_setting_disabled()}</p>
- </ArcaneTooltip.Content>
- </ArcaneTooltip.Root>
- {:else}
- <Input
- id="api-url"
- type="url"
- bind:value={formApiUrl}
- class="mt-1.5 w-full font-mono"
- placeholder={m.environments_api_url_placeholder()}
- required
- />
- {/if}
- <p class="text-muted-foreground mt-1.5 text-xs">{m.environments_api_url_help()}</p>
- </div>
-
- <ArcaneButton
- action="base"
- onclick={testConnection}
- disabled={isTestingConnection}
- loading={isTestingConnection}
- icon={TestIcon}
- customLabel={m.environments_test_connection()}
- loadingLabel={m.environments_testing_connection()}
- class="w-full"
- />
- </Card.Content>
- </Card.Root>
-
{#if environment.id !== '0'}
<Card.Root class="flex flex-col">
<Card.Header icon={ApiKeyIcon}>
@@ -603,21 +859,4 @@
</AlertDialog.Footer>
</AlertDialog.Content>
</AlertDialog.Root>
-
- <AlertDialog.Root bind:open={showSwitchDialog}>
- <AlertDialog.Content>
- <AlertDialog.Header>
- <AlertDialog.Title>{m.environments_switch_to_edit_title()}</AlertDialog.Title>
- <AlertDialog.Description>
- {m.environments_switch_to_edit_message()}
- </AlertDialog.Description>
- </AlertDialog.Header>
- <AlertDialog.Footer>
- <AlertDialog.Cancel>{m.common_cancel()}</AlertDialog.Cancel>
- <AlertDialog.Action onclick={confirmSwitchAndEdit}>
- {m.environments_switch_and_edit()}
- </AlertDialog.Action>
- </AlertDialog.Footer>
- </AlertDialog.Content>
- </AlertDialog.Root>
</div>
diff --git a/frontend/src/routes/(app)/settings/docker/+page.svelte b/frontend/src/routes/(app)/settings/docker/+page.svelte
deleted file mode 100644
index 3d152703d..000000000
--- a/frontend/src/routes/(app)/settings/docker/+page.svelte
+++ /dev/null
@@ -1,313 +0,0 @@
-<script lang="ts">
- import { AlertIcon } from '$lib/icons';
- import * as Alert from '$lib/components/ui/alert';
- import type { Settings } from '$lib/types/settings.type';
- import { z } from 'zod/v4';
- import SelectWithLabel from '$lib/components/form/select-with-label.svelte';
- import { m } from '$lib/paraglide/messages';
- import TextInputWithLabel from '$lib/components/form/text-input-with-label.svelte';
- import settingsStore from '$lib/stores/config-store';
- import { SettingsPageLayout } from '$lib/layouts';
- import { createSettingsForm } from '$lib/utils/settings-form.util';
- import { Separator } from '$lib/components/ui/separator';
- import { Label } from '$lib/components/ui/label';
- import { Switch } from '$lib/components/ui/switch/index.js';
- import { DockerBrandIcon } from '$lib/icons';
-
- let { data } = $props();
- const currentSettings = $derived<Settings>($settingsStore || data.settings!);
- const isReadOnly = $derived.by(() => $settingsStore?.uiConfigDisabled);
-
- const formSchema = z.object({
- pollingEnabled: z.boolean(),
- pollingInterval: z.number().int().min(5).max(10080),
- autoUpdate: z.boolean(),
- autoUpdateInterval: z.number().int(),
- dockerPruneMode: z.enum(['all', 'dangling']),
- maxImageUploadSize: z.number().int().min(50).max(5000),
- defaultShell: z.string(),
- baseServerUrl: z.string().min(1, m.general_base_url_required())
- });
-
- let pruneMode = $derived(currentSettings.dockerPruneMode);
-
- type PollingIntervalMode = 'hourly' | 'daily' | 'weekly' | 'custom';
-
- const imagePollingOptions: Array<{
- value: PollingIntervalMode;
- label: string;
- description: string;
- minutes?: number;
- }> = [
- { value: 'hourly', minutes: 60, label: m.hourly(), description: m.polling_hourly_description() },
- { value: 'daily', minutes: 1440, label: m.daily(), description: m.polling_daily_description() },
- { value: 'weekly', minutes: 10080, label: m.weekly(), description: m.polling_weekly_description() },
- { value: 'custom', label: m.custom(), description: m.use_custom_polling_value() }
- ];
-
- const presetToMinutes = Object.fromEntries(
- imagePollingOptions.filter((o) => o.value !== 'custom').map((o) => [o.value, o.minutes!])
- ) as Record<Exclude<PollingIntervalMode, 'custom'>, number>;
-
- let pollingIntervalMode = $state<PollingIntervalMode>(
- imagePollingOptions.find((o) => o.minutes === currentSettings.pollingInterval)?.value ?? 'custom'
- );
-
- const pruneModeOptions = [
- { value: 'all', label: m.docker_prune_all(), description: m.docker_prune_all_description() },
- { value: 'dangling', label: m.docker_prune_dangling(), description: m.docker_prune_dangling_description() }
- ];
-
- const pruneModeDescription = $derived(
- pruneModeOptions.find((o) => o.value === pruneMode)?.description ?? m.docker_prune_mode_description()
- );
-
- const shellOptions = [
- { value: '/bin/sh', label: '/bin/sh', description: m.docker_shell_sh_description() },
- { value: '/bin/bash', label: '/bin/bash', description: m.docker_shell_bash_description() },
- { value: '/bin/ash', label: '/bin/ash', description: m.docker_shell_ash_description() },
- { value: '/bin/zsh', label: '/bin/zsh', description: m.docker_shell_zsh_description() }
- ];
-
- let shellSelectValue = $state<string>(shellOptions.find((o) => o.value === currentSettings.defaultShell)?.value ?? 'custom');
-
- let { formInputs } = $derived(
- createSettingsForm({
- schema: formSchema,
- currentSettings,
- getCurrentSettings: () => $settingsStore || data.settings!,
- successMessage: m.general_settings_saved()
- })
- );
-
- // Sync polling mode select with form value
- $effect(() => {
- if (pollingIntervalMode !== 'custom') {
- $formInputs.pollingInterval.value = presetToMinutes[pollingIntervalMode];
- }
- });
-
- // Sync shell select with form value
- $effect(() => {
- if (shellSelectValue !== 'custom') {
- $formInputs.defaultShell.value = shellSelectValue;
- }
- });
-</script>
-
-<SettingsPageLayout
- title={m.docker_title()}
- description={m.docker_description()}
- icon={DockerBrandIcon}
- pageType="form"
- showReadOnlyTag={isReadOnly}
->
- {#snippet mainContent()}
- <fieldset disabled={isReadOnly} class="relative space-y-8">
- <div class="space-y-4">
- <h3 class="text-lg font-medium">Connection</h3>
- <div class="bg-card rounded-lg border shadow-sm">
- <div class="space-y-6 p-6">
- <div class="grid gap-4 md:grid-cols-[1fr_1.5fr] md:gap-8">
- <div>
- <Label class="text-base">{m.general_base_url_label()}</Label>
- <p class="text-muted-foreground mt-1 text-sm">{m.general_base_url_help()}</p>
- </div>
- <div class="space-y-4">
- <TextInputWithLabel
- bind:value={$formInputs.baseServerUrl.value}
- error={$formInputs.baseServerUrl.error}
- label={m.general_base_url_label()}
- placeholder={m.general_base_url_placeholder()}
- helpText={m.general_base_url_help()}
- type="text"
- />
- </div>
- </div>
- </div>
- </div>
- </div>
-
- <!-- Automation Section -->
- <div class="space-y-4">
- <h3 class="text-lg font-medium">Automation</h3>
- <div class="bg-card rounded-lg border shadow-sm">
- <div class="space-y-6 p-6">
- <!-- Image Polling -->
- <div class="grid gap-4 md:grid-cols-[1fr_1.5fr] md:gap-8">
- <div>
- <Label class="text-base">{m.docker_image_polling_title()}</Label>
- <p class="text-muted-foreground mt-1 text-sm">{m.docker_image_polling_description()}</p>
- </div>
- <div class="space-y-4">
- <div class="flex items-center gap-2">
- <Switch
- id="pollingEnabled"
- bind:checked={$formInputs.pollingEnabled.value}
- onCheckedChange={(checked) => {
- $formInputs.pollingEnabled.value = checked;
- }}
- />
- <Label for="pollingEnabled" class="font-normal">
- {m.docker_enable_polling_label()}
- </Label>
- </div>
-
- {#if $formInputs.pollingEnabled.value}
- <div class="space-y-3 pt-2">
- <SelectWithLabel
- id="pollingIntervalMode"
- name="pollingIntervalMode"
- bind:value={pollingIntervalMode}
- label={m.docker_polling_interval_label()}
- placeholder={m.docker_polling_interval_placeholder_select()}
- options={imagePollingOptions.map(({ value, label, description }) => ({ value, label, description }))}
- />
-
- {#if pollingIntervalMode === 'custom'}
- <TextInputWithLabel
- bind:value={$formInputs.pollingInterval.value}
- error={$formInputs.pollingInterval.error}
- label={m.custom_polling_interval()}
- placeholder={m.docker_polling_interval_placeholder()}
- helpText={m.docker_polling_interval_description()}
- type="number"
- />
- {/if}
-
- {#if $formInputs.pollingInterval.value < 30}
- <Alert.Root variant="warning">
- <AlertIcon class="size-4" />
- <Alert.Title>{m.docker_rate_limit_warning_title()}</Alert.Title>
- <Alert.Description>{m.docker_rate_limit_warning_description()}</Alert.Description>
- </Alert.Root>
- {/if}
- </div>
- {/if}
- </div>
- </div>
-
- <Separator />
-
- <!-- Auto Updates -->
- <div class="grid gap-4 md:grid-cols-[1fr_1.5fr] md:gap-8">
- <div>
- <Label class="text-base">{m.docker_auto_updates_title()}</Label>
- <p class="text-muted-foreground mt-1 text-sm">{m.docker_auto_updates_description()}</p>
- </div>
- <div class="space-y-4">
- <div class="flex items-center gap-2">
- <Switch
- id="autoUpdateSwitch"
- bind:checked={$formInputs.autoUpdate.value}
- disabled={!$formInputs.pollingEnabled.value}
- onCheckedChange={(checked) => {
- $formInputs.autoUpdate.value = checked;
- }}
- />
- <Label for="autoUpdateSwitch" class="font-normal">
- {m.docker_auto_update_label()}
- </Label>
- </div>
-
- {#if $formInputs.autoUpdate.value && $formInputs.pollingEnabled.value}
- <div class="pt-2">
- <TextInputWithLabel
- bind:value={$formInputs.autoUpdateInterval.value}
- error={$formInputs.autoUpdateInterval.error}
- label={m.docker_auto_update_interval_label()}
- placeholder={m.docker_auto_update_interval_placeholder()}
- helpText={m.docker_auto_update_interval_description()}
- type="number"
- />
- </div>
- {/if}
- </div>
- </div>
- </div>
- </div>
- </div>
-
- <!-- Maintenance Section -->
- <div class="space-y-4">
- <h3 class="text-lg font-medium">Maintenance</h3>
- <div class="bg-card rounded-lg border shadow-sm">
- <div class="space-y-6 p-6">
- <!-- Cleanup Settings -->
- <div class="grid gap-4 md:grid-cols-[1fr_1.5fr] md:gap-8">
- <div>
- <Label class="text-base">{m.docker_cleanup_settings_title()}</Label>
- <p class="text-muted-foreground mt-1 text-sm">{m.docker_cleanup_settings_description()}</p>
- </div>
- <div class="space-y-4">
- <SelectWithLabel
- id="dockerPruneMode"
- name="pruneMode"
- bind:value={$formInputs.dockerPruneMode.value}
- error={$formInputs.dockerPruneMode.error}
- label={m.docker_prune_action_label()}
- description={pruneModeDescription}
- placeholder={m.docker_prune_placeholder()}
- options={pruneModeOptions}
- onValueChange={(v) => (pruneMode = v as 'all' | 'dangling')}
- />
-
- <TextInputWithLabel
- bind:value={$formInputs.maxImageUploadSize.value}
- error={$formInputs.maxImageUploadSize.error}
- label={m.docker_max_upload_size_label()}
- placeholder={m.docker_max_upload_size_placeholder()}
- helpText={m.docker_max_upload_size_description()}
- type="number"
- />
- </div>
- </div>
- </div>
- </div>
- </div>
-
- <!-- Terminal Section -->
- <div class="space-y-4">
- <h3 class="text-lg font-medium">Terminal</h3>
- <div class="bg-card rounded-lg border shadow-sm">
- <div class="space-y-6 p-6">
- <!-- Terminal Settings -->
- <div class="grid gap-4 md:grid-cols-[1fr_1.5fr] md:gap-8">
- <div>
- <Label class="text-base">{m.docker_terminal_settings_title()}</Label>
- <p class="text-muted-foreground mt-1 text-sm">{m.docker_terminal_settings_description()}</p>
- </div>
- <div class="space-y-4">
- <SelectWithLabel
- id="shellSelectValue"
- name="shellSelectValue"
- bind:value={shellSelectValue}
- label={m.docker_default_shell_label()}
- description={m.docker_default_shell_description()}
- placeholder={m.docker_default_shell_placeholder()}
- options={[
- ...shellOptions,
- { value: 'custom', label: m.custom(), description: m.docker_shell_custom_description() }
- ]}
- />
-
- {#if shellSelectValue === 'custom'}
- <div class="pt-2">
- <TextInputWithLabel
- bind:value={$formInputs.defaultShell.value}
- error={$formInputs.defaultShell.error}
- label={m.custom()}
- placeholder={m.docker_shell_custom_path_placeholder()}
- helpText={m.docker_shell_custom_path_help()}
- type="text"
- />
- </div>
- {/if}
- </div>
- </div>
- </div>
- </div>
- </div>
- </fieldset>
- {/snippet}
-</SettingsPageLayout>
diff --git a/frontend/src/routes/(app)/settings/general/+page.svelte b/frontend/src/routes/(app)/settings/general/+page.svelte
index cbda7c12e..971cc3321 100644
--- a/frontend/src/routes/(app)/settings/general/+page.svelte
+++ b/frontend/src/routes/(app)/settings/general/+page.svelte
@@ -15,8 +15,6 @@
const isReadOnly = $derived.by(() => $settingsStore?.uiConfigDisabled);
const formSchema = z.object({
- projectsDirectory: z.string().min(1, m.general_projects_directory_required()),
- diskUsagePath: z.string().min(1, m.common_field_required({ field: m.directory_path() })),
environmentHealthInterval: z.number().int().min(1).max(60)
});
@@ -44,35 +42,6 @@
<h3 class="text-lg font-medium">System Configuration</h3>
<div class="bg-card rounded-lg border shadow-sm">
<div class="space-y-6 p-6">
- <!-- Project Paths -->
- <div class="grid gap-4 md:grid-cols-[1fr_1.5fr] md:gap-8">
- <div>
- <Label class="text-base">{m.general_projects_heading()}</Label>
- <p class="text-muted-foreground mt-1 text-sm">{m.general_projects_description()}</p>
- </div>
- <div class="space-y-4">
- <TextInputWithLabel
- bind:value={$formInputs.projectsDirectory.value}
- error={$formInputs.projectsDirectory.error}
- label={m.general_projects_directory_label()}
- placeholder={m.general_projects_directory_placeholder()}
- helpText={m.general_projects_directory_help()}
- type="text"
- />
-
- <TextInputWithLabel
- bind:value={$formInputs.diskUsagePath.value}
- error={$formInputs.diskUsagePath.error}
- label={m.disk_usage_settings()}
- placeholder="/var/lib/docker"
- helpText={m.disk_usage_settings_description()}
- type="text"
- />
- </div>
- </div>
-
- <Separator />
-
<!-- Health Check -->
<div class="grid gap-4 md:grid-cols-[1fr_1.5fr] md:gap-8">
<div>
diff --git a/greptile.json b/greptile.json
index 199b11a5c..4393f4deb 100644
--- a/greptile.json
+++ b/greptile.json
@@ -2,13 +2,15 @@
"labels": [],
"comment": "**Disclaimer** Greptiles Reviews use AI, make sure to check over its work",
"fixWithAI": true,
- "strictness": 1,
+ "hideFooter": false,
+ "strictness": 2,
"statusCheck": true,
"commentTypes": ["syntax", "logic", "style"],
"instructions": "",
"disabledLabels": [],
"excludeAuthors": ["dependabot[bot]", "github-actions[bot]"],
"ignoreKeywords": "chore(translations)",
+ "ignorePatterns": "greptile.json\n",
"includeAuthors": [],
"summarySection": {
"included": true,
@@ -16,23 +18,47 @@
"defaultOpen": true
},
"excludeBranches": [],
+ "fileChangeLimit": 1002,
"includeBranches": [],
"includeKeywords": "",
+ "triggerOnUpdates": false,
+ "updateSummaryOnly": false,
"issuesTableSection": {
"included": true,
"collapsible": true,
"defaultOpen": false
},
+ "statusCommentsEnabled": false,
"confidenceScoreSection": {
"included": true,
"collapsible": true,
- "defaultOpen": false
+ "defaultOpen": true
},
"sequenceDiagramSection": {
- "included": true,
+ "included": false,
"collapsible": true,
"defaultOpen": false
},
"shouldUpdateDescription": true,
- "updateExistingSummaryComment": true
+ "customContext": {
+ "other": [
+ {
+ "scope": [],
+ "content": ""
+ }
+ ],
+ "rules": [
+ {
+ "scope": [],
+ "rule": ""
+ }
+ ],
+ "files": [
+ {
+ "scope": [],
+ "path": "",
+ "description": ""
+ }
+ ]
+ }
}