Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
parent
a6888e3694
commit
5e86d2f848
|
@ -83,7 +83,8 @@ interface Props {
|
|||
}
|
||||
|
||||
export function Home({ tab }: Props) {
|
||||
const { config } = useApmPluginContext();
|
||||
const { config, core } = useApmPluginContext();
|
||||
const isMLEnabled = !!core.application.capabilities.ml;
|
||||
const homeTabs = getHomeTabs(config);
|
||||
const selectedTab = homeTabs.find(
|
||||
(homeTab) => homeTab.name === tab
|
||||
|
@ -105,9 +106,11 @@ export function Home({ tab }: Props) {
|
|||
</EuiButtonEmpty>
|
||||
</SettingsLink>
|
||||
</EuiFlexItem>
|
||||
<EuiFlexItem grow={false}>
|
||||
<AnomalyDetectionSetupLink />
|
||||
</EuiFlexItem>
|
||||
{isMLEnabled && (
|
||||
<EuiFlexItem grow={false}>
|
||||
<AnomalyDetectionSetupLink />
|
||||
</EuiFlexItem>
|
||||
)}
|
||||
<EuiFlexItem grow={false}>
|
||||
<SetupInstructionsLink />
|
||||
</EuiFlexItem>
|
||||
|
|
|
@ -64,7 +64,7 @@ export function AddEnvironments({
|
|||
return (
|
||||
<EuiPanel>
|
||||
<EuiEmptyPrompt
|
||||
iconType="warning"
|
||||
iconType="alert"
|
||||
body={<>{ML_ERRORS.MISSING_WRITE_PRIVILEGES}</>}
|
||||
/>
|
||||
</EuiPanel>
|
||||
|
|
|
@ -29,7 +29,7 @@ const DEFAULT_VALUE: AnomalyDetectionApiResponse = {
|
|||
|
||||
export function AnomalyDetection() {
|
||||
const plugin = useApmPluginContext();
|
||||
const canGetJobs = !!plugin.core.application.capabilities.ml.canGetJobs;
|
||||
const canGetJobs = !!plugin.core.application.capabilities.ml?.canGetJobs;
|
||||
const license = useLicense();
|
||||
const hasValidLicense = license?.isActive && license?.hasAtLeast('platinum');
|
||||
|
||||
|
@ -57,7 +57,7 @@ export function AnomalyDetection() {
|
|||
return (
|
||||
<EuiPanel>
|
||||
<EuiEmptyPrompt
|
||||
iconType="warning"
|
||||
iconType="alert"
|
||||
body={<>{ML_ERRORS.MISSING_READ_PRIVILEGES}</>}
|
||||
/>
|
||||
</EuiPanel>
|
||||
|
|
|
@ -16,8 +16,11 @@ import {
|
|||
import { HomeLink } from '../../shared/Links/apm/HomeLink';
|
||||
import { useLocation } from '../../../hooks/useLocation';
|
||||
import { getAPMHref } from '../../shared/Links/apm/APMLink';
|
||||
import { useApmPluginContext } from '../../../hooks/useApmPluginContext';
|
||||
|
||||
export function Settings(props: { children: ReactNode }) {
|
||||
const plugin = useApmPluginContext();
|
||||
const isMLEnabled = !!plugin.core.application.capabilities.ml;
|
||||
const { search, pathname } = useLocation();
|
||||
return (
|
||||
<>
|
||||
|
@ -48,17 +51,25 @@ export function Settings(props: { children: ReactNode }) {
|
|||
'/settings/agent-configuration'
|
||||
),
|
||||
},
|
||||
{
|
||||
name: i18n.translate(
|
||||
'xpack.apm.settings.anomalyDetection',
|
||||
{
|
||||
defaultMessage: 'Anomaly detection',
|
||||
}
|
||||
),
|
||||
id: '4',
|
||||
href: getAPMHref('/settings/anomaly-detection', search),
|
||||
isSelected: pathname === '/settings/anomaly-detection',
|
||||
},
|
||||
...(isMLEnabled
|
||||
? [
|
||||
{
|
||||
name: i18n.translate(
|
||||
'xpack.apm.settings.anomalyDetection',
|
||||
{
|
||||
defaultMessage: 'Anomaly detection',
|
||||
}
|
||||
),
|
||||
id: '4',
|
||||
href: getAPMHref(
|
||||
'/settings/anomaly-detection',
|
||||
search
|
||||
),
|
||||
isSelected:
|
||||
pathname === '/settings/anomaly-detection',
|
||||
},
|
||||
]
|
||||
: []),
|
||||
{
|
||||
name: i18n.translate('xpack.apm.settings.customizeApp', {
|
||||
defaultMessage: 'Customize app',
|
||||
|
|
Loading…
Reference in a new issue