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

[Alerting][Docs] Moved alerting links from hard-coded to documentation link service. #92953

Merged
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ export function getAlertType(): AlertTypeModel<IndexThresholdAlertParams> {
defaultMessage: 'Alert when an aggregated query meets the threshold.',
}),
iconClass: 'alert',
documentationUrl(docLinks) {
return `${docLinks.ELASTIC_WEBSITE_URL}guide/en/kibana/${docLinks.DOC_LINK_VERSION}/alert-types.html#alert-type-index-threshold`;
},
documentationUrl: (docLinks) => docLinks.links.alerting.indexThreshold,
alertParamsExpression: lazy(() => import('./expression')),
validate: validateExpression,
defaultActionMessage: i18n.translate(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export const EmailActionConnectorFields: React.FunctionComponent<
)}
helpText={
<EuiLink
href={`${docLinks.ELASTIC_WEBSITE_URL}guide/en/kibana/${docLinks.DOC_LINK_VERSION}/email-action-type.html#configuring-email`}
href={`${docLinks.links.alerting.emailAction}#configuring-email`}
Copy link
Contributor

Choose a reason for hiding this comment

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

href={${docLinks.links.alerting.emailAction}#configuring-email}

I think the downside of putting the section anchor here instead of adding a new keyword in the doc link service, is that if the section is removed or changed, our link checking won't catch it. I think in cases where the section no longer exists, the link will default to the top of the page. If that's acceptable, then this is an okay implementation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will change it to have an own link - I think it's better to maintain 👍

target="_blank"
>
<FormattedMessage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,7 @@ const IndexActionConnectorFields: React.FunctionComponent<
defaultMessage="Use * to broaden your query."
/>
<EuiSpacer size="s" />
<EuiLink
href={`${docLinks.ELASTIC_WEBSITE_URL}guide/en/kibana/${docLinks.DOC_LINK_VERSION}/index-action-type.html`}
target="_blank"
>
<EuiLink href={docLinks.links.alerting.indexAction} target="_blank">
<FormattedMessage
id="xpack.triggersActionsUI.components.builtinActionTypes.indexAction.configureIndexHelpLabel"
defaultMessage="Configuring index connector."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export const IndexParamsFields = ({
onDocumentsChange={onDocumentsChange}
helpText={
<EuiLink
href={`${docLinks.ELASTIC_WEBSITE_URL}guide/en/kibana/${docLinks.DOC_LINK_VERSION}/index-action-type.html#index-action-configuration`}
href={`${docLinks.links.alerting.indexAction}#index-action-configuration`}
target="_blank"
>
<FormattedMessage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,7 @@ const PagerDutyActionConnectorFields: React.FunctionComponent<
id="routingKey"
fullWidth
helpText={
<EuiLink
href={`${docLinks.ELASTIC_WEBSITE_URL}guide/en/kibana/${docLinks.DOC_LINK_VERSION}/pagerduty-action-type.html`}
target="_blank"
>
<EuiLink href={docLinks.links.alerting.pagerDutyAction} target="_blank">
<FormattedMessage
id="xpack.triggersActionsUI.components.builtinActionTypes.pagerDutyAction.routingKeyNameHelpLabel"
defaultMessage="Configure a PagerDuty account"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const ServiceNowConnectorFields: React.FC<
label={i18n.API_URL_LABEL}
helpText={
<EuiLink
href={`${docLinks.ELASTIC_WEBSITE_URL}guide/en/kibana/${docLinks.DOC_LINK_VERSION}/servicenow-action-type.html#configuring-servicenow`}
href={`${docLinks.links.alerting.serviceNowAction}#configuring-servicenow`}
target="_blank"
>
<FormattedMessage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const SlackActionFields: React.FunctionComponent<
fullWidth
helpText={
<EuiLink
href={`${docLinks.ELASTIC_WEBSITE_URL}guide/en/kibana/${docLinks.DOC_LINK_VERSION}/slack-action-type.html#configuring-slack`}
href={`${docLinks.links.alerting.slackAction}#configuring-slack`}
target="_blank"
>
<FormattedMessage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const TeamsActionFields: React.FunctionComponent<
fullWidth
helpText={
<EuiLink
href={`${docLinks.ELASTIC_WEBSITE_URL}guide/en/kibana/${docLinks.DOC_LINK_VERSION}/teams-action-type.html#configuring-teams`}
href={`${docLinks.links.alerting.teamsAction}#configuring-teams`}
target="_blank"
>
<FormattedMessage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,11 @@ export const HealthCheck: React.FunctionComponent<Props> = ({
};

interface PromptErrorProps {
docLinks: Pick<DocLinksStart, 'ELASTIC_WEBSITE_URL' | 'DOC_LINK_VERSION'>;
docLinks: Pick<DocLinksStart, 'links'>;
className?: string;
}

const EncryptionError = ({
// eslint-disable-next-line @typescript-eslint/naming-convention
docLinks: { ELASTIC_WEBSITE_URL, DOC_LINK_VERSION },
className,
}: PromptErrorProps) => (
const EncryptionError = ({ docLinks, className }: PromptErrorProps) => (
<EuiEmptyPrompt
iconType="watchesApp"
data-test-subj="actionNeededEmptyPrompt"
Expand Down Expand Up @@ -133,11 +129,7 @@ const EncryptionError = ({
' in your kibana.yml file and ensure the Encrypted Saved Objects plugin is enabled. ',
}
)}
<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={docLinks.links.alerting.generalSettings} external target="_blank">
{i18n.translate(
'xpack.triggersActionsUI.components.healthCheck.encryptionErrorAction',
{
Expand All @@ -151,11 +143,7 @@ const EncryptionError = ({
/>
);

const TlsError = ({
// eslint-disable-next-line @typescript-eslint/naming-convention
docLinks: { ELASTIC_WEBSITE_URL, DOC_LINK_VERSION },
className,
}: PromptErrorProps) => (
const TlsError = ({ docLinks, className }: PromptErrorProps) => (
<EuiEmptyPrompt
iconType="watchesApp"
data-test-subj="actionNeededEmptyPrompt"
Expand All @@ -176,11 +164,7 @@ const TlsError = ({
defaultMessage:
'Alerting relies on API keys, which require TLS between Elasticsearch and Kibana. ',
})}
<EuiLink
href={`${ELASTIC_WEBSITE_URL}guide/en/kibana/${DOC_LINK_VERSION}/configuring-tls.html`}
external
target="_blank"
>
<EuiLink href={docLinks.links.security.kibanaTLS} external target="_blank">
{i18n.translate('xpack.triggersActionsUI.components.healthCheck.tlsErrorAction', {
defaultMessage: 'Learn how to enable TLS.',
})}
Expand All @@ -191,11 +175,7 @@ const TlsError = ({
/>
);

const AlertsError = ({
// eslint-disable-next-line @typescript-eslint/naming-convention
docLinks: { ELASTIC_WEBSITE_URL, DOC_LINK_VERSION },
className,
}: PromptErrorProps) => (
const AlertsError = ({ docLinks, className }: PromptErrorProps) => (
<EuiEmptyPrompt
iconType="watchesApp"
data-test-subj="alertsNeededEmptyPrompt"
Expand All @@ -215,11 +195,7 @@ const AlertsError = ({
{i18n.translate('xpack.triggersActionsUI.components.healthCheck.alertsError', {
defaultMessage: 'To create an alert, set alerts and actions plugins enabled. ',
})}
<EuiLink
href={`${ELASTIC_WEBSITE_URL}guide/en/kibana/${DOC_LINK_VERSION}/alert-action-settings-kb.html`}
external
target="_blank"
>
<EuiLink href={docLinks.links.alerting.generalSettings} external target="_blank">
{i18n.translate('xpack.triggersActionsUI.components.healthCheck.alertsErrorAction', {
defaultMessage: 'Learn how to enable Alerts and Actions.',
})}
Expand All @@ -230,11 +206,7 @@ const AlertsError = ({
/>
);

const TlsAndEncryptionError = ({
// eslint-disable-next-line @typescript-eslint/naming-convention
docLinks: { ELASTIC_WEBSITE_URL, DOC_LINK_VERSION },
className,
}: PromptErrorProps) => (
const TlsAndEncryptionError = ({ docLinks, className }: PromptErrorProps) => (
<EuiEmptyPrompt
iconType="watchesApp"
data-test-subj="actionNeededEmptyPrompt"
Expand All @@ -255,11 +227,7 @@ const TlsAndEncryptionError = ({
defaultMessage:
'You must enable Transport Layer Security between Kibana and Elasticsearch and configure an encryption key in your kibana.yml file. ',
})}
<EuiLink
href={`${ELASTIC_WEBSITE_URL}guide/en/kibana/${DOC_LINK_VERSION}/alerting-getting-started.html#alerting-setup-prerequisites`}
external
target="_blank"
>
<EuiLink href={docLinks.links.alerting.setupPrerequisites} external target="_blank">
{i18n.translate(
'xpack.triggersActionsUI.components.healthCheck.tlsAndEncryptionErrorAction',
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export const TriggersActionsUIHome: React.FunctionComponent<RouteComponentProps<
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiButtonEmpty
href={`${docLinks.ELASTIC_WEBSITE_URL}guide/en/kibana/${docLinks.DOC_LINK_VERSION}/managing-alerts-and-actions.html`}
href={docLinks.links.alerting.guide}
target="_blank"
iconType="help"
data-test-subj="documentationLink"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,7 @@ export const ActionConnectorForm = ({
values={{
actionType: actionTypeName ?? connector.actionTypeId,
docLink: (
<EuiLink
href={`${docLinks.ELASTIC_WEBSITE_URL}guide/en/kibana/${docLinks.DOC_LINK_VERSION}/action-types.html`}
target="_blank"
>
<EuiLink href={docLinks.links.alerting.actionTypes} target="_blank">
<FormattedMessage
id="xpack.triggersActionsUI.sections.actionConnectorForm.actions.actionConfigurationWarningHelpLinkText"
defaultMessage="Learn more."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -319,10 +319,7 @@ export const ConnectorEditFlyout = ({
}
)}
</EuiText>
<EuiLink
href={`${docLinks.ELASTIC_WEBSITE_URL}guide/en/kibana/${docLinks.DOC_LINK_VERSION}/pre-configured-action-types-and-connectors.html`}
target="_blank"
>
<EuiLink href={docLinks.links.alerting.preconfiguredConnectors} target="_blank">
<FormattedMessage
id="xpack.triggersActionsUI.sections.editConnectorForm.preconfiguredHelpLabel"
defaultMessage="Learn more about preconfigured connectors."
Expand Down