Skip to content
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

Merged
merged 37 commits into from
May 3, 2019

Conversation

maryia-lapata
Copy link
Contributor

@maryia-lapata maryia-lapata commented Apr 12, 2019

Summary

EUIfication of time interval control for aggregation parameter in Default Editor, Data tab.
Part of #30922

This PR contains:

  • Two interval inputs (interval selector and custom interval input ) were replaced with one EUIComboBox control which can handle single selection and custom selections.
  • Since now we have one control and one model that stores selected or custom interval, the customInterval parameter was removed. The migration script was added as well.
  • More help text was added under the control. Now help text with tooltip for scaled interval is displayed under the control.
  • validate-date-interval directive was removed since it isn't used anymore.

Screenshots:

  1. Interval options

image

  1. with Help text

image

  1. with help text for scaled interval

image

image

  1. with custom interval

image

  1. with invalid custom interval

image

  1. with empty value

image

  1. with timeBase and help text from editorConfig

image

  1. with timeBase and help text from editorConfig when interval is invalid

image

  1. gif with selected options

Apr-23-2019 12-15-43

  1. gif with custom interval

Apr-23-2019 12-20-18

Checklist

Use strikethroughs to remove checklist items you don't feel are applicable to this PR.

For maintainers

Dev-Docs

Removed customInterval from AggParam, changed interval value

We removed customInterval from AggParam. Now the custom interval is specified in the interval property. Also now predefined intervals such as Yearly, Daily, etc., is stored as a key in the interval property, e.g. interval: 'y', interval: 'd', interval: '2s'.

@elasticmachine

This comment has been minimized.

@elasticmachine

This comment has been minimized.

@elasticmachine

This comment has been minimized.

@elasticmachine

This comment has been minimized.

@maryia-lapata maryia-lapata added Feature:Vis Editor Visualization editor issues release_note:skip Skip the PR/issue when compiling release notes v7.2.0 v8.0.0 labels Apr 15, 2019
@maryia-lapata maryia-lapata marked this pull request as ready for review April 15, 2019 15:28
@cchaos
Copy link
Contributor

cchaos commented Apr 15, 2019

@maryia-lapata Can you resolve the conflicts first?

@timroes timroes mentioned this pull request Apr 16, 2019
29 tasks
@elasticmachine

This comment has been minimized.

@cchaos
Copy link
Contributor

cchaos commented Apr 16, 2019

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 Interval to Minimum interval and when the application has to scale that interval do this:

@maryia-lapata maryia-lapata added the WIP Work in progress label Apr 17, 2019
@maryia-lapata maryia-lapata changed the title [Vis: Default editor] EUIficate time interval control WIP [Vis: Default editor] EUIficate time interval control Apr 17, 2019
@maryia-lapata
Copy link
Contributor Author

@cchaos thank you for suggestions. I will try to implement them.

@elasticmachine

This comment has been minimized.

Copy link
Contributor

@chrisdavies chrisdavies left a 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.

@elasticmachine

This comment has been minimized.

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Copy link
Contributor

@wylieconlon wylieconlon left a 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."
Copy link
Contributor

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?

Copy link
Contributor Author

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:

  1. set Maximum bars to 1 in Advanced Settings,
  2. create Area visualization
  3. set Time range to Last 13 months
  4. create Date Histogram aggregation and set Interval to 13M

image

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"
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When a user is typing in EUIComboBox, a tip appears:

image

src/legacy/ui/public/agg_types/utils.tsx Outdated Show resolved Hide resolved
src/legacy/ui/public/agg_types/utils.tsx Outdated Show resolved Hide resolved
src/legacy/ui/public/agg_types/utils.tsx Outdated Show resolved Hide resolved
src/legacy/ui/public/agg_types/utils.tsx Show resolved Hide resolved
src/legacy/ui/public/agg_types/controls/time_interval.tsx Outdated Show resolved Hide resolved
src/legacy/ui/public/agg_types/controls/time_interval.tsx Outdated Show resolved Hide resolved
src/legacy/ui/public/agg_types/controls/time_interval.tsx Outdated Show resolved Hide resolved
? []
: (aggParam.options || []).reduce(
(filtered: ComboBoxOption[], option: AggParamOption) => {
if (option.enabled ? option.enabled(agg) : true) {
Copy link
Contributor

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))

Copy link
Contributor Author

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

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@wylieconlon
Copy link
Contributor

Haven't re-run the code, but the changes since last review look good to me.

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@maryia-lapata maryia-lapata requested a review from dmlemeshko May 2, 2019 08:04
Copy link
Member

@dmlemeshko dmlemeshko left a 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!

@sulemanof sulemanof merged commit 9c8894c into elastic:master May 3, 2019
sulemanof pushed a commit to sulemanof/kibana that referenced this pull request May 3, 2019
* 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
sulemanof added a commit that referenced this pull request May 3, 2019
* 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
@maryia-lapata maryia-lapata deleted the vis-editor/time-interval branch May 13, 2019 06:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backported Feature:Vis Editor Visualization editor issues release_note:plugin_api_changes Contains a Plugin API changes section for the breaking plugin API changes section. release_note:skip Skip the PR/issue when compiling release notes Team:Visualizations Visualization editors, elastic-charts and infrastructure v7.2.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants