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

[7.x] [APM] Use doc link service instead of ElasticDocsLink (#109027) #110873

Merged
merged 1 commit into from
Sep 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
```typescript
readonly links: {
readonly settings: string;
readonly apm: {
readonly kibanaSettings: string;
readonly supportedServiceMaps: string;
};
readonly canvas: {
readonly guide: string;
};
Expand Down
8 changes: 8 additions & 0 deletions src/core/public/doc_links/doc_links_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ export class DocLinksService {
ELASTIC_WEBSITE_URL,
links: {
settings: `${ELASTIC_WEBSITE_URL}guide/en/kibana/${DOC_LINK_VERSION}/settings.html`,
apm: {
kibanaSettings: `${KIBANA_DOCS}apm-settings-in-kibana.html`,
supportedServiceMaps: `${KIBANA_DOCS}service-maps.html#service-maps-supported`,
},
canvas: {
guide: `${KIBANA_DOCS}canvas.html`,
},
Expand Down Expand Up @@ -453,6 +457,10 @@ export interface DocLinksStart {
readonly ELASTIC_WEBSITE_URL: string;
readonly links: {
readonly settings: string;
readonly apm: {
readonly kibanaSettings: string;
readonly supportedServiceMaps: string;
};
readonly canvas: {
readonly guide: string;
};
Expand Down
4 changes: 4 additions & 0 deletions src/core/public/public.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,10 @@ export interface DocLinksStart {
// (undocumented)
readonly links: {
readonly settings: string;
readonly apm: {
readonly kibanaSettings: string;
readonly supportedServiceMaps: string;
};
readonly canvas: {
readonly guide: string;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
*/

import React, { useContext, useEffect, useState } from 'react';
import { EuiCallOut } from '@elastic/eui';
import { EuiCallOut, EuiLink } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { euiStyled } from '../../../../../../../src/plugins/kibana_react/common';
import { ElasticDocsLink } from '../../shared/Links/ElasticDocsLink';
import { CytoscapeContext } from './Cytoscape';
import { useTheme } from '../../../hooks/use_theme';
import { useApmPluginContext } from '../../../context/apm_plugin/use_apm_plugin_context';

const EmptyBannerContainer = euiStyled.div`
margin: ${({ theme }) => theme.eui.gutterTypes.gutterSmall};
Expand All @@ -28,6 +28,7 @@ export function EmptyBanner() {
const theme = useTheme();
const cy = useContext(CytoscapeContext);
const [nodeCount, setNodeCount] = useState(0);
const { docLinks } = useApmPluginContext().core;

useEffect(() => {
const handler: cytoscape.EventHandler = (event) =>
Expand Down Expand Up @@ -67,14 +68,11 @@ export function EmptyBanner() {
defaultMessage:
"We will map out connected services and external requests if we can detect them. Please make sure you're running the latest version of the APM agent.",
})}{' '}
<ElasticDocsLink
section="/kibana"
path="/service-maps.html#service-maps-supported"
>
<EuiLink href={docLinks.links.apm.supportedServiceMaps}>
{i18n.translate('xpack.apm.serviceMap.emptyBanner.docsLink', {
defaultMessage: 'Learn more in the docs',
})}
</ElasticDocsLink>
</EuiLink>
</EuiCallOut>
</EmptyBannerContainer>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
* 2.0.
*/

import { EuiEmptyPrompt } from '@elastic/eui';
import { EuiEmptyPrompt, EuiLink } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import React from 'react';
import { ElasticDocsLink } from '../../shared/Links/ElasticDocsLink';
import { useApmPluginContext } from '../../../context/apm_plugin/use_apm_plugin_context';

export function TimeoutPrompt({
isGlobalServiceMap,
Expand Down Expand Up @@ -44,11 +44,12 @@ export function TimeoutPrompt({
}

function ApmSettingsDocLink() {
const { docLinks } = useApmPluginContext().core;
return (
<ElasticDocsLink section="/kibana" path="/apm-settings-in-kibana.html">
<EuiLink href={docLinks.links.apm.kibanaSettings}>
{i18n.translate('xpack.apm.serviceMap.timeoutPrompt.docsLink', {
defaultMessage: 'Learn more about APM settings in the docs',
})}
</ElasticDocsLink>
</EuiLink>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ const mockCore = {
docLinks: {
DOC_LINK_VERSION: '0',
ELASTIC_WEBSITE_URL: 'https://www.elastic.co/',
links: {
apm: {},
},
},
http: {
basePath: {
Expand Down