Skip to content

Commit

Permalink
Closes elastic#73998 by using canAccessML in the ML capabilities AP…
Browse files Browse the repository at this point in the history
…I to

enable anomaly detection settings in APM.
  • Loading branch information
ogupte committed Jul 31, 2020
1 parent d9efd26 commit 746204b
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 746204b

Please sign in to comment.