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

[Canvas] Adds Tag Cloud support #106858

Merged
merged 54 commits into from
Sep 6, 2021
Merged

Conversation

Kuznietsov
Copy link
Contributor

@Kuznietsov Kuznietsov commented Jul 27, 2021

Completes a part of #101377.

At this PR TagCloud is added to Canvas.

Improvements:

  • Added full support of vis_dimension at tagcloud function. Now, accessor can be either index or name of the column.
  • Added validation of column index. If the index of the column is out of columns' boundary, vis_dimension throws an error.
  • Added TagCloud visualization to Canvas.
  • Added element Tag cloud to Charts category.
  • Added handling of empty data and displaying No results at Tag cloud.
  • Added a Storybook to expression_tagcloud.
  • Updated functional tests for tagcloud and metrics. Separated invalid data and empty data.
  • Updated vis_type_metrics types and added support of the accessor to be either index or name of the column.
  • Updated unit tests for expression_tagcloud and vis_type_metrics.

Tag Cloud at Canvas


Tag Cloud element

Screenshot 2021-07-30 at 16 48 03


Tag Cloud renderer

Screenshot 2021-07-30 at 16 48 27


Tag Cloud renderer with expression

Screenshot 2021-07-30 at 16 48 47


Tag Cloud empty results at Canvas

Screenshot 2021-07-30 at 17 02 26


Storybook at vis_type_tagcloud

Screenshot 2021-07-30 at 10 20 35
Screenshot 2021-07-30 at 10 20 43
Screenshot 2021-07-30 at 10 20 49
Screenshot 2021-07-30 at 10 20 54
Screenshot 2021-07-30 at 10 20 59
Screenshot 2021-07-30 at 10 21 05
Screenshot 2021-07-30 at 10 21 10

@Kuznietsov Kuznietsov added WIP Work in progress Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas v8.0.0 Feature:Canvas v7.15.0 labels Jul 27, 2021
@Kuznietsov Kuznietsov requested review from crob611 and alexwizp July 27, 2021 14:32
@Kuznietsov Kuznietsov self-assigned this Jul 27, 2021
@Kuznietsov Kuznietsov changed the title [Canvas] TagCloud [WIP] [Canvas] TagCloud Jul 27, 2021
@Kuznietsov Kuznietsov changed the title [WIP] [Canvas] TagCloud [Canvas] TagCloud Jul 28, 2021
@Kuznietsov Kuznietsov removed the WIP Work in progress label Jul 28, 2021
Added check of accessor index, if such column exists at vis_dimension.
Removed checks of column existance from TagCloudChart.
Added test for accessing data by column name in addition to a column number.
Updated tag_cloud element in Canvas.
Fixed types. Removed almost all `any` and `as` types.
Added valid functional tests to metrics and tag_cloud.
Fixed types of metrics_vis.
Added handling of empty data at tag_cloud renderer.
@Kuznietsov
Copy link
Contributor Author

@elasticmachine merge upstream

# Conflicts:
#	src/plugins/chart_expressions/expression_tagcloud/common/expression_functions/tagcloud_function.test.ts
#	src/plugins/chart_expressions/expression_tagcloud/public/components/tagcloud_component.test.tsx
#	src/plugins/chart_expressions/expression_tagcloud/public/components/tagcloud_component.tsx
#	src/plugins/vis_type_tagcloud/kibana.json
#	src/plugins/vis_type_tagcloud/public/tag_cloud_fn.ts
#	src/plugins/vis_type_tagcloud/public/tag_cloud_vis_renderer.tsx
#	src/plugins/vis_type_tagcloud/public/types.ts
#	test/interpreter_functional/snapshots/baseline/tagcloud_empty_data.json
#	test/interpreter_functional/snapshots/baseline/tagcloud_invalid_data.json
#	test/interpreter_functional/snapshots/session/tagcloud_invalid_data.json
@Kuznietsov
Copy link
Contributor Author

@elasticmachine merge upstream

@Kuznietsov
Copy link
Contributor Author

@elasticmachine merge upstream

Copy link
Contributor

@stratoula stratoula left a comment

Choose a reason for hiding this comment

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

This seems to work fine :)
Just 3 minor comments from my side


export const tagcloudRenderer: (
deps: ExpressioTagcloudRendererDependencies
) => ExpressionRenderDefinition<TagcloudRendererConfig> = ({ palettes }) => ({
name: EXPRESSION_NAME,
displayName: strings.getDisplayName(),
help: strings.getHelpDescription(),
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it safe to remove the help text here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Reverted.


export const tagcloudRenderer: (
deps: ExpressioTagcloudRendererDependencies
) => ExpressionRenderDefinition<TagcloudRendererConfig> = ({ palettes }) => ({
name: EXPRESSION_NAME,
displayName: strings.getDisplayName(),
help: strings.getHelpDescription(),
displayName: 'Tag Cloud visualization',
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't be localized?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

? args.accessor
: input.columns.find((c) => c.id === args.accessor);
? getAccessorByIndex(args.accessor, input.columns)
: getAccessorById(args.accessor, input.columns);

if (accessor === undefined) {
throw new Error(
i18n.translate('visualizations.function.visDimension.error.accessor', {
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's also remove this translation from the translation files in order to be translated again

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@Kuznietsov Kuznietsov requested a review from a team as a code owner September 3, 2021 11:23
# Conflicts:
#	src/plugins/vis_types/metric/public/components/metric_vis_component.tsx
#	src/plugins/vis_types/metric/public/metric_vis_fn.ts
#	src/plugins/vis_types/metric/public/types.ts
#	src/plugins/vis_types/tagcloud/public/to_ast.test.ts
#	src/plugins/vis_types/tagcloud/public/types.ts
@Kuznietsov
Copy link
Contributor Author

@stratoula, can you, please, review the current PR as if I've updated the code based on your nits. Thanks)

Copy link
Contributor

@stratoula stratoula left a comment

Choose a reason for hiding this comment

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

LGTM, code review only. I have already tested it and my last commentes were mostly nits

@Kuznietsov
Copy link
Contributor Author

@elasticmachine merge upstream

@Kuznietsov Kuznietsov enabled auto-merge (squash) September 6, 2021 06:28
@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
canvas 1065 1066 +1

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
visualizations 253 257 +4

Async chunks

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

id before after diff
canvas 1.6MB 1.6MB +598.0B
expressionTagcloud 14.1KB 14.3KB +142.0B
visTypeMetric 16.2KB 16.3KB +134.0B
total +874.0B

Page load bundle

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

id before after diff
expressionTagcloud 12.5KB 12.4KB -102.0B
visTypeMetric 22.2KB 22.2KB -34.0B
visualizations 58.7KB 59.0KB +298.0B
total +162.0B
Unknown metric groups

API count

id before after diff
visualizations 271 275 +4

History

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

cc @Kunzetsov

@Kuznietsov Kuznietsov merged commit eef094b into elastic:master Sep 6, 2021
kibanamachine added a commit to kibanamachine/kibana that referenced this pull request Sep 6, 2021
* Added `tagCloud` to canvas.

* Added `icon` to the `tagCloud` element.

* Added column name support at `tag_cloud`.

* Added condition to `vis_dimension` not to pass invalid index.

Added check of accessor index, if such column exists at vis_dimension.
Removed checks of column existance from TagCloudChart.
Added test for accessing data by column name in addition to a column number.
Updated tag_cloud element in Canvas.
Fixed types. Removed almost all `any` and `as` types.

* Added test suites for `vis_dimension` function.

* Added tests for DatatableColumn accessors at tag_cloud_fn and to_ast.

* Refactored metrics, tagcloud and tests.

Added valid functional tests to metrics and tag_cloud.
Fixed types of metrics_vis.
Added handling of empty data at tag_cloud renderer.

* Added storybook ( still doesn't work ).

* Fixed some mistakes.

* Added working storybook with mocks.

* Added clear storybook for tag_cloud_vis_renderer.

* Updated the location of vis_dimension test after movement of the function.

* Fixed unused type.

* Fixed tests and added handling of the column name at `visualizations/**/*/prepare_log_table.ts`

* Reduced the complexity of checking the accessor at `tag_cloud_chart.tsx`

* Added comments at unclear places of code.

* Added the logic for disabling elements for renderers from disabled plugins.

* removed garbage from `kibana.yml`.

* Fixed element_strings.test error.

* Made changes, based on nits.

* Fixed mistake.

* Removed `disabled` flag for `expression_*` plugins.

* recovered lost comments at the unclear places.

* removed dead code.

* fixed test errors.

* Fixed test error, I hope.

* fixed more tests.

* fixed code, based on nits.

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
@kibanamachine
Copy link
Contributor

💚 Backport successful

Status Branch Result
7.x

This backport PR will be merged automatically after passing CI.

kibanamachine added a commit that referenced this pull request Sep 6, 2021
* Added `tagCloud` to canvas.

* Added `icon` to the `tagCloud` element.

* Added column name support at `tag_cloud`.

* Added condition to `vis_dimension` not to pass invalid index.

Added check of accessor index, if such column exists at vis_dimension.
Removed checks of column existance from TagCloudChart.
Added test for accessing data by column name in addition to a column number.
Updated tag_cloud element in Canvas.
Fixed types. Removed almost all `any` and `as` types.

* Added test suites for `vis_dimension` function.

* Added tests for DatatableColumn accessors at tag_cloud_fn and to_ast.

* Refactored metrics, tagcloud and tests.

Added valid functional tests to metrics and tag_cloud.
Fixed types of metrics_vis.
Added handling of empty data at tag_cloud renderer.

* Added storybook ( still doesn't work ).

* Fixed some mistakes.

* Added working storybook with mocks.

* Added clear storybook for tag_cloud_vis_renderer.

* Updated the location of vis_dimension test after movement of the function.

* Fixed unused type.

* Fixed tests and added handling of the column name at `visualizations/**/*/prepare_log_table.ts`

* Reduced the complexity of checking the accessor at `tag_cloud_chart.tsx`

* Added comments at unclear places of code.

* Added the logic for disabling elements for renderers from disabled plugins.

* removed garbage from `kibana.yml`.

* Fixed element_strings.test error.

* Made changes, based on nits.

* Fixed mistake.

* Removed `disabled` flag for `expression_*` plugins.

* recovered lost comments at the unclear places.

* removed dead code.

* fixed test errors.

* Fixed test error, I hope.

* fixed more tests.

* fixed code, based on nits.

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Yaroslav Kuznietsov <kuznetsov.yaroslav.yk@gmail.com>
@timroes timroes changed the title [Canvas] TagCloud [Canvas] Adds Tag Cloud support Oct 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Deprecated - use backport:version if exact versions are needed Feature:Canvas impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. loe:medium Medium Level of Effort release_note:feature Makes this part of the condensed release notes Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas v7.16.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants