refactor: drop Desktop beta-settings check; gate hint on LogsTab flag

Docker Desktop is removing the "Enable Logs view" beta setting, so drop
the /app/settings check and rely on /features alone. With the setting
gate gone, the compose hook subprocess would print the Logs view hint
regardless of LogsTab; add a flag check in handleHook. Consolidate
engine-label discovery and feature-flag evaluation into internal/desktop.

Signed-off-by: Guillaume Lours <glours@users.noreply.github.com>
This commit is contained in:
Guillaume Lours 2026-04-23 10:22:51 +02:00 committed by Guillaume Lours
parent 71cd334dbd
commit 554a2ba3e8
5 changed files with 90 additions and 151 deletions

View file

@ -22,31 +22,14 @@ import (
"github.com/docker/compose/v5/internal/desktop"
)
func (s *composeService) desktopEndpoint(ctx context.Context) (string, error) {
return desktop.Endpoint(ctx, s.apiClient())
}
// isDesktopIntegrationActive returns true when Docker Desktop is the active engine.
func (s *composeService) isDesktopIntegrationActive(ctx context.Context) (bool, error) {
endpoint, err := s.desktopEndpoint(ctx)
endpoint, err := desktop.Endpoint(ctx, s.apiClient())
return endpoint != "", err
}
// isDesktopFeatureActive checks whether a Docker Desktop feature is both
// available (feature flag) and enabled by the user (settings). Returns false
// silently when Desktop is not running or unreachable.
// isDesktopFeatureActive checks whether a Docker Desktop feature flag is
// enabled. Returns false silently when Desktop is not running or unreachable.
func (s *composeService) isDesktopFeatureActive(ctx context.Context, feature string) bool {
endpoint, err := s.desktopEndpoint(ctx)
if err != nil || endpoint == "" {
return false
}
ddClient := desktop.NewClient(endpoint)
defer ddClient.Close() //nolint:errcheck
enabled, err := ddClient.IsFeatureEnabled(ctx, feature)
if err != nil {
return false
}
return enabled
return desktop.IsFeatureActive(ctx, s.apiClient(), feature)
}