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

Conversation

pavolloffay
Copy link
Member

Resolves #163

Signed-off-by: Pavol Loffay <ploffay@redhat.com>
Signed-off-by: Pavol Loffay <ploffay@redhat.com>
@jpkrohling
Copy link
Contributor

This change is Reviewable

@pavolloffay pavolloffay changed the title Enable depenencies tab Automatically Enable/disable depenencies tab Mar 13, 2019
@codecov
Copy link

codecov bot commented Mar 13, 2019

Codecov Report

Merging #311 into master will decrease coverage by 0.04%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #311      +/-   ##
==========================================
- Coverage   88.68%   88.63%   -0.05%     
==========================================
  Files          70       70              
  Lines        3156     3169      +13     
==========================================
+ Hits         2799     2809      +10     
- Misses        244      246       +2     
- Partials      113      114       +1
Impacted Files Coverage Δ
pkg/strategy/controller.go 96.9% <100%> (-3.1%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 540b7e9...5c2bbba. Read the comment docs.

Copy link
Contributor

@objectiser objectiser left a comment

Choose a reason for hiding this comment

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

LGTM - just one query and one additional test.

},
{
j: &v1.JaegerSpec{Storage: v1.JaegerStorageSpec{Options: v1.NewOptions(map[string]interface{}{"es-archive.enabled": "true"})}},
expected: &v1.JaegerSpec{Storage: v1.JaegerStorageSpec{Options: v1.NewOptions(map[string]interface{}{"es-archive.enabled": "true"})},
UI: v1.JaegerUISpec{Options: v1.NewFreeForm(map[string]interface{}{"archiveEnabled": true})}},
UI: v1.JaegerUISpec{Options: v1.NewFreeForm(map[string]interface{}{"archiveEnabled": true, "dependencies": map[string]interface{}{"menuEnabled": false}})}},
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't this wrong - if the storage type is not defined, it should default to memory, which should show the dependencies tab. The expected results is showing it disabled.

Copy link
Member Author

Choose a reason for hiding this comment

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

In general yes, but this tests only normalizeUI which works on any storage

pkg/strategy/controller_test.go Show resolved Hide resolved
Signed-off-by: Pavol Loffay <ploffay@redhat.com>
Signed-off-by: Pavol Loffay <ploffay@redhat.com>

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) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Just realised, with the additional test, if dependencies are explicitly disabled, then menuEnabled should be false?

Copy link
Contributor

Choose a reason for hiding this comment

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

so should the condition be if strings.EqualFold(storage, "memory") || depsEnabled == nil || *depsEnabled == true) {?

Copy link
Member Author

Choose a reason for hiding this comment

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

You are right, changing

Signed-off-by: Pavol Loffay <ploffay@redhat.com>
@@ -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

Signed-off-by: Pavol Loffay <ploffay@redhat.com>
@objectiser
Copy link
Contributor

@pavolloffay LGTM - although there is a test failure.

Signed-off-by: Pavol Loffay <ploffay@redhat.com>
@pavolloffay pavolloffay merged commit 597cdaf into jaegertracing:master Mar 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants