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

[Lens] Improve suggestions when dragging field for the second time #60687

Merged
merged 3 commits into from
Mar 23, 2020

Conversation

wylieconlon
Copy link
Contributor

Release note

Improves suggestion logic when dragging fields into the chart. Specifically:

  • When dragging a number field, we now replace the previous metric if there is only one. Otherwise, the number is added.
  • When dragging a string field, the terms aggregation is now added inside any other terms aggregations, instead of at the top of the aggregation order.
    • Special case: When there is also a date histogram operation, we add the terms aggregation before date histogram. This maintains the existing behavior.

Checklist

@wylieconlon wylieconlon added release_note:enhancement Team:Visualizations Visualization editors, elastic-charts and infrastructure v8.0.0 Feature:Lens v7.7.0 labels Mar 19, 2020
@wylieconlon wylieconlon requested review from timroes, mbondyra and a team March 19, 2020 20:41
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app (Team:KibanaApp)

const [, metrics] = separateBucketColumns(layer);

// Add new metric if we already have multiple
if (metrics.length > 1) {
Copy link
Contributor

Choose a reason for hiding this comment

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

We currently not using this path if metrics.length === 0, and then later executing code like delete newColumns[metrics[0]] where metrics[0] is undefined. This happens to work, but I think it would be a bit nicer, if we would also use this path if metrics.length === 0, since we don't then access metrics[0] and it could look a bit more clear. (At that point maybe we want to switch that if with the code below and make it a metrics.length === 1-if instead.

Copy link
Contributor

@timroes timroes left a comment

Choose a reason for hiding this comment

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

Tested on Chrome Linux. The described behavior seems to make more sense for me anyway :-) Left one minor code suggestion.

@wylieconlon
Copy link
Contributor Author

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@wylieconlon wylieconlon merged commit f7a3049 into elastic:master Mar 23, 2020
@wylieconlon wylieconlon deleted the lens/update-suggestion-logic branch March 23, 2020 21:11
wylieconlon pushed a commit to wylieconlon/kibana that referenced this pull request Mar 23, 2020
…lastic#60687)

* [Lens] Improve suggestions when dragging into an existing visualization

* Include 0 metrics case

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
wylieconlon pushed a commit that referenced this pull request Mar 24, 2020
…60687) (#60996)

* [Lens] Improve suggestions when dragging into an existing visualization

* Include 0 metrics case

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Lens release_note:enhancement Team:Visualizations Visualization editors, elastic-charts and infrastructure v7.7.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants