-
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 #8546
Conversation
jenkins, test this |
@jgowdyelastic Can you reissue this PR against master? We'll then backport it to 5.x. |
b01b1aa
to
c591bd7
Compare
Done, rebased on master and PR is now against master. |
@jgowdyelastic Thanks! |
|
||
// travel forward in time based on the interval between from and to | ||
$scope.foward = function () { | ||
var time = getFromTo(); |
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 should all be const
unless you will be overriding the reference, in which case they would be let
.
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.
ok, good point. i've pushed a change for this.
This was just copied from the kibana 4.x prelert app, which doesn't have much ES6 syntax.
Please add automated and/or manual tests for this new feature. |
Just letting you folks @jgowdyelastic is on vacation, back on Tuesday 11th. He is not ignoring you all. |
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 great! I like the addition. It is very useful addition I think.
I only have some real minor cosmetic things.
@@ -2,6 +2,7 @@ import moment from 'moment'; | |||
import UiModules from 'ui/modules'; | |||
import chromeNavControlsRegistry from 'ui/registry/chrome_nav_controls'; |
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.
this import is obsolete. linter was also complaining about unused function arguments in this file as well: config
, newval
, oldVal
, $el
, attrs
While we're at it, we may as well remove them ;)
|
||
time.from.subtract(diff, 'milliseconds'); | ||
timefilter.time.to = origFrom; | ||
timefilter.time.from = time.from.toISOString(); |
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.
minor: consider reordering the to/from assignments for symmetry with all the others.
@@ -25,6 +26,73 @@ UiModules | |||
$rootScope.toggleRefresh = () => { | |||
timefilter.refreshInterval.pause = !timefilter.refreshInterval.pause; | |||
}; | |||
|
|||
// functions for the time navigation buttons |
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.
minor: consider removing this comment, I think the code is nice & dense enough to be self explanatory.
from: moment(timefilter.time.from) | ||
}; | ||
} else { | ||
timefilter.time.mode = 'absolute'; |
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.
minor: consider not doing the side-effect in this getter/setter. If you prefer to avoid two function-calls, perhaps rename this function to something like setToTimeToAbsoluteAndGetToFrom
(yeah, i know :$). But now, this state change is a little buried.
@@ -20,6 +20,9 @@ | |||
</li> | |||
|
|||
<li> | |||
<i ng-click="zoomIn()" class="time-nav-btn fa fa-search-plus ng-scope"></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.
minor: I wouldn't mind tooltips on these buttons actually. 'move [forward|backward] in time', 'zoom out timeline', 'zoom in timeline'
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.
tooltips added
@@ -28,5 +31,6 @@ | |||
<i aria-hidden="true" class="fa fa-clock-o"></i> | |||
<pretty-duration from="timefilter.time.from" to="timefilter.time.to"></pretty-duration> | |||
</button> | |||
<i ng-click="foward()" class="time-nav-btn fa fa-arrow-right ng-scope"></i> | |||
</li> | |||
</ul> |
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.
sorry to hijack this PR for something a little broader ;)
With the 4 new additions, the top toolbar now looks like the above. From a UI perspective, would it make sense to better isolate the timepicker tools from the "new/save/open/share" buttons. Both are unrelated thematically. Putting a divisor in between/shading background differently/ .... might make the grouping a little clearer. @alt74, @cjcenizal, thoughts (?)
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.
I think that, ultimately, we should rebuild the timepicker component so that these arrow buttons are part of the dropdown that appears when you click the time range. I don't think the user needs to have them visible at all times. However, this will take some time to implement, and I don't think we should hold up this PR for that.
I think the immediate problem is that the "back" arrow blends in with the + and - icons. We can create the separation you mention by moving them both to the right side, and letting the time range itself create visual separation:
As an additional benefit, the user doesn't need to move the mouse as far when navigating back and forward in succession.
What do you think?
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.
I agree that the timepicker controls should be obviously separate from the rest of the menu.
I've added a separator as I think it's the simplest and less intrusive solution.
I prefer the arrow buttons being either side of the date range as it's obvious that you'll be moving either side of the displayed range.
But it doesn't make too much difference either way. So I'm happy to be overridden.
Ultimately I think these controls should remain in the navigation bar and not inside the dropdown. They provide a fast way of navigating through time and made a noticeable difference when we originally added them to the Prelert app.
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.
I think this looks good. I'm not 100% confident about it but that's because I haven't used it as much as you have. Once I've had the chance to use it for awhile I'm sure I'll either be on board or be able to provide some better suggestions. :)
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.
IMHO, the arrows work better on either side of the range, for the reasons mentioned by @jgowdyelastic
@@ -232,6 +232,11 @@ a { | |||
background-color: transparent; | |||
border-radius: 0; | |||
} | |||
|
|||
i.time-nav-btn { |
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.
This can just be .time-nav-btn
because using the element selector increases the selector's specificity unnecessarily.
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.
agreed. element selector removed
@@ -28,5 +31,6 @@ | |||
<i aria-hidden="true" class="fa fa-clock-o"></i> | |||
<pretty-duration from="timefilter.time.from" to="timefilter.time.to"></pretty-duration> | |||
</button> | |||
<i ng-click="foward()" class="time-nav-btn fa fa-arrow-right ng-scope"></i> | |||
</li> | |||
</ul> |
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.
I think that, ultimately, we should rebuild the timepicker component so that these arrow buttons are part of the dropdown that appears when you click the time range. I don't think the user needs to have them visible at all times. However, this will take some time to implement, and I don't think we should hold up this PR for that.
I think the immediate problem is that the "back" arrow blends in with the + and - icons. We can create the separation you mention by moving them both to the right side, and letting the time range itself create visual separation:
As an additional benefit, the user doesn't need to move the mouse as far when navigating back and forward in succession.
What do you think?
254c731
to
2f7f251
Compare
Could I ask for some screenshots or a quick animated gif in this PR? Will help reviewers that don't have time to check it out to at least have an idea where in the interface these new buttons are. |
@@ -218,6 +218,8 @@ a { | |||
} | |||
|
|||
.navbar-timepicker { | |||
border-left: 1px solid @kibanaGray4; | |||
|
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.
+1 for me, I think it looks good.
@tanya this was buried in one of those "outdated" collapsing sections, but here is a screenshot to what it looks like: #8546 (comment). The arrows move the time forward and backward with the size of the current interval, and the magnifiers zoom out and or zoom in the time with a factor of two |
@@ -25,6 +26,71 @@ UiModules | |||
$rootScope.toggleRefresh = () => { | |||
timefilter.refreshInterval.pause = !timefilter.refreshInterval.pause; | |||
}; | |||
|
|||
// travel forward in time based on the interval between from and to | |||
$scope.foward = function () { |
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.
typo, foward
-> forward
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.
ha, embarrassing....
i've corrected this, thanks
I find the icons confusing, but there are tooltips so it's probably good enough. However, I think we should add better descriptions to the tooltips. For example, I think Also, to me something looks off about the spacing between all the timepicker controls. I think it needs tighter spacing between the controls, plus I think it should have the same amount of padding on each side of the new border. |
2f7f251
to
efad64d
Compare
I'll echo what @tbragin said, some screenshots and a gif in the description, along with some extra explanation of the details of how this is supposed to behave would be very helpful. |
Replaced by #9253. |
Adds zoom in/out and move left/right buttons to kibana's time picker.
Closes #1956