Skip to content

Commit

Permalink
[APM] Use doc link service in APM service maps
Browse files Browse the repository at this point in the history
  • Loading branch information
lcawl committed Aug 18, 2021
1 parent 754b79f commit c8651f5
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 12 deletions.
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

Large diffs are not rendered by default.

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 @@ -447,6 +451,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 @@ -488,6 +488,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>
);
}

0 comments on commit c8651f5

Please sign in to comment.