Skip to content

Commit

Permalink
[Metrics UI] Disable anomaly alerting (elastic#93813)
Browse files Browse the repository at this point in the history
  • Loading branch information
simianhacker committed Mar 5, 2021
1 parent 80a3764 commit f1ac123
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,15 @@ import {
EuiContextMenuPanelDescriptor,
} from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
import { useInfraMLCapabilities } from '../../../containers/ml/infra_ml_capabilities';
import { PrefilledInventoryAlertFlyout } from '../../inventory/components/alert_flyout';
import { PrefilledThresholdAlertFlyout } from '../../metric_threshold/components/alert_flyout';
import { PrefilledAnomalyAlertFlyout } from '../../metric_anomaly/components/alert_flyout';
import { useLinkProps } from '../../../hooks/use_link_props';

type VisibleFlyoutType = 'inventory' | 'threshold' | 'anomaly' | null;
type VisibleFlyoutType = 'inventory' | 'threshold' | null;

export const MetricsAlertDropdown = () => {
const [popoverOpen, setPopoverOpen] = useState(false);
const [visibleFlyoutType, setVisibleFlyoutType] = useState<VisibleFlyoutType>(null);
const { hasInfraMLCapabilities } = useInfraMLCapabilities();

const closeFlyout = useCallback(() => setVisibleFlyoutType(null), [setVisibleFlyoutType]);

Expand Down Expand Up @@ -75,16 +72,7 @@ export const MetricsAlertDropdown = () => {
}),
onClick: () => setVisibleFlyoutType('inventory'),
},
].concat(
hasInfraMLCapabilities
? {
name: i18n.translate('xpack.infra.alerting.createAnomalyAlertButton', {
defaultMessage: 'Create anomaly alert',
}),
onClick: () => setVisibleFlyoutType('anomaly'),
}
: []
),
],
},
{
id: 2,
Expand All @@ -101,7 +89,7 @@ export const MetricsAlertDropdown = () => {
],
},
],
[manageAlertsLinkProps, setVisibleFlyoutType, hasInfraMLCapabilities]
[manageAlertsLinkProps, setVisibleFlyoutType]
);

const closePopover = useCallback(() => {
Expand Down Expand Up @@ -143,8 +131,6 @@ const AlertFlyout = ({ visibleFlyoutType, onClose }: AlertFlyoutProps) => {
return <PrefilledInventoryAlertFlyout onClose={onClose} />;
case 'threshold':
return <PrefilledThresholdAlertFlyout onClose={onClose} />;
case 'anomaly':
return <PrefilledAnomalyAlertFlyout onClose={onClose} />;
default:
return null;
}
Expand Down
2 changes: 0 additions & 2 deletions x-pack/plugins/infra/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { AppMountParameters, PluginInitializerContext } from 'kibana/public';
import { DEFAULT_APP_CATEGORIES } from '../../../../src/core/public';
import { createMetricThresholdAlertType } from './alerting/metric_threshold';
import { createInventoryMetricAlertType } from './alerting/inventory';
import { createMetricAnomalyAlertType } from './alerting/metric_anomaly';
import { getAlertType as getLogsAlertType } from './alerting/log_threshold';
import { registerFeatures } from './register_feature';
import {
Expand All @@ -36,7 +35,6 @@ export class Plugin implements InfraClientPluginClass {
pluginsSetup.triggersActionsUi.alertTypeRegistry.register(createInventoryMetricAlertType());
pluginsSetup.triggersActionsUi.alertTypeRegistry.register(getLogsAlertType());
pluginsSetup.triggersActionsUi.alertTypeRegistry.register(createMetricThresholdAlertType());
pluginsSetup.triggersActionsUi.alertTypeRegistry.register(createMetricAnomalyAlertType());

if (pluginsSetup.observability) {
pluginsSetup.observability.dashboard.register({
Expand Down

0 comments on commit f1ac123

Please sign in to comment.