-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Add time navigation buttons #9253
Conversation
Update with new styles from navbar in ui framework
…that had side effects
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
jenkins, test this |
@cjcenizal @alt74 Thoughts? I'm happy to re-add this if it's what we want :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks awesome man! I had one small request and a few suggestions.
border-radius: 0; | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yessss!
const {from, to} = timeNavigation.stepForward(bounds); | ||
expect(from).to.be('2016-01-01T00:15:00.000Z'); | ||
expect(to).to.be('2016-01-01T00:30:00.000Z'); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I read this it took me a few seconds to figure out the meaning of this test, i.e. how much time is being stepped. Can we change the description to read: should step forward by the amount of the duration
?
expect(to).to.be('2016-01-01T00:30:00.000Z'); | ||
}); | ||
|
||
it('should step backward', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And here: should step backward by the amount of the duration
expect(to).to.be('2016-01-01T00:00:00.000Z'); | ||
}); | ||
|
||
it('should zoom out', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should zoom out to be double the original duration
expect(to).to.be('2016-01-01T00:22:30.000Z'); | ||
}); | ||
|
||
it('should zoom in', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should zoom in to be half the original duration
@@ -21,6 +21,18 @@ | |||
</span> | |||
</div> | |||
|
|||
<div class="localMenuItem" ng-click="zoomIn()"> | |||
<i class="fa fa-search-plus ng-scope" tooltip="Zoom in"></i> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of using the <i>
element, can we use <span>
everywhere here? It's more semantic markup.
// zoom in, halving the difference between start and end, keeping the same time range center | ||
$scope.zoomIn = function () { | ||
assign(timefilter.time, timeNavigation.zoomIn(timefilter.getBounds())); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️ these comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But I think they might be better placed in time_navigation.js
, because then they'll be near the logic, which is the part that really needs explaining.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 All good feedback. Thanks!
import chromeNavControlsRegistry from 'ui/registry/chrome_nav_controls'; | ||
import { once, clone } from 'lodash'; | ||
import { once, clone, assign } from 'lodash'; | ||
import dateMath from '@elastic/datemath'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this isn't being used here?
Ping: @uboness for his thoughts on this |
@cjcenizal I've made the suggested changes. |
LGTM One question, To reproduce: I've not tested this with these new changes and perhaps a recent change in timepicker has solved this. |
this failure is due to failing tag cloud test. https://kibana-ci.elastic.co/job/elastic+kibana+pull-request+multijob-intake/2272/console I'm looking into it. They fail intermittently, about 1/5 times. |
Design wise... I'm not a big fan of the zoom in/out buttons... This functionality should be in the chart itself (we'll be educating the wrong ux). It is not an obvious feature. What are you zooming exactly? Think a dashboard with a map and a histogram. I'd also like to change the surrounding arrows to something more subtle (< and >?) |
The aim is purely to zoom in and out in time. As the time picker is global for the page, then it does not seem unintuitive that the functionality sits with the time picker control in the top nav, rather than in a chart panel. (double negative intended). We have found the ability to navigate easily by time, to be hugely useful when exploring data around the occurrence of anomalies. For our use case with time series data, then navigating left, right, in and out were all equally used. Did you mean that the choice of the magnifying glass as an icon is educating the wrong UX? Or is it the whole concept of zooming in and out by time? |
Zoom is generally not associated with Zooming in time". The timepicker is a generic component that is used in many places. There can be a dashboard where the top most viz is a map. Then this will be misleading. It's not obvious at all that the zoom buttons only relate to the time picker. Definitely in the current design (it's not obvious to me at this point how to do it, if at all... Requires some thinking) |
I have nothing against zooming in time... I just think it needs to be at the right place |
I think part of the problem may also be that "zooming" could be the wrong metaphor for what we're really doing (changing the time range to be large or small). I pored over FontAwesome and found some alternative icons to support different metaphors. What do you think of these, @uboness and @sophiec20 ? HourglassThis uses the idea of time, and having more of it or less of it. or Plus / minusThe problem with the current icons is that the magnifying glass conveys the idea of search. By removing that, we're left with a plus and minus. It's possible this could be confused with "adding" and "removing", though. Expand / contractThis is the idea of expanding and contracting the range of time. We would need someone to build the contract icon to complete this option. Expand / contract (abstract)Same idea, but using a circle that will shrink or grow. We need someone to build both of these icons to complete this option. I think the contract icon can be a bold dot inside of a thin outline. For the expand icon, I'm imagining a lighter "thin" dot inside of a bolder outline. Reference: |
Sorry... None of these options tells me "zoom in/out time"... I don't think buttons/icons is the right ux here... an obvious UI for such a thing is a timeline slider where you select the window of the time to zoom to. Are there any other similar UIs that anyone looked at with similar requirements? Can we take this functionality out of this pr and let this one only focus on the time navigation (earlier/later buttons)? Can we put a proper design for these navigation buttons (the current one doesn't look good). I don't want our discussion around the zoom functionality to put navigation on hold |
@uboness Okay, I've removed that functionality. |
I think that if you have zoomin/out icons IN the timepicker, it SHOULD be clear that you are zooming in/out on a time (not on a map). The term "to zoom in" is often used with charts (point series and the likes) to indicate zooming on a time range. Some examples: And the standard magnifying glass icon with +/- is used often for this use case: I would say that the most common way to show this kind of controls (in popular software) is by +/- magnifying glass icon, so this is something users would be used to (they did charts in excel before or matlab or ... ). The other ways:
+1 on making it visually more obvious the controls are part of timepicker |
@lukasolson thx! Next... Let's fix the arrows @ppisljar sure... But it only works if you put the controls on the chart... Cause it automatically gives you the context for what you're zooming in/out. Putting these control on the dashboard level make little sense. Sure... We can think about other ways to put them in the timepicker such that it'll be obvious that they belong together... But it's not yet obvious to me how best to do that without making the timepicker even more complex control (we're in the process of cleaning it design-wise so we can consider this along the way). I still think the best way to zoom in/out is to have a timeline control on the dashboard.. But we're not there yet). |
Only now getting to this review, so I'll respond with my thoughts on the discussion above:
So I guess, TLDR -- if we don't tackle zoom in/out as part of this, LGTM after we figure out point (3). |
@tbragin I don't think my original message was very clear, sorry. |
@uboness I've updated the icons: @jgowdyelastic If I set the mode to absolute, it can be kind of jarring from the user experience because the tab automatically switches from whatever they were previously on (quick/relative). Also, even if I don't change the mode when they step forward/backward, even though the mode is still quick/relative and the to/from values are absolute, it all seems to function properly. (Did you notice a situation when it wasn't?) |
@lukasolson I've not had the chance to test this new implementation, so I'm going on how the original prelert version behaved. |
I'm all for not blocking the other useful stuff in this PR on zoom in/out since that fell into contention, but not having zoom in/out is really disappointing. I hope there are plans in the discovery group to follow up on that feature once this PR goes in. If Kibana doesn't have support for zoom in/out, then plugins like prelert are going to continue to have to hack that feature together on top of the existing timepicker. Any time-based log context feature would also most likely be blocked on this as well. Kibana really should have an ability to zoom in and out on the current global time interval. @lukasolson Can you create a new issue for the time interval zoom behavior so we can stop littering this PR with that discussion. |
* Add time navigation buttons * changing vars to const * Address some review points * fixing typo in function name * Remove unused variables * [timepicker] Simplify zoom in/out and forward/back and remove getter that had side effects * [timepicker] Move time navigation calculations to own class and write test * [timepicker] Remove unused styling and classes * [timepicker] Change from i to span, add more explanatory comments * [timepicker] Remove unused variable * Remove zoom in/out buttons from timepicker nav * Change step forward/back timepicker nav button icons
Backported to 5.x in 33d23d0. |
Replaces #8546.
Closes #1956.
This PR adds navigation buttons surrounding the time picker. The buttons are zoom in/out and step backward/forward.
Zooming in cuts the current interval in half (but keeping the same center point). Zooming out similarly doubles the current interval (keeping the same center point). Stepping backwards keeps the current interval but moves it backwards one interval, and stepping forward keeps the current interval but moves it forward one interval.
This PR replaces #8546 and merges with master, fixes styling issues, moves the calculations into a separate file and adds tests for it.