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

[Table Vis] Shim new platform #40732

Merged
merged 12 commits into from
Jul 24, 2019
Merged

[Table Vis] Shim new platform #40732

merged 12 commits into from
Jul 24, 2019

Conversation

alexwizp
Copy link
Contributor

@alexwizp alexwizp commented Jul 10, 2019

Summary

Part of #38245

1 Step of migrating to new Platform

What was done in this PR:

  • Have a new platform-style plugin definition in typescript, with a setup method returning the public contract (see data plugin as an example). This needs to be exported from the top-level /server and/or /public directory, e.g. export foo = new Plugin.setup()
  • Be broken into logical "services", each with a service definition class (see data plugin as an example)
  • Register the visualization via the "visualizations" plugin's types service.
  • Have all static exports done from the top level plugin definition

Checklist

Use strikethroughs to remove checklist items you don't feel are applicable to this PR.

For maintainers

@elastic elastic deleted a comment from elasticmachine Jul 10, 2019
@alexwizp alexwizp marked this pull request as ready for review July 10, 2019 13:58
@alexwizp alexwizp added Feature:New Platform Team:Visualizations Visualization editors, elastic-charts and infrastructure v7.4.0 v8.0.0 labels Jul 10, 2019
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app

@alexwizp alexwizp self-assigned this Jul 10, 2019
@alexwizp alexwizp added the release_note:skip Skip the PR/issue when compiling release notes label Jul 10, 2019
@elastic elastic deleted a comment from elasticmachine Jul 10, 2019
@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

export const plugins: TablePluginSetupDependencies = {
data: {
expressions: {
registerFunction: (fn: any) => functionsRegistry.register(fn),
Copy link
Contributor

Choose a reason for hiding this comment

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

We're copying this function across all plugin defenitions.
Lets add it to data.expressions ASAP @ppisljar

import paginatedTableTemplate from './paginated_table.html';

import 'ui/directives/paginate';
export function PaginatedTable($filter) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I like the idea of separating the component from the directive.
This way we can refactor these in place, and remove the directives later.
Think this is a good practice!


// Temporary solution
// It will be removed when all dependent services are migrated to the new platform.
__LEGACY: new LegacyDependenciesPlugin(),
Copy link
Contributor

Choose a reason for hiding this comment

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

@lukeelmers @streamich I like how this concept applies to the visualizations and solves the async deps problem.
I think you should have demoed this in our meeting!

I wonder how can this be applied to plugins that make more intensive use of Angular dependencies.

const Private = $injector.get('Private');

return {
createAngularVisualization: VisFactoryProvider(Private).createAngularVisualization,
Copy link
Contributor

Choose a reason for hiding this comment

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

I like that you didn't end up exposing raw Angular deps here.
I wonder if this is the case for all visualizations.
But here it works great @streamich

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@alexwizp alexwizp added the Feature:Data Table Data table visualization feature label Jul 11, 2019
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Copy link
Member

@lukeelmers lukeelmers left a comment

Choose a reason for hiding this comment

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

Same comment about setup.ts -> legacy.ts as I added to the TSVB & Vega PRs. Otherwise LGTM!

@elasticmachine
Copy link
Contributor

💔 Build Failed

# Conflicts:
#	src/legacy/core_plugins/table_vis/public/agg_table/agg_table.js
#	src/legacy/core_plugins/table_vis/public/agg_table/agg_table_group.js
#	src/legacy/core_plugins/table_vis/public/paginated_table/paginated_table.js
#	src/legacy/core_plugins/table_vis/public/table_vis_params.js
@alexwizp alexwizp requested a review from myasonik July 22, 2019 10:28
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@alexwizp alexwizp requested a review from lizozom July 22, 2019 11:39
Copy link
Contributor

@myasonik myasonik left a comment

Choose a reason for hiding this comment

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

Ran through this manually locally confirming everything seems to work 👍 LGTM

.controller('KbnTableVisController', TableVisController)
.directive('tableVisParams', TableVisParams);

// todo: not sure that "kibana" is a right module for that directives
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure if this was meant to be a todo before checkin or not but seems like something to resolve before merging

Copy link
Member

Choose a reason for hiding this comment

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

You might be able to get away with using kibana/table_vis for everything since all of these directives are specific to the table vis at this point i think.

@lizozom do you have any insight on this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@lukeelmers @lizozom @nreese checked it again and looks like we can move all into one module without any risk. PR was updated

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@@ -41,8 +41,7 @@ export interface TableVisualizationDependencies extends LegacyDependenciesPlugin

/** @internal */
export interface TablePluginSetupDependencies {
// TODO: Remove `any` as functionsRegistry will be added to the DataSetup.
data: DataSetup | any;
data: ReturnType<DataPublicPlugin['setup']>;
Copy link
Member

Choose a reason for hiding this comment

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

👍 As discussed we'll update this later when we sort out the discrepancy between the src/plugins/data and src/legacy/core_plugins/data interfaces

@alexwizp alexwizp merged commit 1ba5a62 into elastic:master Jul 24, 2019
alexwizp added a commit to alexwizp/kibana that referenced this pull request Jul 24, 2019
* [Table Vis] Shim new platform

* fix mocha tests

* fix mocha tests

* fix _agg_config test

* cleanup

* remove setup.ts

* Set the correct type for the "Data" dependency
alexwizp added a commit that referenced this pull request Jul 24, 2019
* [Table Vis] Shim new platform

* fix mocha tests

* fix mocha tests

* fix _agg_config test

* cleanup

* remove setup.ts

* Set the correct type for the "Data" dependency
@alexwizp alexwizp deleted the table_vis branch January 4, 2020 08:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Data Table Data table visualization feature Feature:New Platform release_note:skip Skip the PR/issue when compiling release notes Team:Visualizations Visualization editors, elastic-charts and infrastructure v7.4.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants