elastic / kibana

Your window into the Elastic Stack
https://www.elastic.co/products/kibana
Other
19.5k stars 8.06k forks source link

[Logs Explorer] Align histogram filter behaviour with Discover #178552

Open thomheymann opened 4 months ago

thomheymann commented 4 months ago

Follow up to https://github.com/elastic/kibana/issues/175323

Description of the problem including expected versus actual behavior:

:lady_beetle: Problem description

When clicking on a value in the histogram it automatically applies both a time filter and value filter:

Screenshot 2024-03-12 at 18 03 55

Expected Behavior:

1. Instead of automatically applying both filters the app should show a popover asking which values to filter for

See behaviour in Discover:

Screenshot 2024-03-12 at 17 47 59

2. Time fields should be applied as a time filter instead of a filter in the filter bar

Should have updated time range picker instead of adding a filter:

Screenshot 2024-03-12 at 18 03 55

:female_detective: Possible approaches

The logic that defined this behaviour is inherited from the Lens embeddable / Unified Search (specifically part of the convoluted set of UI action interactions I outlined earlier in the thread), which puts us in a similar situation as you in that we don’t have control over it or which services it uses (it always uses the global filter manager).

The logic lives here: https://github.com/elastic/kibana/blob/67db684deb1acc4930ce4ce3deba3d7db56522e0/src/plugins/unified_search/public/actions/apply_filter_action.ts#L38-L124

There are two possible ways to address this:

  1. figure out a way to have UI actions use scoped services (I’m guessing this would be hard but I don’t have a lot of experience here)
  2. extract createFilterAction into a reusable function and consume it from the Unified Histogram customization using scoped services (probably the easier approach and still addresses the code duplication concern, although it sidesteps the UI actions framework entirely)
elasticmachine commented 4 months ago

Pinging @elastic/obs-ux-logs-team (Team:obs-ux-logs)