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

[PieVis] PartitionVis integration to Lens. #123937

Merged

Conversation

Kuznietsov
Copy link
Contributor

@Kuznietsov Kuznietsov commented Jan 27, 2022

Summary

Completes part of #121725 and #95902.

  • Removed lens_pie expression and lens_pie_renderer.
  • Removed styles, related to lens_pie_renderer.
  • Replaced lens_pie with pieVis/mosaicVis/treemapVis/waffleVis expressions.
  • Updated tests to reflect visualization changes.

Kuznietsov and others added 30 commits December 17, 2021 18:11
# Conflicts:
#	src/plugins/chart_expressions/expression_pie/common/expression_functions/pie_vis_function.test.ts
…ptation

# Conflicts:
#	src/plugins/chart_expressions/expression_pie/common/expression_functions/pie_labels_function.ts
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-vis-editors @elastic/kibana-vis-editors-external (Team:VisEditors)

@flash1293
Copy link
Contributor

This is mostly working fine, but I noticed a weird bug when changing the order of bucket dimensions:
Kapture 2022-02-09 at 14 27 45

Doesn't happen on main

@Kuznietsov
Copy link
Contributor Author

@elasticmachine merge upstream

Copy link
Contributor

@flash1293 flash1293 left a comment

Choose a reason for hiding this comment

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

Tested and didn't notice any problems except for the issue with changing/reordering dimensions.

@Kunzetsov I tested around a bit more and it's not only possible to run into this case on re-ordering the dimensions via drag and drop - it also happens e.g. on dragging in a new field.

I'm not feeling comfortable merging the PR this way even if we start working on a fix right away as it will break currently working behavior in subtle ways. For this PR, let's deploy a band-aid fix to be on the safe side:

In the pie expression building logic, use this piece of code to get the operations:

  const operations = datasource
    .getTableSpec()
    .map((col) => col.columnId)
    .filter((columnId) => layer.groups.includes(columnId))
    .map((columnId) => ({ columnId, operation: datasource.getOperationForColumnId(columnId) }))
    .filter((o): o is { columnId: string; operation: Operation } => !!o.operation);

It will ensure the order of the table is respected

@Kuznietsov
Copy link
Contributor Author

Tested and didn't notice any problems except for the issue with changing/reordering dimensions.

@Kunzetsov I tested around a bit more and it's not only possible to run into this case on re-ordering the dimensions via drag and drop - it also happens e.g. on dragging in a new field.

I'm not feeling comfortable merging the PR this way even if we start working on a fix right away as it will break currently working behavior in subtle ways. For this PR, let's deploy a band-aid fix to be on the safe side:

In the pie expression building logic, use this piece of code to get the operations:

  const operations = datasource
    .getTableSpec()
    .map((col) => col.columnId)
    .filter((columnId) => layer.groups.includes(columnId))
    .map((columnId) => ({ columnId, operation: datasource.getOperationForColumnId(columnId) }))
    .filter((o): o is { columnId: string; operation: Operation } => !!o.operation);

It will ensure the order of the table is respected

As we've decided in the private conversation, I'll create the fix in a separate PR, merge it to the main, and only after that we'll come back to the current one.

Copy link
Contributor

@mbondyra mbondyra left a comment

Choose a reason for hiding this comment

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

EDIT: I read Joe's comment after testing, it's the same issue, sorry for the noise I started some initial testing and noticed a bug on Lens with reordering. When reordering two dimensions, they get duplicated (in the chart, not in the dimension panel)

@Kuznietsov
Copy link
Contributor Author

EDIT: I started reading Joe's comment after testing, it's the same issue, sorry for the noise I started some initial testing and noticed a bug on Lens with reordering. When reordering two dimensions, they get duplicated (in the chart, not in the dimension panel)

@mbondyra, no problem)

@Kuznietsov
Copy link
Contributor Author

@flash1293, @mbondyra, I'm close to finishing the fix of the current behavior at this PR: #125336

export const VisualizationNoResults: FC<Props> = ({ hasNegativeValues = false, chartType }) => {
if (hasNegativeValues) {
return (
<EuiText
Copy link
Contributor

@mbondyra mbondyra Feb 11, 2022

Choose a reason for hiding this comment

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

EmptyPlaceholder component takes icon, message and dataTestSubj parameters so I think you can replace this code with using it directly (you'd have to add iconType or something like this though). What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mbondyra, updated the code, according to your proposition. Thanks for the suggestion)

# Conflicts:
#	x-pack/plugins/lens/public/pie_visualization/to_expression.ts
#	x-pack/plugins/lens/public/pie_visualization/visualization.tsx
@Kuznietsov
Copy link
Contributor Author

@flash1293, tested on this branch. Working as expected.

Screen.Recording.2022-02-11.at.16.25.30.mov

Copy link
Contributor

@mbondyra mbondyra 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 and works as expected. I found some minor issues while testing with pie not related to this feature, but reproduced all on main branch so I'll just create new issues. Approved, code LGTM 👌🏼 Amazing job!

@Kuznietsov
Copy link
Contributor Author

@elastic/security-asset-management @elastic/kibana-design, could you, please, review this PR. Thanks.

@Kuznietsov
Copy link
Contributor Author

@elasticmachine merge upstream

@Kuznietsov
Copy link
Contributor Author

@elasticmachine merge upstream

@Kuznietsov
Copy link
Contributor Author

@elastic/security-asset-management, could you, please, review this PR?) Thanks)

@Kuznietsov
Copy link
Contributor Author

@elasticmachine merge upstream

@Kuznietsov
Copy link
Contributor Author

@elasticmachine merge upstream

@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
expressionPartitionVis 49 56 +7
lens 744 734 -10
total -3

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
charts 286 288 +2
lens 316 343 +27
total +29

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
expressionPartitionVis 42.5KB 47.0KB +4.5KB
lens 1.0MB 1.0MB -5.9KB
total -1.4KB

Public APIs missing exports

Total count of every type that is part of your API that should be exported but is not. This will cause broken links in the API documentation system. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats exports for more detailed information.

id before after diff
lens 44 41 -3

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
charts 58.3KB 58.4KB +67.0B
expressionPartitionVis 20.1KB 20.1KB +15.0B
lens 43.4KB 42.5KB -901.0B
total -819.0B
Unknown metric groups

API count

id before after diff
charts 319 321 +2
lens 365 392 +27
total +29

History

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

cc @Kunzetsov

Copy link
Contributor

@patrykkopycinski patrykkopycinski left a comment

Choose a reason for hiding this comment

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

Asset management LGTM

@Kuznietsov Kuznietsov merged commit 54de36f into elastic:main Feb 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting Feature:Lens impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. loe:large Large Level of Effort NeededFor:VisEditors release_note:skip Skip the PR/issue when compiling release notes Team:Visualizations Visualization editors, elastic-charts and infrastructure v8.2.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants