Skip to content

Commit

Permalink
Closes #73998 by using canAccessML in the ML capabilities API to (#…
Browse files Browse the repository at this point in the history
…73999) (#74021)

enable anomaly detection settings in APM.

Co-authored-by: Oliver Gupte <[email protected]>
Co-authored-by: Elastic Machine <[email protected]>
  • Loading branch information
3 people authored Aug 3, 2020
1 parent 961d61f commit 1aad193
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions x-pack/plugins/apm/public/components/app/Home/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ interface Props {

export function Home({ tab }: Props) {
const { config, core } = useApmPluginContext();
const isMLEnabled = !!core.application.capabilities.ml;
const canAccessML = !!core.application.capabilities.ml?.canAccessML;
const homeTabs = getHomeTabs(config);
const selectedTab = homeTabs.find(
(homeTab) => homeTab.name === tab
Expand All @@ -106,7 +106,7 @@ export function Home({ tab }: Props) {
</EuiButtonEmpty>
</SettingsLink>
</EuiFlexItem>
{isMLEnabled && (
{canAccessML && (
<EuiFlexItem grow={false}>
<AnomalyDetectionSetupLink />
</EuiFlexItem>
Expand Down
4 changes: 2 additions & 2 deletions x-pack/plugins/apm/public/components/app/Settings/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { useApmPluginContext } from '../../../hooks/useApmPluginContext';

export function Settings(props: { children: ReactNode }) {
const plugin = useApmPluginContext();
const isMLEnabled = !!plugin.core.application.capabilities.ml;
const canAccessML = !!plugin.core.application.capabilities.ml?.canAccessML;
const { search, pathname } = useLocation();
return (
<>
Expand Down Expand Up @@ -51,7 +51,7 @@ export function Settings(props: { children: ReactNode }) {
'/settings/agent-configuration'
),
},
...(isMLEnabled
...(canAccessML
? [
{
name: i18n.translate(
Expand Down

0 comments on commit 1aad193

Please sign in to comment.