Repository navigation
Add "use time filter" option to input controls - #15852
Conversation
There was a problem hiding this comment.
Instead of using JSON.stringify to determine if the time filter's changed, can we use _.clone and _.isEqual instead?
There was a problem hiding this comment.
Are we going to miss potential new items when using a relative time range, as the this.vis.API.timeFilter.time will be equal, but the underlying data ranges will differ?
There was a problem hiding this comment.
Right now there is no way knowing if the render method is getting called because the timefilter updated. I thought comparing the time would work but you are right that when data is fetched for a relative time range then this strategy breaks down. Any ideas on how to handle relative dates?
There was a problem hiding this comment.
What's the downside to rendering every-time render is called? Does this cause the data to be fetched again, and we're trying to prevent this when it's unnecessary?
There was a problem hiding this comment.
exactly. Each time the component is drawn, then the terms agg or min/max agg will be required.
There was a problem hiding this comment.
timefilter has a getBounds method call. I can just watch the results of that instead. Also, I am going to move that logic into https://github.com/elastic/kibana/blob/master/src/ui/public/vis/update_status.js. That way the status parameter will just contain a time key that will be set to true or false.
There was a problem hiding this comment.
I think we should rely on Elasticsearch to cache what it can and make our requests as fast as possible. Trying to dedupe things client side (especially per visualization) seems like it will be very tricky to get right in all scenarios if not impossible.
There was a problem hiding this comment.
I think we should rely on Elasticsearch to cache what it can and make our requests as fast as possible. Trying to dedupe things client side (especially per visualization) seems like it will be very tricky to get right in all scenarios if not impossible.
Agreed. I'm not aware of us doing this for other visualizations, was there a specific reason why Input Controls should be the exception to this @nreese?
There was a problem hiding this comment.
Other visualizations do have custom logic to render under certain conditions. Visualizations are passed a status object to know why render is getting called. For example, the map visualization does different things based on the contents of status.
I created a new PR that adds time to the status object so all time change logic can be removed from vis_controller.js
|
@kobelb I removed the time checking logic since it's now provided by the |
|
@nreese when I add the input control that uses the timefilter to a Dashboard, I'm still seeing it hit the early return when subsequently searching, this is going to cause the user to not see "new" values show up in the input control. |
|
@nreese I stand corrected, LGTM |
thomasneirynck
left a comment
There was a problem hiding this comment.
lgtm.
I'd consider explaining the option better, either with a longer label or info-hover over. I'm not sure "use time filter" will make sense to a user without context.
|
@thomasneirynck I think you are right that an info description is needed for better explanation. This visualization is all react based so I can not use the angular |
* add useTimeFilter parameter to Controls visualization * fix broken jest test * add functional tests for useTimeFilter * remove wrong comment * use _.clone and _.isEqual for time comparision * do not track time changes in vis_controller - use status.time instead
|
@thomasneirynck Issue #16072 created to track |
* add useTimeFilter parameter to Controls visualization * fix broken jest test * add functional tests for useTimeFilter * remove wrong comment * use _.clone and _.isEqual for time comparision * do not track time changes in vis_controller - use status.time instead
|
@nreese. Playing around with this feature, when enabled, it looks like it causes the visualization to pickup more than just the time to determine the list of items displayed. It also restricts the list by all of the global filters. This is not necessarily a bad thing. In fact I find it useful as it behaves like https://github.com/robcowart/kibana-vis-dropdown. I do however wish that I could set this on a per element basis. Consider this... I have a dropdown with for Hosts(A) and a dropdown for Interfaces(B). If I could set A to ignore the global filter it would give me a list of all hosts. When I pick a host in A it would set a global filter for the host. If B is set with to respect the global filter, it would now contain a list of interfaces only from the host selected in A. As you can see from the screenshots, I tried to achieve this by creating two separate input control visualizations. One for Nodes, one for Interfaces. However in practice this doesn't work because the visualizations will overwrite each other's filter. So to achieve such dependency-based input controls, either...
|
|
Yes, the implementation in 6.2 is broken and picks up all global attributes. This has been fixed in 6.3, and now only the time filter is added instead of just inheriting from the root search source. The bug was fixed when refactoring for nested input controls #16407. Maybe nested input controls solve your other problems as well? |
|
Got it. Of course that begs the follow on question. Is there an issue open to optionally allow an element to apply the global filter? As I mention this could make possible dependent elements as I show above. This feature is listed in #13911, but I don't see an issue open for it. |
|
That isn't the same thing and doesn't achieve dependency between two input control elements. The Kibana Advanced Setting |
* add useTimeFilter parameter to Controls visualization * fix broken jest test * add functional tests for useTimeFilter * remove wrong comment * use _.clone and _.isEqual for time comparision * do not track time changes in vis_controller - use status.time instead
partial fix for #14659
Add
use time filteroption to input controls. When set to true, Controls will use the global time when fetching terms and min/max values.