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

Add Vega help link to DocLinksService #87721

Merged
merged 9 commits into from
Mar 25, 2021
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 @@ -191,6 +191,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');
Copy link
Contributor

Choose a reason for hiding this comment

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

Using createGetterSetter is a bit of an outdated pattern, but I have no objection to following the Vega pattern until we actually refactor this.

cc @alexwizp for refactoring the Vega setup code