diff --git a/x-pack/plugins/monitoring/public/alerts/lib/security_toasts.tsx b/x-pack/plugins/monitoring/public/alerts/lib/security_toasts.tsx
index 918c0b5c9b609..2850a5b772c32 100644
--- a/x-pack/plugins/monitoring/public/alerts/lib/security_toasts.tsx
+++ b/x-pack/plugins/monitoring/public/alerts/lib/security_toasts.tsx
@@ -7,7 +7,7 @@
import React from 'react';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';
-import { EuiSpacer, EuiLink, EuiCode, EuiText } from '@elastic/eui';
+import { EuiSpacer, EuiLink } from '@elastic/eui';
import { Legacy } from '../../legacy_shims';
import { toMountPoint } from '../../../../../../src/plugins/kibana_react/public';
@@ -30,11 +30,10 @@ const showTlsAndEncryptionError = () => {
{i18n.translate('xpack.monitoring.healthCheck.tlsAndEncryptionError', {
- defaultMessage: `You must enable Transport Layer Security between Kibana and Elasticsearch
- and configure an encryption key in your kibana.yml file to use the Alerting feature.`,
+ defaultMessage: `Stack monitoring alerts require Transport Layer Security between Kibana and Elasticsearch, and an encryption key in your kibana.yml file.`,
})}
-
+
{
});
};
-const showEncryptionError = () => {
- const { ELASTIC_WEBSITE_URL, DOC_LINK_VERSION } = Legacy.shims.docLinks;
-
- Legacy.shims.toastNotifications.addWarning(
- {
- title: toMountPoint(
-
- ),
- text: toMountPoint(
-
- {i18n.translate('xpack.monitoring.healthCheck.encryptionErrorBeforeKey', {
- defaultMessage: 'To create an alert, set a value for ',
- })}
-
- {'xpack.encryptedSavedObjects.encryptionKey'}
-
- {i18n.translate('xpack.monitoring.healthCheck.encryptionErrorAfterKey', {
- defaultMessage: ' in your kibana.yml file. ',
- })}
-
- {i18n.translate('xpack.monitoring.healthCheck.encryptionErrorAction', {
- defaultMessage: 'Learn how.',
- })}
-
-
- ),
- },
- {}
- );
-};
-
-const showTlsError = () => {
- const { ELASTIC_WEBSITE_URL, DOC_LINK_VERSION } = Legacy.shims.docLinks;
-
- Legacy.shims.toastNotifications.addWarning({
- title: toMountPoint(
-
- ),
- text: toMountPoint(
-
- {i18n.translate('xpack.monitoring.healthCheck.tlsError', {
- defaultMessage:
- 'Alerting relies on API keys, which require TLS between Elasticsearch and Kibana. ',
- })}
-
- {i18n.translate('xpack.monitoring.healthCheck.tlsErrorAction', {
- defaultMessage: 'Learn how to enable TLS.',
- })}
-
-
- ),
- });
-};
-
export const showSecurityToast = (alertingHealth: AlertingFrameworkHealth) => {
const { isSufficientlySecure, hasPermanentEncryptionKey } = alertingHealth;
+
if (
Array.isArray(alertingHealth) ||
(!alertingHealth.hasOwnProperty('isSufficientlySecure') &&
@@ -127,11 +59,7 @@ export const showSecurityToast = (alertingHealth: AlertingFrameworkHealth) => {
return;
}
- if (!isSufficientlySecure && !hasPermanentEncryptionKey) {
+ if (!isSufficientlySecure || !hasPermanentEncryptionKey) {
showTlsAndEncryptionError();
- } else if (!isSufficientlySecure) {
- showTlsError();
- } else if (!hasPermanentEncryptionKey) {
- showEncryptionError();
}
};