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

Timelion visualization renderer #78540

Merged
merged 19 commits into from Oct 1, 2020

Conversation

sulemanof
Copy link
Contributor

@sulemanof sulemanof commented Sep 25, 2020

Summary

Part of #46801

  • Implement own renderer for Timelion visualization;
  • lazy load the timelion visualization component and styles;
  • Implement toExpressionAst function for building pipeline;
  • cleanup the code, remove extra wrappers;
  • add unit tests;

Checklist

Delete any items that are not applicable to this PR.

For maintainers

@sulemanof sulemanof mentioned this pull request Sep 28, 2020
13 tasks
@sulemanof sulemanof added Feature:Timelion Timelion app and visualization Feature:Visualizations Generic visualization features (in case no more specific feature label is available) release_note:skip Skip the PR/issue when compiling release notes Team:Visualizations Visualization editors, elastic-charts and infrastructure v7.10.0 v8.0.0 labels Sep 29, 2020
Copy link
Member

@ppisljar ppisljar left a comment

Choose a reason for hiding this comment

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

code LGTM for toASt/render parts, didn't check changes to timelion

@sulemanof sulemanof marked this pull request as ready for review September 29, 2020 13:20
@sulemanof sulemanof requested a review from a team September 29, 2020 13:20
@sulemanof sulemanof requested a review from a team as a code owner September 29, 2020 13:20
@elasticmachine
Copy link
Contributor

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

deps: TimelionVisDependencies
) => ExpressionRenderDefinition<TimelionRenderValue> = (deps) => ({
name: 'timelion_vis',
displayName: 'Timelion visualization',
Copy link
Contributor

Choose a reason for hiding this comment

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

should this value 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.

This is a good question.
Despite the fact that docs says:

  /**
   * A user friendly name of the renderer as will be displayed to user in UI.
   */
  displayName: string;

I can't find any usage of the displayName in src/plugins, so this never affects our basic plugins.
But this could be an option for canvas app.
I had a talk with @streamich around the ExpressionRenderer keys, and he'll define their necessity after their team meeting today.
For now, we decided to make it an optional property.

Copy link
Contributor

@alexwizp alexwizp left a comment

Choose a reason for hiding this comment

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

Overall LGTM! Just added some questions

@sulemanof sulemanof requested a review from a team as a code owner September 30, 2020 09:17
@botelastic botelastic bot added the Feature:ExpressionLanguage Interpreter expression language (aka canvas pipeline) label Sep 30, 2020
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 🥳 Thanx @sulemanof ❤️

Copy link
Contributor

@cchaos cchaos left a comment

Choose a reason for hiding this comment

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

I'm slightly confused about what's goin on with these imports, but as it's a deprecated plugin, I'm not going to worry too much.

@sulemanof
Copy link
Contributor Author

I'm slightly confused about what's goin on with these imports, but as it's a deprecated plugin, I'm not going to worry too much.

Sorry if the description is confusing!
What I meant is that the styles file vis_type_timelion/public/components/index.scss could be loaded twice in case if user open both Timelion app and Timelion visualization (no matter either through the default editor or dashboard).
Since those styles were always loaded just at vis_type_timelion plugin initialization, they were shared between the legacy app and visualization itself.
Now, styles are lazy loaded only if you display the visualization, which would break the legacy app if it is opened first.

@sulemanof
Copy link
Contributor Author

@elasticmachine merge upstream

<KibanaContextProvider services={{ ...dependencies }}>
<TimelionVisComponent {...props} />
</KibanaContextProvider>
),
},
editorConfig: {
optionsTemplate: (props: TimelionOptionsProps) => (
Copy link
Contributor

Choose a reason for hiding this comment

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

I know this is technically out of scope for this PR, but I think we could lazy-load TimelionOptions as well to shave off a few additional KB from the initial bundle size - wdyt?

Copy link
Contributor Author

@sulemanof sulemanof Oct 1, 2020

Choose a reason for hiding this comment

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

Makes sense! Especially since it loads monaco 🤔
Will try!

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!
image

Tested against the default editor PR, works well

@sulemanof
Copy link
Contributor Author

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

async chunks size

id before after diff
timelion 455.5KB 463.1KB +7.6KB
visTypeTimelion 0.0B 154.3KB +154.3KB
total +161.9KB

distributable file count

id before after diff
default 45840 45846 +6
oss 26563 26569 +6

page load bundle size

id before after diff
visTypeTimelion 183.4KB 36.1KB -147.3KB
visualizations 272.6KB 272.4KB -210.0B
total -147.5KB

History

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

@sulemanof sulemanof merged commit b692c37 into elastic:master Oct 1, 2020
@sulemanof sulemanof deleted the feat/timelion_renderer branch October 1, 2020 14:08
sulemanof added a commit to sulemanof/kibana that referenced this pull request Oct 1, 2020
* Update styles

* Implement toExpressionAst fn

* Implement renderer

* Update unit tests

* Add unit tests

* Update types

* Remove unused vars

* Fix types

* Update types

* Show error message when no data

* Update ExpressionRenderDefinition api

* Update renderer when there is no data

* Make options component lazy

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
# Conflicts:
#	docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionrenderdefinition.displayname.md
#	docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.expressionrenderdefinition.displayname.md
#	src/plugins/expressions/public/public.api.md
#	src/plugins/expressions/server/server.api.md
sulemanof added a commit that referenced this pull request Oct 1, 2020
* Update styles

* Implement toExpressionAst fn

* Implement renderer

* Update unit tests

* Add unit tests

* Update types

* Remove unused vars

* Fix types

* Update types

* Show error message when no data

* Update ExpressionRenderDefinition api

* Update renderer when there is no data

* Make options component lazy

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
# Conflicts:
#	docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionrenderdefinition.displayname.md
#	docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.expressionrenderdefinition.displayname.md
#	src/plugins/expressions/public/public.api.md
#	src/plugins/expressions/server/server.api.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:ExpressionLanguage Interpreter expression language (aka canvas pipeline) Feature:Timelion Timelion app and visualization Feature:Visualizations Generic visualization features (in case no more specific feature label is available) release_note:skip Skip the PR/issue when compiling release notes Team:Visualizations Visualization editors, elastic-charts and infrastructure v7.10.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants