Skip to content

Commit 2c8e1bd

Browse files
committed
Restrict Suggest anomaly detector to only show for OpenSearch datasets
Signed-off-by: Joshua Li <[email protected]>
1 parent 0c16406 commit 2c8e1bd

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

public/utils/contextMenu/getActions.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import React from 'react';
77
import { i18n } from '@osd/i18n';
88
import { EuiIconType } from '@elastic/eui';
99
import { toMountPoint } from '../../../../../src/plugins/opensearch_dashboards_react/public';
10+
import { DEFAULT_DATA } from '../../../../../src/plugins/data/common';
1011
import {
1112
Action,
1213
createAction,
@@ -121,7 +122,11 @@ export const getSuggestAnomalyDetectorAction = () => {
121122
getIconType: () => ANOMALY_DETECTION_ICON,
122123
// suggestAD is only compatible with data sources that have certain agents configured
123124
isCompatible: async (context) => {
124-
if (context.datasetId) {
125+
if (
126+
context.datasetId &&
127+
(context.datasetType === DEFAULT_DATA.SET_TYPES.INDEX_PATTERN ||
128+
context.datasetType === DEFAULT_DATA.SET_TYPES.INDEX)
129+
) {
125130
const assistantClient = getAssistantClient();
126131
const res = await assistantClient.agentConfigExists(
127132
SUGGEST_ANOMALY_DETECTOR_CONFIG_ID,

0 commit comments

Comments
 (0)