Skip to content

Commit

Permalink
Add Vega help link to DocLinksService (elastic#87721)
Browse files Browse the repository at this point in the history
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
  • Loading branch information
2 people authored and stratoula committed Mar 31, 2021
1 parent 69bec3f commit 1365e3e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/core/public/doc_links/doc_links_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ export class DocLinksService {
lens: `${ELASTIC_WEBSITE_URL}what-is/kibana-lens`,
lensPanels: `${ELASTIC_WEBSITE_URL}guide/en/kibana/${DOC_LINK_VERSION}/lens.html`,
maps: `${ELASTIC_WEBSITE_URL}maps`,
vega: `${ELASTIC_WEBSITE_URL}guide/en/kibana/${DOC_LINK_VERSION}/vega.html`,
},
observability: {
guide: `${ELASTIC_WEBSITE_URL}guide/en/observability/${DOC_LINK_VERSION}/index.html`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import { EuiButtonIcon, EuiContextMenuPanel, EuiContextMenuItem, EuiPopover } fr
import { FormattedMessage } from '@kbn/i18n/react';
import { i18n } from '@kbn/i18n';

import { getDocLinks } from '../services';

function VegaHelpMenu() {
const [isPopoverOpen, setIsPopoverOpen] = useState(false);
const onButtonClick = useCallback(() => setIsPopoverOpen(!isPopoverOpen), [isPopoverOpen]);
Expand All @@ -30,7 +32,7 @@ function VegaHelpMenu() {
const items = [
<EuiContextMenuItem
key="vegaHelp"
href="https://www.elastic.co/guide/en/kibana/master/vega-graph.html"
href={getDocLinks().links.visualize.vega}
target="_blank"
onClick={closePopover}
>
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/vis_type_vega/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
setUISettings,
setInjectedMetadata,
setMapServiceSettings,
setDocLinks,
} from './services';

import { createVegaFn } from './vega_fn';
Expand Down Expand Up @@ -96,5 +97,6 @@ export class VegaPlugin implements Plugin<void, void> {
setNotifications(core.notifications);
setData(data);
setInjectedMetadata(core.injectedMetadata);
setDocLinks(core.docLinks);
}
}
4 changes: 3 additions & 1 deletion src/plugins/vis_type_vega/public/services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Side Public License, v 1.
*/

import { CoreStart, NotificationsStart, IUiSettingsClient } from 'src/core/public';
import { CoreStart, NotificationsStart, IUiSettingsClient, DocLinksStart } from 'src/core/public';

import { DataPublicPluginStart } from '../../data/public';
import { createGetterSetter } from '../../kibana_utils/public';
Expand Down Expand Up @@ -35,3 +35,5 @@ export const [getInjectedVars, setInjectedVars] = createGetterSetter<{
}>('InjectedVars');

export const getEnableExternalUrls = () => getInjectedVars().enableExternalUrls;

export const [getDocLinks, setDocLinks] = createGetterSetter<DocLinksStart>('docLinks');

0 comments on commit 1365e3e

Please sign in to comment.