From 896c919a8f8cf78f50274cbdb77b78d1b4e8be02 Mon Sep 17 00:00:00 2001 From: Shahzad Date: Mon, 2 Nov 2020 13:12:56 +0100 Subject: [PATCH] [Uptime] Remove custom handling of license enabling (#82019) Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../__snapshots__/license_info.test.tsx.snap | 42 +++++++---------- .../__snapshots__/ml_flyout.test.tsx.snap | 25 +++++----- .../components/monitor/ml/license_info.tsx | 46 ++++--------------- 3 files changed, 35 insertions(+), 78 deletions(-) diff --git a/x-pack/plugins/uptime/public/components/monitor/ml/__tests__/__snapshots__/license_info.test.tsx.snap b/x-pack/plugins/uptime/public/components/monitor/ml/__tests__/__snapshots__/license_info.test.tsx.snap index 68e3606d880d6..edf89caaff557 100644 --- a/x-pack/plugins/uptime/public/components/monitor/ml/__tests__/__snapshots__/license_info.test.tsx.snap +++ b/x-pack/plugins/uptime/public/components/monitor/ml/__tests__/__snapshots__/license_info.test.tsx.snap @@ -26,24 +26,21 @@ Array [

In order to access duration anomaly detection, you have to be subscribed to an Elastic Platinum license.

- - + - - Start free 14-day trial - + Start free 14-day trial - - + + ,
In order to access duration anomaly detection, you have to be subscribed to an Elastic Platinum license.

- - - Start free 14-day trial - - + Start free 14-day trial + diff --git a/x-pack/plugins/uptime/public/components/monitor/ml/__tests__/__snapshots__/ml_flyout.test.tsx.snap b/x-pack/plugins/uptime/public/components/monitor/ml/__tests__/__snapshots__/ml_flyout.test.tsx.snap index ac1afccd1feae..fd59b14520ce1 100644 --- a/x-pack/plugins/uptime/public/components/monitor/ml/__tests__/__snapshots__/ml_flyout.test.tsx.snap +++ b/x-pack/plugins/uptime/public/components/monitor/ml/__tests__/__snapshots__/ml_flyout.test.tsx.snap @@ -146,24 +146,21 @@ exports[`ML Flyout component shows license info if no ml available 1`] = `

In order to access duration anomaly detection, you have to be subscribed to an Elastic Platinum license.

- - + - - Start free 14-day trial - + Start free 14-day trial - - + +
{ const { basePath } = useContext(UptimeSettingsContext); - const [loading, setLoading] = useState(false); - const hasMlFeature = useSelector(hasMLFeatureSelector); const dispatch = useDispatch(); @@ -22,29 +19,6 @@ export const ShowLicenseInfo = () => { dispatch(getMLCapabilitiesAction.get()); }, [dispatch]); - useEffect(() => { - let retryInterval: any; - if (loading) { - retryInterval = setInterval(() => { - dispatch(getMLCapabilitiesAction.get()); - }, 5000); - } else { - clearInterval(retryInterval); - } - - return () => { - clearInterval(retryInterval); - }; - }, [dispatch, loading]); - - useEffect(() => { - setLoading(false); - }, [hasMlFeature]); - - const startLicenseTrial = () => { - setLoading(true); - }; - return ( <> { iconType="help" >

{labels.START_TRAIL_DESC}

- {}}> - - {labels.START_TRAIL} - - + + {labels.START_TRAIL} +