Skip to content

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

Merged
wylieconlon merged 3 commits intoelastic:masterfrom
wylieconlon:lens/update-suggestion-logic
Mar 23, 2020
Merged

[Lens] Improve suggestions when dragging field for the second time#60687
wylieconlon merged 3 commits intoelastic:masterfrom
wylieconlon:lens/update-suggestion-logic

Conversation

@wylieconlon
Copy link
Copy Markdown
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 Team label for Lens, elastic-charts, Graph, legacy editors (TSVB, Visualize, Timelion) t// v8.0.0 Feature:Lens v7.7.0 labels Mar 19, 2020
@wylieconlon wylieconlon requested review from a team, mbondyra and timroes March 19, 2020 20:41
@elasticmachine
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor Author

@elasticmachine merge upstream

@kibanamachine
Copy link
Copy Markdown
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 Team label for Lens, elastic-charts, Graph, legacy editors (TSVB, Visualize, Timelion) t// v7.7.0 v8.0.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants