Skip to content

Commit

Permalink
Use doc links service for Canvas (#97059)
Browse files Browse the repository at this point in the history
  • Loading branch information
lcawl authored Apr 19, 2021
1 parent 7a11fac commit 7927923
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@

```typescript
readonly links: {
readonly canvas: {
readonly guide: string;
};
readonly dashboard: {
readonly guide: string;
readonly drilldowns: string;
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-core-public](./kibana-plugin-core-public.md) &gt; [NavigateToAppOptions](./kibana-plugin-core-public.navigatetoappoptions.md) &gt; [openInNewTab](./kibana-plugin-core-public.navigatetoappoptions.openinnewtab.md)

## NavigateToAppOptions.openInNewTab property

if true, will open the app in new tab, will share session information via window.open if base

<b>Signature:</b>

```typescript
openInNewTab?: boolean;
```
7 changes: 7 additions & 0 deletions src/core/public/doc_links/doc_links_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,16 @@ export class DocLinksService {
const DOC_LINK_VERSION = injectedMetadata.getKibanaBranch();
const ELASTIC_WEBSITE_URL = 'https://www.elastic.co/';
const ELASTICSEARCH_DOCS = `${ELASTIC_WEBSITE_URL}guide/en/elasticsearch/reference/${DOC_LINK_VERSION}/`;
const KIBANA_DOCS = `${ELASTIC_WEBSITE_URL}guide/en/kibana/${DOC_LINK_VERSION}/`;
const PLUGIN_DOCS = `${ELASTIC_WEBSITE_URL}guide/en/elasticsearch/plugins/${DOC_LINK_VERSION}/`;

return deepFreeze({
DOC_LINK_VERSION,
ELASTIC_WEBSITE_URL,
links: {
canvas: {
guide: `${KIBANA_DOCS}canvas.html`,
},
dashboard: {
guide: `${ELASTIC_WEBSITE_URL}guide/en/kibana/${DOC_LINK_VERSION}/dashboard.html`,
drilldowns: `${ELASTIC_WEBSITE_URL}guide/en/kibana/${DOC_LINK_VERSION}/drilldowns.html`,
Expand Down Expand Up @@ -397,6 +401,9 @@ export interface DocLinksStart {
readonly DOC_LINK_VERSION: string;
readonly ELASTIC_WEBSITE_URL: string;
readonly links: {
readonly canvas: {
readonly guide: string;
};
readonly dashboard: {
readonly guide: string;
readonly drilldowns: string;
Expand Down
3 changes: 3 additions & 0 deletions src/core/public/public.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,9 @@ export interface DocLinksStart {
readonly ELASTIC_WEBSITE_URL: string;
// (undocumented)
readonly links: {
readonly canvas: {
readonly guide: string;
};
readonly dashboard: {
readonly guide: string;
readonly drilldowns: string;
Expand Down
5 changes: 3 additions & 2 deletions x-pack/plugins/canvas/public/application.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import { KibanaContextProvider } from '../../../../src/plugins/kibana_react/publ
import { registerLanguage } from './lib/monaco_language_def';
import { SetupRegistries } from './plugin_api';
import { initRegistries, populateRegistries, destroyRegistries } from './registries';
import { getDocumentationLinks } from './lib/documentation_links';
import { HelpMenu } from './components/help_menu/help_menu';
import { createStore } from './store';

Expand Down Expand Up @@ -127,6 +126,8 @@ export const initializeCanvas = async (
}
);

// Setup documentation links
const { docLinks } = coreStart;
// Set help extensions
coreStart.chrome.setHelpExtension({
appName: i18n.translate('xpack.canvas.helpMenu.appName', {
Expand All @@ -135,7 +136,7 @@ export const initializeCanvas = async (
links: [
{
linkType: 'documentation',
href: getDocumentationLinks().canvas,
href: docLinks.links.canvas.guide,
},
],
content: (domNode) => {
Expand Down
21 changes: 0 additions & 21 deletions x-pack/plugins/canvas/public/lib/documentation_links.ts

This file was deleted.

0 comments on commit 7927923

Please sign in to comment.