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

Markdown vis type np shim #38767

Merged
merged 15 commits into from
Jul 2, 2019
Merged

Conversation

ppisljar
Copy link
Member

@ppisljar ppisljar commented Jun 12, 2019

Summary

first vis type to np shim plugin

Checklist

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

For maintainers

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@ppisljar ppisljar added :AppArch non-issue Indicates to automation that a pull request should not appear in the release notes release_note:skip Skip the PR/issue when compiling release notes v7.3.0 v8.0.0 labels Jun 14, 2019
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app-arch

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@ppisljar ppisljar marked this pull request as ready for review June 18, 2019 10:37
@ppisljar ppisljar requested a review from a team as a code owner June 18, 2019 10:37
}

});
visTypes: ['plugins/markdown_vis_type/index'],
Copy link
Member Author

Choose a reason for hiding this comment

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

i tried with public dir but that doesn't seem to work ? (what data plugin does for example) seems in that case we need to have something consuming the plugin.

Copy link
Contributor

Choose a reason for hiding this comment

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

I asked few people last week what we should use to load shims, and create a new uiExport in case we want to use that.

@joshdover suggested to simply use hacks uiExport.

@elastic/kibana-platform maybe it is worth putting into migration guide the suggested way to load client-side shims?

i tried with public dir but that doesn't seem to work ?

I don't know what publicDir does, but my guess always was that it tells Webpack where is the "./public" folder of the plugin.

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.

SASS file moves LGTM

Copy link
Contributor

@streamich streamich left a comment

Choose a reason for hiding this comment

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

start() shim life-cycle seems to be a blocker.

visualizationsSetup.types.VisTypesRegistryProvider.register(() => markdownVis);
functionsRegistry.register(kibanaMarkdown);
}

Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like core's plugin_service calls all setup(), start() and stop() methods without checking if they exist, thus we need to provide start() here, too.

This is also one reason why it is useful to create real NP plugins; as only then we can really know if they work.

@@ -0,0 +1,4 @@
{
"name": "markdown_vis_type",
Copy link
Contributor

Choose a reason for hiding this comment

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

If we named "vis-type" plugins as vis_type_markdown instead, they would all be in one place in folder when sorted alphabetically. What do you think?

@@ -0,0 +1,54 @@
/*
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe while you are at it, also .js 👉 .ts?

"markdownVis.markdownDescription": "マークダウン構文でドキュメントを作成します",
"markdownVis.params.fontSizeLabel": "フォントサイズ ({fontSize} pt)",
"markdownVis.params.helpLinkLabel": "ヘルプ",
"markdownVis.params.openLinksLabel": "新規タブでリンクを開く",
Copy link
Contributor

Choose a reason for hiding this comment

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

All these translations: should they be removed? or renamed? E.g:

"markdownVisType.params.openLinksLabel": "新規タブでリンクを開く",

Copy link
Member Author

Choose a reason for hiding this comment

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

removed, then our translation team will add them back, the tool they use will find this as renamed.

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Copy link
Contributor

@streamich streamich left a comment

Choose a reason for hiding this comment

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

Tried locally, all seems to work, just added one comment about shim initialization.

public stop() {}
}

new VisTypeMarkdownPlugin().setup(visualizations);
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess visualizations should be just one of the plugin contracts, not the whole object, also you may want to inject the data plugin contract.

import { functionsRegistry } from '../../interpreter/public/registries';
import { visualizations, VisualizationsSetup } from '../../visualizations/public';

export interface SetupDeps {
  visualizations: VisualizationsSetup;
  data: any;
}

class VisTypeMarkdownPlugin {
  constructor() {}

  public setup({visualizations, data}: SetupDeps) {
    visualizations.types.VisTypesRegistryProvider.register(() => markdownVis);
    data.expressions.registerFunction(kibanaMarkdown);
  }

  public start() {}

  public stop() {}
}

new VisTypeMarkdownPlugin().setup({
  visualizations,
  data: {
    expressions: {
      registerFunction: (fn: any) => functionsRegistry.register(fn),
    }
  }
});

# Conflicts:
#	src/legacy/core_plugins/vis_type_markdown/public/markdown_fn.ts
@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@ppisljar ppisljar added v7.4.0 and removed v7.3.0 labels Jul 2, 2019
@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

# Conflicts:
#	x-pack/plugins/translations/translations/ja-JP.json
#	x-pack/plugins/translations/translations/zh-CN.json
@elasticmachine
Copy link
Contributor

💔 Build Failed

@ppisljar
Copy link
Member Author

ppisljar commented Jul 2, 2019

retest

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@ppisljar ppisljar merged commit c78cfbb into elastic:master Jul 2, 2019
ppisljar added a commit to ppisljar/kibana that referenced this pull request Jul 2, 2019
# Conflicts:
#	src/legacy/core_plugins/vis_type_markdown/public/markdown_fn.test.ts
ppisljar added a commit that referenced this pull request Jul 3, 2019
# Conflicts:
#	src/legacy/core_plugins/vis_type_markdown/public/markdown_fn.test.ts
new VisTypeMarkdownPlugin().setup({
visualizations: visualizationsService,
data: {
expressions: {
Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry for the delayed comment, but why not add this function to expressions service in data plugin?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
non-issue Indicates to automation that a pull request should not appear in the release notes release_note:skip Skip the PR/issue when compiling release notes v7.4.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants