Skip to content

Commit

Permalink
[APM] Show license callout in ML settings (#70959) (#71029)
Browse files Browse the repository at this point in the history
  • Loading branch information
sorenlouv authored Jul 8, 2020
1 parent f43e586 commit ccdcb4d
Showing 1 changed file with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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">
Expand Down

0 comments on commit ccdcb4d

Please sign in to comment.