Skip to content

Commit

Permalink
Use doc link service in more Stack Monitoring pages (#89050) (#90324)
Browse files Browse the repository at this point in the history
Co-authored-by: igoristic <[email protected]>
  • Loading branch information
lcawl and igoristic authored Feb 5, 2021
1 parent f671470 commit f8a354f
Show file tree
Hide file tree
Showing 17 changed files with 119 additions and 162 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ readonly links: {
readonly installation: string;
readonly configuration: string;
readonly elasticsearchOutput: string;
readonly elasticsearchModule: string;
readonly startup: string;
readonly exportedFields: string;
};
Expand All @@ -29,6 +30,10 @@ readonly links: {
};
readonly metricbeat: {
readonly base: string;
readonly configure: string;
readonly httpEndpoint: string;
readonly install: string;
readonly start: string;
};
readonly enterpriseSearch: {
readonly base: string;
Expand Down
13 changes: 13 additions & 0 deletions src/core/public/doc_links/doc_links_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export class DocLinksService {
base: `${ELASTIC_WEBSITE_URL}guide/en/beats/filebeat/${DOC_LINK_VERSION}`,
installation: `${ELASTIC_WEBSITE_URL}guide/en/beats/filebeat/${DOC_LINK_VERSION}/filebeat-installation-configuration.html`,
configuration: `${ELASTIC_WEBSITE_URL}guide/en/beats/filebeat/${DOC_LINK_VERSION}/configuring-howto-filebeat.html`,
elasticsearchModule: `${ELASTIC_WEBSITE_URL}guide/en/beats/filebeat/${DOC_LINK_VERSION}/filebeat-module-elasticsearch.html`,
elasticsearchOutput: `${ELASTIC_WEBSITE_URL}guide/en/beats/filebeat/${DOC_LINK_VERSION}/elasticsearch-output.html`,
startup: `${ELASTIC_WEBSITE_URL}guide/en/beats/filebeat/${DOC_LINK_VERSION}/filebeat-starting.html`,
exportedFields: `${ELASTIC_WEBSITE_URL}guide/en/beats/filebeat/${DOC_LINK_VERSION}/exported-fields.html`,
Expand All @@ -53,6 +54,10 @@ export class DocLinksService {
},
metricbeat: {
base: `${ELASTIC_WEBSITE_URL}guide/en/beats/metricbeat/${DOC_LINK_VERSION}`,
configure: `${ELASTIC_WEBSITE_URL}guide/en/beats/metricbeat/${DOC_LINK_VERSION}/configuring-howto-metricbeat.html`,
httpEndpoint: `${ELASTIC_WEBSITE_URL}guide/en/beats/metricbeat/${DOC_LINK_VERSION}/http-endpoint.html`,
install: `${ELASTIC_WEBSITE_URL}guide/en/beats/metricbeat/${DOC_LINK_VERSION}/metricbeat-installation-configuration.html`,
start: `${ELASTIC_WEBSITE_URL}guide/en/beats/metricbeat/${DOC_LINK_VERSION}/metricbeat-starting.html`,
},
heartbeat: {
base: `${ELASTIC_WEBSITE_URL}guide/en/beats/heartbeat/${DOC_LINK_VERSION}`,
Expand Down Expand Up @@ -195,8 +200,11 @@ export class DocLinksService {
alertsKibanaDiskThreshold: `${ELASTIC_WEBSITE_URL}guide/en/kibana/${DOC_LINK_VERSION}/kibana-alerts.html#kibana-alerts-disk-usage-threshold`,
alertsKibanaJvmThreshold: `${ELASTIC_WEBSITE_URL}guide/en/kibana/${DOC_LINK_VERSION}/kibana-alerts.html#kibana-alerts-jvm-memory-threshold`,
alertsKibanaMissingData: `${ELASTIC_WEBSITE_URL}guide/en/kibana/${DOC_LINK_VERSION}/kibana-alerts.html#kibana-alerts-missing-monitoring-data`,
metricbeatBlog: `${ELASTIC_WEBSITE_URL}blog/external-collection-for-elastic-stack-monitoring-is-now-available-via-metricbeat`,
monitorElasticsearch: `${ELASTICSEARCH_DOCS}configuring-metricbeat.html`,
monitorKibana: `${ELASTIC_WEBSITE_URL}guide/en/kibana/${DOC_LINK_VERSION}/monitoring-metricbeat.html`,
monitorLogstash: `${ELASTIC_WEBSITE_URL}guide/en/logstash/${DOC_LINK_VERSION}/monitoring-with-metricbeat.html`,
troubleshootKibana: `${ELASTIC_WEBSITE_URL}guide/en/kibana/${DOC_LINK_VERSION}/monitor-troubleshooting.html`,
},
security: {
apiKeyServiceSettings: `${ELASTICSEARCH_DOCS}security-settings.html#api-key-service-settings`,
Expand Down Expand Up @@ -259,6 +267,7 @@ export interface DocLinksStart {
readonly installation: string;
readonly configuration: string;
readonly elasticsearchOutput: string;
readonly elasticsearchModule: string;
readonly startup: string;
readonly exportedFields: string;
};
Expand All @@ -267,6 +276,10 @@ export interface DocLinksStart {
};
readonly metricbeat: {
readonly base: string;
readonly configure: string;
readonly httpEndpoint: string;
readonly install: string;
readonly start: string;
};
readonly enterpriseSearch: {
readonly base: string;
Expand Down
5 changes: 5 additions & 0 deletions src/core/public/public.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,7 @@ export interface DocLinksStart {
readonly installation: string;
readonly configuration: string;
readonly elasticsearchOutput: string;
readonly elasticsearchModule: string;
readonly startup: string;
readonly exportedFields: string;
};
Expand All @@ -482,6 +483,10 @@ export interface DocLinksStart {
};
readonly metricbeat: {
readonly base: string;
readonly configure: string;
readonly httpEndpoint: string;
readonly install: string;
readonly start: string;
};
readonly enterpriseSearch: {
readonly base: string;
Expand Down
16 changes: 4 additions & 12 deletions x-pack/plugins/monitoring/public/alerts/lib/alerts_toast.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export interface EnableAlertResponse {
}

const showTlsAndEncryptionError = () => {
const { ELASTIC_WEBSITE_URL, DOC_LINK_VERSION } = Legacy.shims.docLinks;
const settingsUrl = Legacy.shims.docLinks.links.alerting.generalSettings;

Legacy.shims.toastNotifications.addWarning({
title: toMountPoint(
Expand All @@ -36,11 +36,7 @@ const showTlsAndEncryptionError = () => {
})}
</p>
<EuiSpacer size="xs" />
<EuiLink
href={`${ELASTIC_WEBSITE_URL}guide/en/kibana/${DOC_LINK_VERSION}/alert-action-settings-kb.html#general-alert-action-settings`}
external
target="_blank"
>
<EuiLink href={settingsUrl} external target="_blank">
{i18n.translate('xpack.monitoring.healthCheck.encryptionErrorAction', {
defaultMessage: 'Learn how.',
})}
Expand All @@ -51,7 +47,7 @@ const showTlsAndEncryptionError = () => {
};

const showUnableToDisableWatcherClusterAlertsError = () => {
const { ELASTIC_WEBSITE_URL, DOC_LINK_VERSION } = Legacy.shims.docLinks;
const settingsUrl = Legacy.shims.docLinks.links.alerting.generalSettings;

Legacy.shims.toastNotifications.addWarning({
title: toMountPoint(
Expand All @@ -68,11 +64,7 @@ const showUnableToDisableWatcherClusterAlertsError = () => {
})}
</p>
<EuiSpacer size="xs" />
<EuiLink
href={`${ELASTIC_WEBSITE_URL}guide/en/kibana/${DOC_LINK_VERSION}/alert-action-settings-kb.html#general-alert-action-settings`}
external
target="_blank"
>
<EuiLink href={settingsUrl} external target="_blank">
{i18n.translate('xpack.monitoring.healthCheck.unableToDisableWatches.action', {
defaultMessage: 'Learn more.',
})}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 11 additions & 33 deletions x-pack/plugins/monitoring/public/components/logs/reason.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ import { Legacy } from '../../legacy_shims';
import { Monospace } from '../metricbeat_migration/instruction_steps/components/monospace/monospace';

export const Reason = ({ reason }) => {
const { ELASTIC_WEBSITE_URL, DOC_LINK_VERSION } = Legacy.shims.docLinks;
const filebeatUrl = Legacy.shims.docLinks.links.filebeat.installation;
const elasticsearchUrl = Legacy.shims.docLinks.links.filebeat.elasticsearchModule;
const troubleshootUrl = Legacy.shims.docLinks.links.monitoring.troubleshootKibana;
let title = i18n.translate('xpack.monitoring.logs.reason.defaultTitle', {
defaultMessage: 'No log data found',
});
Expand All @@ -23,10 +25,7 @@ export const Reason = ({ reason }) => {
defaultMessage="We did not find any log data and we are unable to diagnose why. {link}"
values={{
link: (
<EuiLink
target="_blank"
href={`${ELASTIC_WEBSITE_URL}guide/en/beats/filebeat/${DOC_LINK_VERSION}/filebeat-installation-configuration.html`}
>
<EuiLink target="_blank" href={filebeatUrl}>
<FormattedMessage
id="xpack.monitoring.logs.reason.defaultMessageLink"
defaultMessage="Please verify your setup is correct."
Expand All @@ -47,10 +46,7 @@ export const Reason = ({ reason }) => {
defaultMessage="Set up {link}, then configure your Elasticsearch output to your monitoring cluster."
values={{
link: (
<EuiLink
target="_blank"
href={`${ELASTIC_WEBSITE_URL}guide/en/beats/filebeat/${DOC_LINK_VERSION}/filebeat-installation-configuration.html`}
>
<EuiLink target="_blank" href={filebeatUrl}>
{i18n.translate('xpack.monitoring.logs.reason.noIndexPatternLink', {
defaultMessage: 'Filebeat',
})}
Expand Down Expand Up @@ -82,10 +78,7 @@ export const Reason = ({ reason }) => {
defaultMessage="Follow {link} to set up Elasticsearch."
values={{
link: (
<EuiLink
target="_blank"
href={`${ELASTIC_WEBSITE_URL}guide/en/beats/filebeat/${DOC_LINK_VERSION}/filebeat-module-elasticsearch.html`}
>
<EuiLink target="_blank" href={elasticsearchUrl}>
{i18n.translate('xpack.monitoring.logs.reason.noTypeLink', {
defaultMessage: 'these directions',
})}
Expand All @@ -105,10 +98,7 @@ export const Reason = ({ reason }) => {
values={{
varPaths: <Monospace>var.paths</Monospace>,
link: (
<EuiLink
target="_blank"
href={`${ELASTIC_WEBSITE_URL}guide/en/beats/filebeat/${DOC_LINK_VERSION}/filebeat-module-elasticsearch.html`}
>
<EuiLink target="_blank" href={elasticsearchUrl}>
{i18n.translate('xpack.monitoring.logs.reason.notUsingStructuredLogsLink', {
defaultMessage: 'points to JSON logs',
})}
Expand All @@ -127,10 +117,7 @@ export const Reason = ({ reason }) => {
defaultMessage="Check that your {link} is correct."
values={{
link: (
<EuiLink
target="_blank"
href={`${ELASTIC_WEBSITE_URL}guide/en/beats/filebeat/${DOC_LINK_VERSION}/filebeat-module-elasticsearch.html`}
>
<EuiLink target="_blank" href={elasticsearchUrl}>
{i18n.translate('xpack.monitoring.logs.reason.noClusterLink', {
defaultMessage: 'setup',
})}
Expand All @@ -149,10 +136,7 @@ export const Reason = ({ reason }) => {
defaultMessage="Check that your {link} is correct."
values={{
link: (
<EuiLink
target="_blank"
href={`${ELASTIC_WEBSITE_URL}guide/en/beats/filebeat/${DOC_LINK_VERSION}/filebeat-module-elasticsearch.html`}
>
<EuiLink target="_blank" href={elasticsearchUrl}>
{i18n.translate('xpack.monitoring.logs.reason.noNodeLink', {
defaultMessage: 'setup',
})}
Expand All @@ -171,10 +155,7 @@ export const Reason = ({ reason }) => {
defaultMessage="We found logs, but none for this index. If this problem continues, check that your {link} is correct."
values={{
link: (
<EuiLink
target="_blank"
href={`${ELASTIC_WEBSITE_URL}guide/en/beats/filebeat/${DOC_LINK_VERSION}/filebeat-module-elasticsearch.html`}
>
<EuiLink target="_blank" href={elasticsearchUrl}>
{i18n.translate('xpack.monitoring.logs.reason.noIndexLink', {
defaultMessage: 'setup',
})}
Expand All @@ -193,10 +174,7 @@ export const Reason = ({ reason }) => {
defaultMessage="There is an issue reading from your filebeat indices. {link}."
values={{
link: (
<EuiLink
target="_blank"
href={`${ELASTIC_WEBSITE_URL}guide/en/kibana/${DOC_LINK_VERSION}/monitor-troubleshooting.html`}
>
<EuiLink target="_blank" href={troubleshootUrl}>
{i18n.translate('xpack.monitoring.logs.reason.correctIndexNameLink', {
defaultMessage: 'Click here for more information',
})}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@ jest.mock('../../legacy_shims', () => ({
docLinks: {
ELASTIC_WEBSITE_URL: 'https://www.elastic.co/',
DOC_LINK_VERSION: 'current',
links: {
filebeat: {
elasticsearchModule: 'jest-metadata-mock-url',
installation: 'jest-metadata-mock-url',
},
monitoring: {
troubleshootKibana: 'jest-metadata-mock-url',
},
},
},
},
},
Expand Down
Loading

0 comments on commit f8a354f

Please sign in to comment.