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

Show/hide date histogram viz in Discover #17065

Closed

Conversation

ycombinator
Copy link
Contributor

@ycombinator ycombinator commented Mar 9, 2018

Resolves #6164.

This PR introduces an Advanced Settings option to show/hide the date histogram visualization in Discover.

The option is named discover:showDateHistogramVisualization. It is a boolean option that defaults to true. Setting it to false removes the aggs part of the _msearch request that is made by Discover and hides the time chart panel in Discover.

Default behavior

When discover:showDateHistogramVisualization is set to true. _msearch request contains aggs and the visualization is shown in Discover.

default

Disabled behavior

When discover:showDateHistogramVisualization is set to false. _msearch request does not contain aggs and the visualization is not shown in Discover.

new

@ycombinator ycombinator changed the title Add Advanced Settings option to show/hide date histogram viz in Discover Show/hide date histogram viz in Discover via Advanced Setting Mar 9, 2018
@elasticmachine
Copy link
Contributor

💔 Build Failed

@ycombinator ycombinator force-pushed the enhancement/discovery/hide-chart branch from 4fbb877 to e5a13a9 Compare March 9, 2018 16:39
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Copy link
Member

@lukasolson lukasolson left a comment

Choose a reason for hiding this comment

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

I'm all for allowing the user the flexibility to remove the histogram, but I think a better way to do this that is more in line with how we are already doing things like this is similar to how you can collapse the sidebar and hide the fields list:

mar-09-2018 13-17-36

Long term, we'd like the ability for Discover to be more customizable and allow any of the components to be removed and others to be added. I think what I've explained above is a better short-term solution than adding an advanced setting that we will likely remove in the future.

@ycombinator
Copy link
Contributor Author

Thanks for the feedback @lukasolson. I considered your suggestion as well and I'm ++ for it. It definitely feels more "natural" as a user (than having to edit an Advanced Setting, which would also have the effect of being applicable to all users on that Kibana instance).

There's just one UX issue that I couldn't reason out which is why I went the Advanced Setting route: if we introduce a toggle in the Discover UI itself, where would you store its state? Would it be per user session (i.e. using something like sessionStorage)? Or would you prefer per browser (i.e. using localStorage) so it persists even if the same browser is reopened? Or were you thinking something else?

I'm also completely okay just abandoning this PR altogether if there's a longer-term plan for Discover that would make this functionality moot.

@Bargs
Copy link
Contributor

Bargs commented Mar 12, 2018

Do we have a good sense of why people are requesting this feature? I know some folks want to get rid of it because the date histogram can be slow, but the ES team is working on this. Is there any other reason why an admin would want to disable the histogram on a system wide level?

If some folks simply find the histogram annoying and want to regain the real estate it takes up, I think localstorage would be fine, similar to the left nav's collapse/expand.

@gsemet
Copy link

gsemet commented Mar 13, 2018

Hello. Please expose this ability by an URL parameter. That is enough for me

@ycombinator
Copy link
Contributor Author

Based on the above feedback (thanks for giving it!) and chatting with @Bargs off-PR, I'm thinking of changing this PR to:

  • provide an expand/collapse toggle in the UI (per @lukasolson's suggestion)
  • maintain the toggle state in appState (@Bargs suggestion off-PR), which gets serialized in the URL (satisfying @gsemet's request).

@LeeDr
Copy link

LeeDr commented Mar 29, 2018

I just did a little experiment to try to achieve this without any code changes. I just created a similar index pattern for my logstash data but selected I don't want to use a time filter. So now in Discover I can toggle between the 2 index patterns. One has the histogram and the other doesn't. But the one that doesn't have the time field also doesn't have the time picker so you just get the first 500 docs and would have to manually filter on whatever time you wanted to see. Not great, but could be a work-around for someone until this gets implemented and released.

…very

The option is named `discover:showDateHistogramVisualization`. It is a boolean option that defaults to `true`. Setting it to `false` removes the `aggs` part of the `_msearch` request that is made by Discover and hides the time chart panel in Discover.
@ycombinator ycombinator force-pushed the enhancement/discovery/hide-chart branch from e5a13a9 to 9d5aea8 Compare April 20, 2018 17:01
@elasticmachine
Copy link
Contributor

💔 Build Failed

@ycombinator
Copy link
Contributor Author

@lukasolson @Bargs @gsemet I've updated this PR per #17065 (comment):

discover_viz_toggle

The gif doesn't show it but if you pull down this PR and try it out yourself you'll see that showViz is also changing in the app state encoded in the URL.

Once ya'll are happy with the implementation, I'll add functional tests to this PR.

@gsemet
Copy link

gsemet commented Apr 20, 2018

Looks amazing :)

@ycombinator ycombinator changed the title Show/hide date histogram viz in Discover via Advanced Setting Show/hide date histogram viz in Discover Apr 20, 2018
@elasticmachine
Copy link
Contributor

💔 Build Failed

@lukasolson
Copy link
Member

@snide Any feedback here on the UI?

@snide
Copy link
Contributor

snide commented Apr 23, 2018

It's fine. I can clean it up separately. But for now it's similar and works!

Copy link
Member

@lukasolson lukasolson left a comment

Choose a reason for hiding this comment

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

Noticed some funky behavior...

  1. Hide the viz
  2. Refresh
  3. Try to show the viz (it only shows part of it)

apr-23-2018 14-46-02

Also, I was thinking, with this change we would have three different portions of the UI you can show/hide: The global nav, which is stored in local storage (kibana.isGlobalNavOpen), show/hide the viz, which is stored in the app state, and show/hide the field list, which isn't stored anywhere. Not sure how we should reconcile this, but wanted to open the dialog.

Copy link
Member

@lukasolson lukasolson left a comment

Choose a reason for hiding this comment

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

I'll leave my general feedback here: Personally I think it'd be nice if showViz were stored in local storage because every time you load up discover, you're going to get that viz at first until you hide it, which might be okay but I wonder if some people just don't ever want to see it there and will be annoyed that they have to hide it every time they reload discover, or load a new saved search, etc.

That being said, what we've got here is definitely an improvement and I don't want to block it from moving forward, and we can have the discussion at a later time.

@ycombinator
Copy link
Contributor Author

@lukasolson the reason this ended up as a URL parameter was because @gsemet requested it. But your point about the initial state of Discover is a good one. @gsemet, would it work for you if we stored the state in local storage instead of the URL?

@elasticmachine
Copy link
Contributor

💔 Build Failed

Copy link
Contributor

@Bargs Bargs left a comment

Choose a reason for hiding this comment

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

One largish question: If the visualization is hidden, should we remove the agg from the search request? Some users definitely want to get rid of the date histogram because it can slow Discover down. It would complicate the code slightly because we'd need to re-fetch when the viz is made visible, but it might be worth it to improve the user experience.

@@ -139,6 +146,13 @@ <h2>Searching</h2>
style="height: 200px"
>
</visualization>

<div>
<center class="small">
Copy link
Contributor

Choose a reason for hiding this comment

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

center is a deprecated html tag. I'm guessing you're using it because it's already used in the vis header. Since it's only used in those two places, I think it's worth fixing. It looks like they both only contain inline elements, so you should be able to just change it to a div and add text-align:center;

@@ -292,6 +293,8 @@ function discoverController(
$state.save();
});

$scope.$watch('state.isVisualizationVisible', $state.save.bind($state));
Copy link
Contributor

Choose a reason for hiding this comment

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

Couldn't this go in the showVis and hideVis methods? Then we wouldn't have to create an additional watch.

@ycombinator
Copy link
Contributor Author

One largish question: If the visualization is hidden, should we remove the agg from the search request? Some users definitely want to get rid of the date histogram because it can slow Discover down. It would complicate the code slightly because we'd need to re-fetch when the viz is made visible, but it might be worth it to improve the user experience.

Yup, this is worth doing. I'll look into it.

@rashmivkulkarni
Copy link
Contributor

@ycombinator - FF for 6.3.2 is tomorrow ( July 17) and this has been labelled for 6.3.2 ...Do you think we should remove the label and assign appropriately? Thanks.

@LeeDr LeeDr added v6.5.0 and removed v6.4.0 labels Jul 25, 2018
@snide snide added v7.0.1 and removed v7.0.0 labels Apr 10, 2019
@rayafratkina rayafratkina added Feature:Discover Discover Application Team:Visualizations Visualization editors, elastic-charts and infrastructure and removed Feature:Discovery v7.0.1 labels Jun 14, 2019
@spalger spalger added the test-matrix Use this label to ensure PRs are tested with matrix jobs label Sep 19, 2019
@spalger
Copy link
Contributor

spalger commented Sep 19, 2019

This PR doesn't contain code necessary for it to run on CI with Jenkins pipelines, please merge the base branch in before removing the test-matrix label.

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@LeeDr
Copy link

LeeDr commented Sep 19, 2019

@ycombinator if I open Discover and initially have the histogram, then I click to hide it. I would assume this would NOT re-query at this time because it's not going to change the data the user sees?

And of course going the other way to WOULD re-query automatically.

@ycombinator
Copy link
Contributor Author

@LeeDr I'm honestly not sure any more. This PR is over 18 months old. I'm tempted to just close it unmerged and let someone better-versed than me in the Kibana codebase today find a solution. Thoughts?

@lukasolson
Copy link
Member

Closing for inactivity.

@lukasolson lukasolson closed this Mar 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Discover Discover Application release_note:enhancement review Team:Visualizations Visualization editors, elastic-charts and infrastructure test-matrix Use this label to ensure PRs are tested with matrix jobs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Hide histogram on Discover page