[APM] Show license callout in ML settings (#70959)

This commit is contained in:
Søren Louv-Jansen 2020-07-08 02:28:32 +02:00 committed by GitHub
parent 7bded17357
commit 030daf84c9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -7,11 +7,17 @@
import React, { useState } from 'react';
import { EuiTitle, EuiSpacer, EuiText } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { EuiPanel } from '@elastic/eui';
import { JobsList } from './jobs_list';
import { AddEnvironments } from './add_environments';
import { useFetcher, FETCH_STATUS } from '../../../../hooks/useFetcher';
import { LicensePrompt } from '../../../shared/LicensePrompt';
import { useLicense } from '../../../../hooks/useLicense';
export const AnomalyDetection = () => {
const license = useLicense();
const hasValidLicense = license?.isActive && license?.hasAtLeast('platinum');
const [viewAddEnvironments, setViewAddEnvironments] = useState(false);
const { refetch, data = [], status } = useFetcher(
@ -25,6 +31,22 @@ export const AnomalyDetection = () => {
status === FETCH_STATUS.PENDING || status === FETCH_STATUS.LOADING;
const hasFetchFailure = status === FETCH_STATUS.FAILURE;
if (!hasValidLicense) {
return (
<EuiPanel>
<LicensePrompt
text={i18n.translate(
'xpack.apm.settings.anomaly_detection.license.text',
{
defaultMessage:
"To use anomaly detection, you must be subscribed to an Elastic Platinum license. With it, you'll have the ability monitor your services with the aid of machine learning.",
}
)}
/>
</EuiPanel>
);
}
return (
<>
<EuiTitle size="l">