-
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 advanced setting to control quick ranges #15975
Conversation
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 is great
{ from: 'now-5y', to: 'now', display: 'Last 5 years', section: 2 }, | ||
|
||
], null, 2), | ||
description: 'The list of ranges to show in the Quick section of the time picker.' |
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.
Is there any documentation that you could link too? It would be helpful to know what proper values can be used.
@@ -277,6 +277,37 @@ export function getUiSettingDefaults() { | |||
}`, | |||
description: 'The timefilter\'s default refresh interval' | |||
}, | |||
'timepicker:quickRanges': { |
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.
Is there a way to add a verify
method to ensure the time ranges are valid? It would be better to get an error message and not update the quickRanges on the advanced setting page, then to let users save invalid time ranges and get a cryptic error when selecting the invalid range via the timepicker.
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 don't think there's any sort of verification currently (beyond verifying that the value actually is JSON). I could probably add a custom directive and handling for this but it might add more complexity than it's worth... Plus, there are other JSON values in the advanced settings that we don't have any sort of verification either. What if I just added some notes to the docs about how to configure the value and linked to it in the description?
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.
sounds good
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.
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.
Love it. Looks like one use of quick_ranges
will need to be updated in x-pack as well.
LGTM
@@ -1,5 +1,6 @@ | |||
import moment from 'moment-timezone'; | |||
import numeralLanguages from '@elastic/numeral/languages'; | |||
// import { documentationLinks } from '../../ui/public/documentation_links'; |
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.
Stray comment?
return { | ||
restrict: 'E', | ||
scope: { | ||
from: '=', | ||
to: '=' | ||
}, | ||
link: function ($scope, $elem) { | ||
const quickRanges = config.get('timepicker:quickRanges'); |
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.
Do we need a check here to make sure users don't add a crazy number of sections?
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.
Meh, we could, but I don't envision that being a super common problem and it's easily fixed.
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.
lgtm
* Add advanced setting to control quick ranges * Fix test * Add docs for quick ranges * Remove comment
6.x (6.2.0): 9578180 |
Closes #2758.
This PR creates a new advanced setting,
timepicker:quickRanges
which controls the list of ranges that show up in the "Quick" section of the time picker.The default value for this is similar to what used to show up, minus the ranges that used to show up in the second column (e.g. "Yesterday", "Previous week", "Previous month", etc.). The impetus for removing this column is that it probably wasn't used very often and the user can easily use the forward/backward arrows next to the time picker to access the majority of these. Also, it frees up more space in the "Quick" section with the idea that this space can be used to show ranges from your history.