Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically Enable/disable depenencies tab #311

Merged
merged 7 commits into from
Mar 14, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/strategy/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ func enableArchiveButton(uiOpts map[string]interface{}, sOpts map[string]string)

func disableDependenciesTab(uiOpts map[string]interface{}, storage string, depsEnabled *bool) {
// dependency tab is by default enabled and memory storage support it
if strings.EqualFold(storage, "memory") || (depsEnabled != nil && *depsEnabled == false) {
if strings.EqualFold(storage, "memory") || (depsEnabled != nil && *depsEnabled == true) {
Copy link
Contributor

@objectiser objectiser Mar 14, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it needs to be ... || depsEnabled == nil || *depsEnabled == true - as if the depsEnabled is nil, then it means dependencies are enabled by default, doesn't it? So UI config shouldn't be changed.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The normalization of deps spec runs before - so we assuming correct settings here

return
}
deps := map[string]interface{}{}
Expand Down
2 changes: 1 addition & 1 deletion pkg/strategy/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ func TestNormalizeUIDependenciesTab(t *testing.T) {
uiOpts: map[string]interface{}{},
storage: "whateverStorage",
enabled: &falseVar,
expected: map[string]interface{}{},
expected: map[string]interface{}{"dependencies": map[string]interface{}{"menuEnabled": false}},
},
{
uiOpts: map[string]interface{}{"dependencies": "respectThis"},
Expand Down