Skip to content

Commit 746cd76

Browse files
committed
Remove feature flag integration with Docker Desktop for ComposeUI and ComposeNav
Signed-off-by: Joana Hrotko <joana.hrotko@docker.com>
1 parent 41df35c commit 746cd76

7 files changed

Lines changed: 16 additions & 51 deletions

File tree

cmd/compose/compose.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ func RootCommand(dockerCli command.Cli, backend Backend) *cobra.Command { //noli
580580
}
581581

582582
c.AddCommand(
583-
upCommand(&opts, dockerCli, backend, experiments),
583+
upCommand(&opts, dockerCli, backend),
584584
downCommand(&opts, dockerCli, backend),
585585
startCommand(&opts, dockerCli, backend),
586586
restartCommand(&opts, dockerCli, backend),

cmd/compose/up.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import (
2727
"github.com/compose-spec/compose-go/v2/types"
2828
"github.com/docker/cli/cli/command"
2929
"github.com/docker/compose/v2/cmd/formatter"
30-
"github.com/docker/compose/v2/internal/experimental"
3130
xprogress "github.com/moby/buildkit/util/progress/progressui"
3231
"github.com/spf13/cobra"
3332

@@ -81,13 +80,15 @@ func (opts upOptions) apply(project *types.Project, services []string) (*types.P
8180
return project, nil
8281
}
8382

84-
func (opts *upOptions) validateNavigationMenu(dockerCli command.Cli, experimentals *experimental.State) {
83+
func (opts *upOptions) validateNavigationMenu(dockerCli command.Cli) {
8584
if !dockerCli.Out().IsTerminal() {
8685
opts.navigationMenu = false
8786
return
8887
}
8988
if !opts.navigationMenuChanged {
90-
opts.navigationMenu = SetUnchangedOption(ComposeMenu, experimentals.NavBar())
89+
if envVar, ok := os.LookupEnv(ComposeMenu); ok {
90+
opts.navigationMenu = utils.StringToBool(envVar)
91+
}
9192
}
9293
}
9394

@@ -102,7 +103,7 @@ func (opts upOptions) OnExit() api.Cascade {
102103
}
103104
}
104105

105-
func upCommand(p *ProjectOptions, dockerCli command.Cli, backend api.Service, experiments *experimental.State) *cobra.Command {
106+
func upCommand(p *ProjectOptions, dockerCli command.Cli, backend api.Service) *cobra.Command {
106107
up := upOptions{}
107108
create := createOptions{}
108109
build := buildOptions{ProjectOptions: p}
@@ -127,7 +128,7 @@ func upCommand(p *ProjectOptions, dockerCli command.Cli, backend api.Service, ex
127128
return errors.New("cannot combine --attach and --attach-dependencies")
128129
}
129130

130-
up.validateNavigationMenu(dockerCli, experiments)
131+
up.validateNavigationMenu(dockerCli)
131132

132133
if !p.All && len(project.Services) == 0 {
133134
return fmt.Errorf("no service selected")

cmd/formatter/shortcut.go

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -106,15 +106,14 @@ type LogKeyboard struct {
106106
Watch KeyboardWatch
107107
IsDockerDesktopActive bool
108108
IsWatchConfigured bool
109-
IsDDComposeUIActive bool
110109
logLevel KEYBOARD_LOG_LEVEL
111110
signalChannel chan<- os.Signal
112111
}
113112

114113
var KeyboardManager *LogKeyboard
115114
var eg multierror.Group
116115

117-
func NewKeyboardManager(ctx context.Context, isDockerDesktopActive, isWatchConfigured, isDockerDesktopConfigActive bool,
116+
func NewKeyboardManager(ctx context.Context, isDockerDesktopActive, isWatchConfigured bool,
118117
sc chan<- os.Signal,
119118
watchFn func(ctx context.Context,
120119
doneCh chan bool,
@@ -126,7 +125,6 @@ func NewKeyboardManager(ctx context.Context, isDockerDesktopActive, isWatchConfi
126125
km := LogKeyboard{}
127126
km.IsDockerDesktopActive = isDockerDesktopActive
128127
km.IsWatchConfigured = isWatchConfigured
129-
km.IsDDComposeUIActive = isDockerDesktopConfigActive
130128
km.logLevel = INFO
131129

132130
km.Watch.Watching = false
@@ -200,9 +198,8 @@ func (lk *LogKeyboard) navigationMenu() string {
200198
if openDDInfo != "" {
201199
openDDUI = navColor(" ")
202200
}
203-
if lk.IsDDComposeUIActive {
204-
openDDUI = openDDUI + shortcutKeyColor("o") + navColor(" View Config")
205-
}
201+
openDDUI = openDDUI + shortcutKeyColor("o") + navColor(" View Config")
202+
206203
var watchInfo string
207204
if openDDInfo != "" || openDDUI != "" {
208205
watchInfo = navColor(" ")
@@ -246,9 +243,6 @@ func (lk *LogKeyboard) openDockerDesktop(ctx context.Context, project *types.Pro
246243
}
247244

248245
func (lk *LogKeyboard) openDDComposeUI(ctx context.Context, project *types.Project) {
249-
if !lk.IsDDComposeUIActive {
250-
return
251-
}
252246
eg.Go(tracing.EventWrapFuncForErrGroup(ctx, "menu/gui/composeview", tracing.SpanOptions{},
253247
func(ctx context.Context) error {
254248
link := fmt.Sprintf("docker-desktop://dashboard/docker-compose/%s", project.Name)
@@ -319,10 +313,8 @@ func (lk *LogKeyboard) HandleKeyEvents(event keyboard.KeyEvent, ctx context.Cont
319313
lk.openDockerDesktop(ctx, project)
320314
case 'w':
321315
if !lk.IsWatchConfigured {
322-
if lk.IsDDComposeUIActive {
323-
// we try to open watch docs
324-
lk.openDDWatchDocs(ctx, project)
325-
}
316+
// we try to open watch docs
317+
lk.openDDWatchDocs(ctx, project)
326318
// either way we mark menu/watch as an error
327319
eg.Go(tracing.EventWrapFuncForErrGroup(ctx, "menu/watch", tracing.SpanOptions{},
328320
func(ctx context.Context) error {

internal/experimental/experimental.go

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -66,20 +66,3 @@ func (s *State) Load(ctx context.Context, client *desktop.Client) error {
6666
s.desktopValues = desktopValues
6767
return nil
6868
}
69-
70-
func (s *State) NavBar() bool {
71-
return s.determineFeatureState("ComposeNav")
72-
}
73-
74-
func (s *State) ComposeUI() bool {
75-
return s.determineFeatureState("ComposeUIView")
76-
}
77-
78-
func (s *State) determineFeatureState(name string) bool {
79-
if s == nil || !s.active || s.desktopValues == nil {
80-
return false
81-
}
82-
// TODO(milas): we should add individual environment variable overrides
83-
// per-experiment in a generic way here
84-
return s.desktopValues[name].Enabled
85-
}

internal/tracing/keyboard_metrics.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,16 @@ import (
2222
"go.opentelemetry.io/otel/attribute"
2323
)
2424

25-
func KeyboardMetrics(ctx context.Context, enabled, isDockerDesktopActive, isWatchConfigured, isDockerDesktopComposeUI bool) {
25+
func KeyboardMetrics(ctx context.Context, enabled, isDockerDesktopActive, isWatchConfigured bool) {
2626
commandAvailable := []string{}
2727
if isDockerDesktopActive {
2828
commandAvailable = append(commandAvailable, "gui")
29+
commandAvailable = append(commandAvailable, "gui/composeview")
2930
}
3031
if isWatchConfigured {
3132
commandAvailable = append(commandAvailable, "watch")
3233
}
3334

34-
if isDockerDesktopComposeUI {
35-
commandAvailable = append(commandAvailable, "gui/composeview")
36-
}
37-
3835
AddAttributeToSpan(ctx,
3936
attribute.Bool("navmenu.enabled", enabled),
4037
attribute.StringSlice("navmenu.command_available", commandAvailable))

pkg/compose/compose.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -324,10 +324,3 @@ func (s *composeService) RuntimeVersion(ctx context.Context) (string, error) {
324324
func (s *composeService) isDesktopIntegrationActive() bool {
325325
return s.desktopCli != nil
326326
}
327-
328-
func (s *composeService) isDesktopUIEnabled() bool {
329-
if !s.isDesktopIntegrationActive() {
330-
return false
331-
}
332-
return s.experiments.ComposeUI()
333-
}

pkg/compose/up.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,9 @@ func (s *composeService) Up(ctx context.Context, project *types.Project, options
9898
defer keyboard.Close() //nolint:errcheck
9999
isWatchConfigured := s.shouldWatch(project)
100100
isDockerDesktopActive := s.isDesktopIntegrationActive()
101-
isDockerDesktopComposeUI := s.isDesktopUIEnabled()
102-
tracing.KeyboardMetrics(ctx, options.Start.NavigationMenu, isDockerDesktopActive, isWatchConfigured, isDockerDesktopComposeUI)
101+
tracing.KeyboardMetrics(ctx, options.Start.NavigationMenu, isDockerDesktopActive, isWatchConfigured)
103102

104-
formatter.NewKeyboardManager(ctx, isDockerDesktopActive, isWatchConfigured, isDockerDesktopComposeUI, signalChan, s.watch)
103+
formatter.NewKeyboardManager(ctx, isDockerDesktopActive, isWatchConfigured, signalChan, s.watch)
105104
if options.Start.Watch {
106105
formatter.KeyboardManager.StartWatch(ctx, doneCh, project, options)
107106
}

0 commit comments

Comments
 (0)