Skip to content

[Dashboard][Controls] Add Control Group Search Settings#128090

Merged
ThomThomson merged 12 commits intoelastic:mainfrom
ThomThomson:controls/controlGroupSearchSettings
Mar 23, 2022
Merged

[Dashboard][Controls] Add Control Group Search Settings#128090
ThomThomson merged 12 commits intoelastic:mainfrom
ThomThomson:controls/controlGroupSearchSettings

Conversation

@ThomThomson
Copy link
Copy Markdown
Contributor

@ThomThomson ThomThomson commented Mar 18, 2022

Resolves #126811
Resolves #123879

Summary

Screen Shot 2022-03-21 at 5 44 03 PM

This PR adds new settings to the control group, allowing configuration of:

Query settings: Query settings influence which pieces of state from the query bar are applied to the controls. Generally they should be all set to on or off, but there are advanced use cases where an author may want to ignore the timerange, filter pills, or the querry bar separately.

Validation: When Controls query for data, they also send a validation query to see if their selection would cover any documents. If the validation setting is off, these validation results are not used. If the setting is on, selections which are invalid are ignored.

Hierarchical chaining: With Hierarchical chining on, controls pass their filters from left to right. With Hierarchical chaining off, each control is independently filtered by the query bar settings, and are unrelated.

Tests

This PR also adds tests to ensure that each setting works properly. Additionally, the functional test suite has been split up into 4 files under a new folder in dashboard_elements

Checklist

Delete any items that are not applicable to this PR.

@ThomThomson ThomThomson added Feature:Dashboard Dashboard related features Feature:Input Control Input controls visualization Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas t// loe:large Large Level of Effort impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. backport:skip This PR does not require backporting release_note:feature Makes this part of the condensed release notes Project:Controls v8.3.0 labels Mar 18, 2022
@andreadelrio
Copy link
Copy Markdown
Contributor

@ThomThomson sent some suggestions for the flyout (PR). Mainly trying to make the three switches less prominent as right now they seem to stand out a lot more than the two fields above (Layout and Default width).

I would also like to suggest that we consider changing the wording of the Layout field to Label position: Inline, Above. I think this would make it more clear. We got some feedback from earlier usability testing about confusion around that field. I think if users see "Control settings > Layout > Double line" they might be tricked into thinking they are setting two rows of controls.

@ThomThomson
Copy link
Copy Markdown
Contributor Author

@andreadelrio design changes look great and have been merged into this PR. I also really appreciate the new copy idea for the label position setting. That makes it so much more clear.

I have implemented the new Copy, and am hoping that @KOTungseth likes it too when she does her copy review!

@andreadelrio
Copy link
Copy Markdown
Contributor

@andreadelrio design changes look great and have been merged into this PR. I also really appreciate the new copy idea for the label position setting. That makes it so much more clear.

I have implemented the new Copy, and am hoping that @KOTungseth likes it too when she does her copy review!

@ThomThomson Awesome! to keep things consistent we should really rename Title to Label in the "Create control" form.

@ThomThomson ThomThomson marked this pull request as ready for review March 23, 2022 13:19
@ThomThomson ThomThomson requested review from a team as code owners March 23, 2022 13:19
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/kibana-presentation (Team:Presentation)

Copy link
Copy Markdown
Contributor

@jloleysens jloleysens left a comment

Choose a reason for hiding this comment

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

AppServices changes LGTM!

@botelastic botelastic bot added the Feature:Embedding Embedding content via iFrame label Mar 23, 2022
Copy link
Copy Markdown
Contributor

@Heenawter Heenawter left a comment

Choose a reason for hiding this comment

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

I was able to get in a situation where I couldn't unselect an option via the following steps:

1. Create two controls - for example, I did lastName and gender for the E-Commerce sample data
2. Turn off hierarchical chaining
3. Make selections in both controls - for example, I chose gender = 'female' and lastName = 'McDonald'
4. Turn hierarchical chaining back on
5. In the situation above, McDonald was no longer a valid female selection so it doesn't appear in my list (can't even search it), but it's still showing as being selected

Once I unselect female with hierarchical chaining on, I once again have access to unselect McDonald - but this probably isn't ideal? Unsure how we should deal with that.

Ignore this 🙃 It was a matter of case sensitivity - I searched for mc and not Mc, which is why it wasn't showing up. Might be worth considering turning off case sensitivity in searches though?

Will continue to test and comment anything else I notice - so consider this a code review + a partial behavior review 👍

width: ControlWidth;
}

export type ControlGroupChainingSystem = 'HIERARCHICAL' | 'NONE';
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just a general style question for my own future reference - why did you choose ALL CAPS for these strings? Other constant strings, such as the different control widths/styles are all camel case (auto, oneLine, etc.), so I'm just curious about what differentiates this one.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

That's a good question! I chose all caps for these values because it was originally an enum, and I changed it to a union string type because they're better DX-wise.

I am not sure if we have a naming convention for union string types, but I have no strong feelings one way or another, and could quite easily change it! Let's figure out which casing is used more frequently and update accordingly.

updateAllControlWidths(currentWidth);
}
applyChangesToInput();
onClose();
Copy link
Copy Markdown
Contributor

@Heenawter Heenawter Mar 23, 2022

Choose a reason for hiding this comment

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

For specifically the onClose action - now that we have more settings and users could, in theory, lose their selections by accident, do we want to have a warning when the user cancels/clicks out of the control settings overlay like we do for adding a control? I could honestly argue both sides - pop up warnings are annoying, but are they more annoying than losing your selections? 😆 @andreadelrio thoughts?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I am more on the side of a warning, as long as it only happens if the settings have changed from the initial settings. This feels to me like an enhancement we should log!

Copy link
Copy Markdown
Contributor

@Heenawter Heenawter left a comment

Choose a reason for hiding this comment

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

One bug I found when testing.
When I turn off hierarchical chaining, when there is more than one control, only the filter for the last control seems to be applied. It works fine if I just have a control on gender, for example - but as soon as I have gender and lastName, only the lastName control will actually be applied and the gender control is ignored. Here's a video of what I'm seeing:

2022-03-23_UnableToDeleteControls2.mp4

@ThomThomson ThomThomson mentioned this pull request Mar 23, 2022
9 tasks
Copy link
Copy Markdown
Contributor

@Heenawter Heenawter left a comment

Choose a reason for hiding this comment

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

I have some confusion about what the Sync with query bar option does. Basically, assume I have a dashboard with the E-Commerce data where this option is fully turned off. I have a filter pill for gender = 'female' and I have a control for gender where male is selected. I assume this should show no data, but it doesn't? And this happens regardless of whether Validate user selections is true or not.

This is probably just my own misunderstanding, but some clarification would be appreciated 👍

@ThomThomson
Copy link
Copy Markdown
Contributor Author

Thanks for the super-thorough review Hannah! I will respond to your questions here:

  1. Case insensitivity - this unfortunately isn't as easy as a configuration setting. It's an enhancement we will need to track and log against the Options List control. Basically, there is some intersection between the type of the field, the field's analyzer, and the way that we query it which needs to be sorted out. The existing autocomplete functionality (in the filter pills and query bar) is case sensitive too, but I think we can figure out a good way to handle this specifically for the Options List.
  2. Hierarchical chaining off bug - this is a fairly sizeable issue! I know exactly what's causing it and how to fix it, and hopefully will have this fixed by tomorrow. Thank you for finding this!
  3. Sync with Query Bar: Basically with sync off, the controls should not be filtered by the dashboard query, time range, or filter pills. What you're running into here is the filter overwriting logic.
    • When sync query and validate selections are on Filters that come earlier, like your filter pill narrow down available options in controls that come later
    • Filters that come later in the chain override any earlier filters which are created using the same field.
    • So in your example, with validate user selections and sync with query bar off, the filter pill with gender = ' female' is being overwritten with the control selection gender = 'male'. So only documents relating to male should be shown in the dashboard.

@Heenawter
Copy link
Copy Markdown
Contributor

  1. Case insensitivity - this unfortunately isn't as easy as a configuration setting. It's an enhancement we will need to track and log against the Options List control. Basically, there is some intersection between the type of the field, the field's analyzer, and the way that we query it which needs to be sorted out. The existing autocomplete functionality (in the filter pills and query bar) is case sensitive too, but I think we can figure out a good way to handle this specifically for the Options List.

Ahhh, that makes sense! Definitely think it's worth addressing this in the future, but seems like it's not worth it right away 👍

  1. Hierarchical chaining off bug - this is a fairly sizeable issue! I know exactly what's causing it and how to fix it, and hopefully will have this fixed by tomorrow. Thank you for finding this!

Perfect!! 😄 I'll approve once that is all fixed - I played around quite a bit with the settings, and wasn't able to find any other blockers and/or bugs.

  1. Sync with Query Bar: Basically with sync off, the controls should not be filtered by the dashboard query, time range, or filter pills. What you're running into here is the filter overwriting logic.

Gotchya, gotchya. That makes a lot more sense, thanks - I felt like I was going crazy, hah 😄

Copy link
Copy Markdown
Contributor

@crob611 crob611 left a comment

Choose a reason for hiding this comment

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

Looks good to me.

@kibana-ci
Copy link
Copy Markdown

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
controls 143 145 +2

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
controls 124 127 +3
embeddable 384 385 +1
total +4

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
controls 399.3KB 403.4KB +4.1KB
dashboard 294.8KB 294.8KB +18.0B
total +4.1KB

Public APIs missing exports

Total count of every type that is part of your API that should be exported but is not. This will cause broken links in the API documentation system. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats exports for more detailed information.

id before after diff
dashboard 15 14 -1
embeddable 5 4 -1
total -2

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
controls 21.4KB 23.4KB +2.0KB
dashboard 66.5KB 66.7KB +215.0B
total +2.2KB

Saved Objects .kibana field count

Every field in each saved object type adds overhead to Elasticsearch. Kibana needs to keep the total field count below Elasticsearch's default limit of 1000 fields. Only specify field mappings for the fields you wish to search on or query. See https://www.elastic.co/guide/en/kibana/master/development-plugin-saved-objects.html#_mappings

id before after diff
dashboard 20 22 +2
Unknown metric groups

API count

id before after diff
controls 130 133 +3
embeddable 471 474 +3
total +6

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@ThomThomson ThomThomson merged commit 82d4cd5 into elastic:main Mar 23, 2022
@ThomThomson ThomThomson added v8.2.0 backport:skip This PR does not require backporting and removed backport:skip This PR does not require backporting v8.3.0 labels Mar 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting Feature:Dashboard Dashboard related features Feature:Embedding Embedding content via iFrame Feature:Input Control Input controls visualization impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. loe:large Large Level of Effort Project:Controls release_note:feature Makes this part of the condensed release notes Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas t// v8.2.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Dashboard][Controls] Allow Configuration of Hierarchical Chaining [Dashboard][Controls] Allow Configuration of Ignore Settings

7 participants