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

[Logs UI] Allow for jumping to the previous and next highlight #40010

Merged
merged 61 commits into from
Jul 24, 2019

Conversation

Kerry350
Copy link
Contributor

@Kerry350 Kerry350 commented Jul 1, 2019

Summary

This PR adds buttons to the highlighting popover that allow for jumping to the previous and next highlights. The intended user experience should be close to the "find" experience of many text editors.

Preview

grafik

Known Limitations

Checklist

Kerry350 and others added 30 commits June 25, 2019 12:12
* Show a highlight is active
* Focus input when menu is opened
* Icon for highlights menu
* Debounce onChange handler
* Loading state for highlights menu
* Neaten up Provider
* Breathing room for icon
* Better debounce time for typing
* Ensure width of popover stays consistent
* Add a button to clear highlights
While a `phrase_prefix` query feels more natural, it doesn't work on
`keyword` type fields. Using just a `phrase` query keeps the
highlighting consistent between text and keyword type fields.
@jasonrhodes
Copy link
Member

This would mean to just close this PR without merging... could have saved us a lot of work if we determined this to be a deal-breaker for the feature during the mockup phase.

I want to be careful of sunk cost thinking getting in the way of our decision making, but this is fair and would obviously be frustrating. Looking back at #22916, I admit I didn't have a full sense of how this worked outside of "search for term, instances are highlighted", which also happens to sound like a pretty good first iteration of the feature. I'll try to be better about asking for clarification earlier. 👍

With that in mind, what do we think are the minimum set of features that make highlighting useful in the log UI today? That way we can focus on those and then regroup to think about all of the various coloring issues as a whole. If we think next/prev is on that list, then I'm in favor of "showing the currently highlighted entry slightly differently for now".

Related: the HSL modification of the highlight color already gives it some contrast problems, especially in dark mode:

Screen Shot 2019-07-16 at 10 23 55

The brighter color here is the full EUI accent color, and the more muted version has been HSL-desaturated, etc. to make it less intense based on earlier design feedback. If we revert the standard highlight color back to the full EUI accent color, and then drop the opacity of the others, that might solve all of these issues in one swoop. (Q: Would we immediately enter into this state as soon as you highlight a term, where the "active" one is highlighted differently? Or would it only go into that state when you interact with next/prev?)

@weltenwort
Copy link
Member

I want to be careful of sunk cost thinking getting in the way of our decision making

totally agree, thanks for calling me out on that 😉

Maybe the highlighted terms would only be outlines except for the active one, which would have a filled background? Then we wouldn't have to deal with multiple hues and can just pick one with a good readability.

@Kerry350 Kerry350 requested a review from a team as a code owner July 18, 2019 12:27
@elasticmachine
Copy link
Contributor

💔 Build Failed

@weltenwort
Copy link
Member

weltenwort commented Jul 18, 2019

@jasonrhodes @Kerry350 I'm trying to color the currently active highlight differently... the color and contrast fiddling is tying my brain into a knot - this is what I have:

grafik

grafik

(I'm not a fan of the pink accent TBH, but that's what EUI uses 🤷‍♂️)

It's based on the accent color with a bit of tintOrShade for inactive highlights while trying to choose the correct text color based on the theme. What do you think?

@jasonrhodes
Copy link
Member

@weltenwort phew, contrast math mania! I like how it looks, I'm going to test out how it works right now but it looks like it'll be much clearer. 👏

Could we just opt for hard-coding the text-color values and assume that we will have a bright color for the active and a duller one for the inactive, so we'll always need the opposite text color? I can imagine those brain knots you mention coming up again and again if we ever need to see what this is flow is doing and I'd prefer to see if we can start simple.

@weltenwort
Copy link
Member

I introduced utils like chooseLightOrDarkColor now, so it hopefully will be easier in the future. As we have discussed, the whole hover/highlight/color thing will hopefully be straightened out soon across the Logs UI.

Let me know if it looks ok for you. I'm taking a look at the failing test in the meantime.

@jasonrhodes
Copy link
Member

Let me know if it looks ok for you. I'm taking a look at the failing test in the meantime.

Much clearer what's going on now, good change 👍

Copy link
Member

@jasonrhodes jasonrhodes left a comment

Choose a reason for hiding this comment

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

Let's keep an eye on the usage of the color/lightness utility and if we are able to solve colors in the Logs UI without needing those kinds of utils, let's just remember to retire it rather than leave it to use "one day". Hopefully those kinds of utils, if needed, will come from EUI eventually.

This looks great, and the active color looks good in light and dark modes. Thanks @Kerry350 and @weltenwort !

@weltenwort
Copy link
Member

weltenwort commented Jul 19, 2019

Just added the same effect to the "field" type column too.

I can't reproduce the previous test failures locally... let's see if try occur again.

@jasonrhodes
Copy link
Member

🤞

@elasticmachine
Copy link
Contributor

💔 Build Failed

@weltenwort
Copy link
Member

I can only reproduce this failure on the pinned Elasticsearch snapshot Kibana CI currently uses. On more recent snapshots this failure doesn't occur. The pinning of the version is tracked in #41538.

@weltenwort
Copy link
Member

weltenwort commented Jul 19, 2019

Some more background: The error suggests the multi_match queries are rewritten to dis_max queries with more than the 1024 clauses allowed by default. My investigations lead me to expect an expansion to 587 clauses in these tests, which is well within that limit. I suspect there was an intermittent problem in Elasticsearch or lucene which caused this incorrect rewriting to take place and which has since been fixed.

@weltenwort
Copy link
Member

bonus background: My hypothesis about the sudden appearance and disappearance of this test failure is that apache/lucene-solr@57eb779 seems to have introduced a rewriting step that flattens nested bool queries. This could the clause count of the flattened query to exceed the max_clause_count limit, even if the original nested clauses didn't. The unintended side-effect of the optimization was later mitigated in apache/lucene-solr@8739d5e, which was pulled into Elasticsearch via elastic/elasticsearch#44476.

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@weltenwort weltenwort merged commit 5e26720 into elastic:master Jul 24, 2019
weltenwort pushed a commit to weltenwort/kibana that referenced this pull request Jul 24, 2019
…ic#40010)

This PR adds buttons to the highlighting popover that allow for jumping to the previous and next highlights. The intended user experience should be close to the "find" experience of many text editors.
weltenwort added a commit that referenced this pull request Jul 24, 2019
Backports the following commits to 7.x:
 - [Logs UI] Allow for jumping to the previous and next highlight (#40010)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Logs UI Logs UI feature release_note:enhancement review Team:Infra Monitoring UI - DEPRECATED DEPRECATED - Label for the Infra Monitoring UI team. Use Team:obs-ux-infra_services v7.4.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants