-
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
[Vis: Default editor] EUIficate time interval control #34991
[Vis: Default editor] EUIficate time interval control #34991
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@maryia-lapata Can you resolve the conflicts first? |
This comment has been minimized.
This comment has been minimized.
So I've been thinking about a way to improve these two inputs. We have the EuiComboBox which can handle single selection and custom selections. What if we could combine these two inputs into a single EuiComboBox? It would look something like this: We would need some help text to tell them how to type in a custom interval if they choose. And add validation text for if they've typed it in wrong. I'd also like to move away from using the alert icon for messages that don't have to do with the validation of the input, but merely a message as to how the application is currently handling the selected option. Therefore, I'd highly suggest changing the label of the input from |
@cchaos thank you for suggestions. I will try to implement them. |
This comment has been minimized.
This comment has been minimized.
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. Just a review. I didn't pull it down.
This comment has been minimized.
This comment has been minimized.
💚 Build Succeeded |
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.
Tested it out locally and it is working, but I have some comments about the style and naming. I'd like to review again before merging.
Also, how can I reproduce the "buckets are too large" case?
const tooLargeBucketsTooltip = ( | ||
<FormattedMessage | ||
id="common.ui.aggTypes.timeInterval.createsTooLargeBucketsTooltip" | ||
defaultMessage="This interval creates buckets that are too large to show in the selected time range, so it has been scaled up." |
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 wasn't able to reproduce this case- any suggestions?
Also, I believe the behavior should be to scale down, not up?
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.
To reproduce this case you can use the following steps:
- set
Maximum bars
to1
inAdvanced Settings
, - create Area visualization
- set Time range to
Last 13 months
- create Date Histogram aggregation and set Interval to
13M
Also, I believe the behavior should be to scale down, not up?
You're right. I updated the message.
const selectOptionHelpText = ( | ||
<FormattedMessage | ||
id="common.ui.aggTypes.timeInterval.selectOptionHelpText" | ||
defaultMessage="Select an option or create a custom value. Examples: 30s, 20m, 24h, 2d, 1w, 1M" |
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 would have appreciated text describing how to create a custom value. It was not clear to me that I had to type the custom value and hit enter.
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.
? [] | ||
: (aggParam.options || []).reduce( | ||
(filtered: ComboBoxOption[], option: AggParamOption) => { | ||
if (option.enabled ? option.enabled(agg) : true) { |
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.
if (option.enabled && option.enabled(agg))
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.
Some options don't have enabled
method and they should be displayed. The logic was moved from here https://github.com/elastic/kibana/pull/34991/files?file-filters%5B%5D=.js&hide-deleted-files=true#diff-a17d2b8a55911e4af0fdaacffbbe87afL85
💚 Build Succeeded |
💚 Build Succeeded |
Haven't re-run the code, but the changes since last review look good to me. |
💚 Build Succeeded |
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.
Changes in functional tests reviewed. Tested on both Chrome/FF on MacOS - all good!
* EUIficate time interval control * Update tests * Remove empty option, update fix tests * Bind vis to scope for react component only * Combine two interval inputs into one EuiCombobox * Add error message * Add migration script; remove unused translations * Update fuctional tests * Update unit test * Update tests; refactoring * Use flow to invoke several functions * Update test * Refactoring * Reset options when timeBase * Add type for editorConfig prop * Add placeholder * Fix lint errors * Call write after interval changing * Fix code review comments * Make replace for model name global * Revert error catch * Remove old dependency * Add unit test for migration test * Fix message * Fix code review comments * Update functional test
* EUIficate time interval control * Update tests * Remove empty option, update fix tests * Bind vis to scope for react component only * Combine two interval inputs into one EuiCombobox * Add error message * Add migration script; remove unused translations * Update fuctional tests * Update unit test * Update tests; refactoring * Use flow to invoke several functions * Update test * Refactoring * Reset options when timeBase * Add type for editorConfig prop * Add placeholder * Fix lint errors * Call write after interval changing * Fix code review comments * Make replace for model name global * Revert error catch * Remove old dependency * Add unit test for migration test * Fix message * Fix code review comments * Update functional test
Summary
EUIfication of time interval control for aggregation parameter in Default Editor, Data tab.
Part of #30922
This PR contains:
customInterval
parameter was removed. The migration script was added as well.validate-date-interval
directive was removed since it isn't used anymore.Screenshots:
Checklist
Use
strikethroughsto remove checklist items you don't feel are applicable to this PR.[ ] This was checked for cross-browser compatibility, including a check against IE11[ ] Documentation was added for features that require explanation or tutorialsFor maintainers
[ ] This was checked for breaking API changes and was labeled appropriatelyDev-Docs
Removed
customInterval
from AggParam, changedinterval
valueWe removed
customInterval
from AggParam. Now the custom interval is specified in theinterval
property. Also now predefined intervals such asYearly
,Daily
, etc., is stored as a key in theinterval
property, e.g.interval: 'y'
,interval: 'd'
,interval: '2s'
.